mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-20 04:54:45 -07: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:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "infrared_error_code.h"
|
||||
#include <flipper_format/flipper_format.h>
|
||||
#include <infrared/encoder_decoder/infrared.h>
|
||||
|
||||
@@ -136,9 +137,10 @@ const InfraredMessage* infrared_signal_get_message(const InfraredSignal* signal)
|
||||
* @param[in,out] signal pointer to the instance to be read into.
|
||||
* @param[in,out] ff pointer to the FlipperFormat file instance to read from.
|
||||
* @param[out] name pointer to the string to hold the signal name. Must be properly allocated.
|
||||
* @returns true if a signal was successfully read, false otherwise (e.g. no more signals to read).
|
||||
* @returns InfraredErrorCodeNone if a signal was successfully read, otherwise error code
|
||||
*/
|
||||
bool infrared_signal_read(InfraredSignal* signal, FlipperFormat* ff, FuriString* name);
|
||||
InfraredErrorCode
|
||||
infrared_signal_read(InfraredSignal* signal, FlipperFormat* ff, FuriString* name);
|
||||
|
||||
/**
|
||||
* @brief Read a signal name from a FlipperFormat file.
|
||||
@@ -147,9 +149,9 @@ bool infrared_signal_read(InfraredSignal* signal, FlipperFormat* ff, FuriString*
|
||||
*
|
||||
* @param[in,out] ff pointer to the FlipperFormat file instance to read from.
|
||||
* @param[out] name pointer to the string to hold the signal name. Must be properly allocated.
|
||||
* @returns true if a signal name was successfully read, false otherwise (e.g. no more signals to read).
|
||||
* @returns InfraredErrorCodeNone if a signal name was successfully read, otherwise error code
|
||||
*/
|
||||
bool infrared_signal_read_name(FlipperFormat* ff, FuriString* name);
|
||||
InfraredErrorCode infrared_signal_read_name(FlipperFormat* ff, FuriString* name);
|
||||
|
||||
/**
|
||||
* @brief Read a signal from a FlipperFormat file.
|
||||
@@ -158,9 +160,9 @@ bool infrared_signal_read_name(FlipperFormat* ff, FuriString* name);
|
||||
*
|
||||
* @param[in,out] ff pointer to the FlipperFormat file instance to read from.
|
||||
* @param[out] body pointer to the InfraredSignal instance to hold the signal body. Must be properly allocated.
|
||||
* @returns true if a signal body was successfully read, false otherwise (e.g. syntax error).
|
||||
* @returns InfraredErrorCodeNone if a signal body was successfully read, otherwise error code.
|
||||
*/
|
||||
bool infrared_signal_read_body(InfraredSignal* signal, FlipperFormat* ff);
|
||||
InfraredErrorCode infrared_signal_read_body(InfraredSignal* signal, FlipperFormat* ff);
|
||||
|
||||
/**
|
||||
* @brief Read a signal with a particular name from a FlipperFormat file into an InfraredSignal instance.
|
||||
@@ -171,9 +173,9 @@ bool infrared_signal_read_body(InfraredSignal* signal, FlipperFormat* ff);
|
||||
* @param[in,out] signal pointer to the instance to be read into.
|
||||
* @param[in,out] ff pointer to the FlipperFormat file instance to read from.
|
||||
* @param[in] name pointer to a zero-terminated string containing the requested signal name.
|
||||
* @returns true if a signal was found and successfully read, false otherwise (e.g. the signal was not found).
|
||||
* @returns InfraredErrorCodeNone if a signal was found and successfully read, otherwise error code.
|
||||
*/
|
||||
bool infrared_signal_search_by_name_and_read(
|
||||
InfraredErrorCode infrared_signal_search_by_name_and_read(
|
||||
InfraredSignal* signal,
|
||||
FlipperFormat* ff,
|
||||
const char* name);
|
||||
@@ -187,9 +189,9 @@ bool infrared_signal_search_by_name_and_read(
|
||||
* @param[in,out] signal pointer to the instance to be read into.
|
||||
* @param[in,out] ff pointer to the FlipperFormat file instance to read from.
|
||||
* @param[in] index the requested signal index.
|
||||
* @returns true if a signal was found and successfully read, false otherwise (e.g. the signal was not found).
|
||||
* @returns InfraredErrorCodeNone if a signal was found and successfully read, otherwise error code.
|
||||
*/
|
||||
bool infrared_signal_search_by_index_and_read(
|
||||
InfraredErrorCode infrared_signal_search_by_index_and_read(
|
||||
InfraredSignal* signal,
|
||||
FlipperFormat* ff,
|
||||
size_t index);
|
||||
@@ -203,8 +205,10 @@ bool infrared_signal_search_by_index_and_read(
|
||||
* @param[in] signal pointer to the instance holding the signal to be saved.
|
||||
* @param[in,out] ff pointer to the FlipperFormat file instance to write to.
|
||||
* @param[in] name pointer to a zero-terminated string contating the name of the signal.
|
||||
* @returns InfraredErrorCodeNone if a signal was successfully saved, otherwise error code
|
||||
*/
|
||||
bool infrared_signal_save(const InfraredSignal* signal, FlipperFormat* ff, const char* name);
|
||||
InfraredErrorCode
|
||||
infrared_signal_save(const InfraredSignal* signal, FlipperFormat* ff, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Transmit a signal contained in an InfraredSignal instance.
|
||||
|
||||
Reference in New Issue
Block a user