From 9e5a367cdf0b8629cbb9ca1863b4a72373692826 Mon Sep 17 00:00:00 2001 From: Lamn <70603474+Lamnxzp@users.noreply.github.com> Date: Mon, 23 Dec 2024 16:37:50 +0100 Subject: [PATCH] fix(ir_read.cpp): resume irrecv after device save --- src/modules/ir/ir_read.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/modules/ir/ir_read.cpp b/src/modules/ir/ir_read.cpp index 3ba354ae7..53cd7fe86 100644 --- a/src/modules/ir/ir_read.cpp +++ b/src/modules/ir/ir_read.cpp @@ -203,7 +203,6 @@ String IrRead::parse_raw_signal() { return signal_code; } - void IrRead::append_to_file_str(String btn_name) { strDeviceContent += "name: " + btn_name + "\n"; @@ -312,34 +311,32 @@ void IrRead::save_device() { FS* fs = nullptr; - bool sdCardAvaible = setupSdCard(); - bool littleFsAvaible = checkLittleFsSize(); + bool sdCardAvailable = setupSdCard(); + bool littleFsAvailable = checkLittleFsSize(); - if (sdCardAvaible && littleFsAvaible) { + if (sdCardAvailable && littleFsAvailable) { // ask to choose one options = { - {"SD Card", [&]() { fs=&SD; }}, + {"SD Card", [&]() { fs=&SD; }}, {"LittleFS", [&]() { fs=&LittleFS; }}, }; delay(200); loopOptions(options); - } else if (sdCardAvaible) { + } else if (sdCardAvailable) { fs=&SD; - } else if (littleFsAvaible) { + } else if (littleFsAvailable) { fs=&LittleFS; }; - if (fs != nullptr && write_file(filename, fs)) { + if (fs && write_file(filename, fs)) { displaySuccess("File saved to " + String((fs == &SD) ? "SD Card" : "LittleFS") + ".", true); signals_read = 0; strDeviceContent = ""; - } else { - if (fs == nullptr) { - displayError("No storage available.", true); - } else displayError("Error writing file.", true); - } + } else displayError(fs ? "Error writing file." : "No storage available.", true); delay(1000); + + irrecv.resume(); begin(); }