Skip to content

Commit

Permalink
fix(ir_read.cpp): resume irrecv after device save
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamnxzp committed Dec 23, 2024
1 parent bfcc813 commit 9e5a367
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/modules/ir/ir_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 9e5a367

Please sign in to comment.