mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
IR: "Decode only" mode, more intuitive learn scene buttons
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
- Apps:
|
||||
- Sub-GHz: Sub-GHz Playlist Creator (by @coolerUA)
|
||||
- NFC: Ventra ULEV1 parser (by @hazardousvoltage)
|
||||
- Infrared: "Decode only" mode to ignore RAW signals, make buttons in learn scene more intuitive (by @WillyJL)
|
||||
- UL: Sub-GHz: Add keeloq ironlogic aka il100 smart clone cloners support (by @xMasterX & Vitaly)
|
||||
- UL: iButton: Add TM01x Dallas write support (by @Leptopt1los)
|
||||
- UL: Display: Backlight option "Always ON" (by @Dmitry422)
|
||||
|
||||
@@ -159,6 +159,7 @@ static InfraredApp* infrared_alloc(void) {
|
||||
app_state->is_otg_enabled = false;
|
||||
app_state->is_easy_mode = false;
|
||||
app_state->is_decode_enabled = true;
|
||||
app_state->is_decode_forced = false;
|
||||
app_state->edit_target = InfraredEditTargetNone;
|
||||
app_state->edit_mode = InfraredEditModeNone;
|
||||
app_state->current_button_index = InfraredButtonIndexNone;
|
||||
|
||||
@@ -91,6 +91,7 @@ typedef struct {
|
||||
bool is_otg_enabled; /**< Whether OTG power (external 5V) is enabled. */
|
||||
bool is_easy_mode; /**< Whether easy learning mode is enabled. */
|
||||
bool is_decode_enabled; /**< Whether signal decoding is enabled. */
|
||||
bool is_decode_forced; /**< Whether signal decoding is forced. */
|
||||
InfraredEditTarget edit_target : 8; /**< Selected editing target (a remote or a button). */
|
||||
InfraredEditMode edit_mode : 8; /**< Selected editing operation (rename or delete). */
|
||||
int32_t current_button_index; /**< Selected button index (move destination). */
|
||||
|
||||
@@ -146,9 +146,12 @@ void infrared_scene_learn_on_enter(void* context) {
|
||||
}
|
||||
|
||||
dialog_ex_set_left_button_text(
|
||||
dialog_ex, infrared->app_state.is_easy_mode ? "Manual" : "Easy");
|
||||
dialog_ex, infrared->app_state.is_easy_mode ? "Easy" : "Manual");
|
||||
dialog_ex_set_right_button_text(
|
||||
dialog_ex, infrared->app_state.is_decode_enabled ? "RAW" : "Decode");
|
||||
dialog_ex,
|
||||
infrared->app_state.is_decode_forced ? "Decode" :
|
||||
infrared->app_state.is_decode_enabled ? "Auto" :
|
||||
"RAW");
|
||||
|
||||
dialog_ex_set_context(dialog_ex, context);
|
||||
dialog_ex_set_result_callback(dialog_ex, infrared_scene_learn_dialog_result_callback);
|
||||
@@ -179,11 +182,26 @@ bool infrared_scene_learn_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
} else if(event.event == DialogExResultRight) {
|
||||
// Toggle signal decoding
|
||||
infrared->app_state.is_decode_enabled = !infrared->app_state.is_decode_enabled;
|
||||
if(infrared->app_state.is_decode_forced) {
|
||||
// Decode -> RAW
|
||||
infrared->app_state.is_decode_enabled = false;
|
||||
infrared->app_state.is_decode_forced = false;
|
||||
} else if(infrared->app_state.is_decode_enabled) {
|
||||
// Auto -> Decode
|
||||
infrared->app_state.is_decode_forced = true;
|
||||
} else {
|
||||
// RAW -> Auto
|
||||
infrared->app_state.is_decode_enabled = true;
|
||||
}
|
||||
infrared_worker_rx_enable_signal_decoding(
|
||||
infrared->worker, infrared->app_state.is_decode_enabled);
|
||||
infrared_worker_rx_force_signal_decoding(
|
||||
infrared->worker, infrared->app_state.is_decode_forced);
|
||||
dialog_ex_set_right_button_text(
|
||||
infrared->dialog_ex, infrared->app_state.is_decode_enabled ? "RAW" : "Decode");
|
||||
infrared->dialog_ex,
|
||||
infrared->app_state.is_decode_forced ? "Decode" :
|
||||
infrared->app_state.is_decode_enabled ? "Auto" :
|
||||
"RAW");
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
|
||||
@@ -79,6 +79,8 @@ struct InfraredWorker {
|
||||
bool overrun;
|
||||
} rx;
|
||||
};
|
||||
|
||||
bool decode_force;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -143,7 +145,7 @@ static void
|
||||
if(instance->rx.received_signal_callback)
|
||||
instance->rx.received_signal_callback(
|
||||
instance->rx.received_signal_context, &instance->signal);
|
||||
} else {
|
||||
} else if(!instance->decode_force) {
|
||||
/* Skip first timing if it starts from Space */
|
||||
if((instance->signal.timings_cnt == 0) && !level) {
|
||||
return;
|
||||
@@ -236,6 +238,7 @@ InfraredWorker* infrared_worker_alloc(void) {
|
||||
instance->infrared_encoder = infrared_alloc_encoder();
|
||||
instance->blink_enable = false;
|
||||
instance->decode_enable = true;
|
||||
instance->decode_force = false;
|
||||
instance->notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
instance->state = InfraredWorkerStateIdle;
|
||||
|
||||
@@ -326,6 +329,12 @@ void infrared_worker_rx_enable_signal_decoding(InfraredWorker* instance, bool en
|
||||
instance->decode_enable = enable;
|
||||
}
|
||||
|
||||
void infrared_worker_rx_force_signal_decoding(InfraredWorker* instance, bool force) {
|
||||
furi_check(instance);
|
||||
|
||||
instance->decode_force = force;
|
||||
}
|
||||
|
||||
void infrared_worker_tx_start(InfraredWorker* instance) {
|
||||
furi_check(instance);
|
||||
furi_check(instance->state == InfraredWorkerStateIdle);
|
||||
|
||||
@@ -84,6 +84,14 @@ void infrared_worker_rx_enable_blink_on_receiving(InfraredWorker* instance, bool
|
||||
*/
|
||||
void infrared_worker_rx_enable_signal_decoding(InfraredWorker* instance, bool enable);
|
||||
|
||||
/** Force decoding of received infrared signals, will ignore RAW signals.
|
||||
*
|
||||
* @param[in] instance - instance of InfraredWorker
|
||||
* @param[in] enable - true if you want to force decoding
|
||||
* false otherwise
|
||||
*/
|
||||
void infrared_worker_rx_force_signal_decoding(InfraredWorker* instance, bool force);
|
||||
|
||||
/** Clarify is received signal either decoded or raw
|
||||
*
|
||||
* @param[in] signal - received signal
|
||||
|
||||
@@ -2141,6 +2141,7 @@ Function,+,infrared_worker_get_decoded_signal,const InfraredMessage*,const Infra
|
||||
Function,+,infrared_worker_get_raw_signal,void,"const InfraredWorkerSignal*, const uint32_t**, size_t*"
|
||||
Function,+,infrared_worker_rx_enable_blink_on_receiving,void,"InfraredWorker*, _Bool"
|
||||
Function,+,infrared_worker_rx_enable_signal_decoding,void,"InfraredWorker*, _Bool"
|
||||
Function,+,infrared_worker_rx_force_signal_decoding,void,"InfraredWorker*, _Bool"
|
||||
Function,+,infrared_worker_rx_set_received_signal_callback,void,"InfraredWorker*, InfraredWorkerReceivedSignalCallback, void*"
|
||||
Function,+,infrared_worker_rx_start,void,InfraredWorker*
|
||||
Function,+,infrared_worker_rx_stop,void,InfraredWorker*
|
||||
|
||||
|
Reference in New Issue
Block a user