1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-13 05:06:30 +04:00

[FL-3890] Infrared button operation fails now shows more informative messages (#3859)

* Error codes enum added
* Adjusted signal api to return error codes instead of bool
* Remote api adjusted to work with error codes
* Brute force logic adjusted to work with error codes
* Other application functions adjust to work with error codes
* All task callbacks now return ErrorCode through int32t, which belongs to thread
* All scenes now work with error codes
* More api functions now return error code
* Now signal names are buffered and restored in case of error.
* New error code enumeration added. Now least significant byte is left for the button index
* Some macro to simplify error setup and error check
* Error code checks replaced by macro
* Different message is now shown when move failed
* Comments updated
* Fixed error check
* Fixed navigation issue while openning broken files from Favorites
* Now search by index also returns index in addition to error code
* Remote loading logic adjusted
* New error codes added and numbers adjusted
* New error message when loading library file instead of signal one
* Some more remote loading logic adjusted
* New error message on rename fail
* Grammar mistake fix
* Function signature changed
* Function usage adjusted according to new signature

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
RebornedBrain
2024-09-06 12:52:00 +03:00
committed by GitHub
parent 6a1c27ef93
commit e0654fe409
18 changed files with 541 additions and 261 deletions

View File

@@ -232,9 +232,15 @@ static void infrared_cli_start_ir_tx(Cli* cli, FuriString* args) {
static bool
infrared_cli_save_signal(InfraredSignal* signal, FlipperFormat* file, const char* name) {
bool ret = infrared_signal_save(signal, file, name);
if(!ret) {
printf("Failed to save signal: \"%s\"\r\n", name);
bool ret = true;
InfraredErrorCode error = infrared_signal_save(signal, file, name);
if(INFRARED_ERROR_PRESENT(error)) {
printf(
"Failed to save signal: \"%s\" code: 0x%X index: 0x%02X\r\n",
name,
INFRARED_ERROR_GET_CODE(error),
INFRARED_ERROR_GET_INDEX(error));
ret = false;
}
return ret;
}
@@ -296,7 +302,7 @@ static bool infrared_cli_decode_file(FlipperFormat* input_file, FlipperFormat* o
FuriString* tmp;
tmp = furi_string_alloc();
while(infrared_signal_read(signal, input_file, tmp)) {
while(infrared_signal_read(signal, input_file, tmp) == InfraredErrorCodeNone) {
ret = false;
if(!infrared_signal_is_valid(signal)) {
printf("Invalid signal\r\n");
@@ -464,7 +470,7 @@ static void
printf("Missing signal name.\r\n");
break;
}
if(!infrared_brute_force_calculate_messages(brute_force)) {
if(infrared_brute_force_calculate_messages(brute_force) != InfraredErrorCodeNone) {
printf("Invalid remote name.\r\n");
break;
}