diff --git a/applications/main/subghz/scenes/subghz_scene_read_raw.c b/applications/main/subghz/scenes/subghz_scene_read_raw.c index 0c692e000..2638d2089 100644 --- a/applications/main/subghz/scenes/subghz_scene_read_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_read_raw.c @@ -122,6 +122,19 @@ void subghz_scene_read_raw_on_enter(void* context) { //set filter RAW feed subghz_receiver_set_filter(subghz->txrx->receiver, SubGhzProtocolFlag_RAW); view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdReadRAW); + + // Start sending immediately with favorites + if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW)) { + with_view_model( + subghz->subghz_read_raw->view, + SubGhzReadRAWModel * model, + { + scene_manager_handle_custom_event( + subghz->scene_manager, SubGhzCustomEventViewReadRAWSendStart); + model->status = SubGhzReadRAWStatusTXRepeat; + }, + true); + } } bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { @@ -278,6 +291,13 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { subghz_sleep(subghz); } subghz_read_raw_stop_send(subghz->subghz_read_raw); + + // Exit / stop with favorites + if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW)) { + while(scene_manager_handle_back_event(subghz->scene_manager)) + ; + view_dispatcher_stop(subghz->view_dispatcher); + } consumed = true; break; diff --git a/applications/main/subghz/subghz.c b/applications/main/subghz/subghz.c index a092fa6f6..906b8e074 100644 --- a/applications/main/subghz/subghz.c +++ b/applications/main/subghz/subghz.c @@ -5,6 +5,7 @@ #include "subghz_i.h" #include #include +#include #define TAG "SubGhzApp" @@ -456,7 +457,7 @@ int32_t subghz_app(char* p) { furi_hal_subghz_init_radio_type(SubGhzRadioInternal); } // Check argument and run corresponding scene - process_favorite_launch(&p); + bool is_favorite = process_favorite_launch(&p) && XTREME_SETTINGS()->favorite_timeout; if(p && strlen(p)) { uint32_t rpc_ctx = 0; @@ -476,6 +477,8 @@ int32_t subghz_app(char* p) { if((!strcmp(subghz->txrx->decoder_result->protocol->name, "RAW"))) { //Load Raw TX subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad; + scene_manager_set_scene_state( + subghz->scene_manager, SubGhzSceneReadRAW, is_favorite); scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW); } else { //Load transmitter TX diff --git a/applications/main/subghz/views/subghz_read_raw.c b/applications/main/subghz/views/subghz_read_raw.c index fcc077efa..7676c527d 100644 --- a/applications/main/subghz/views/subghz_read_raw.c +++ b/applications/main/subghz/views/subghz_read_raw.c @@ -11,28 +11,6 @@ #define SUBGHZ_READ_RAW_RSSI_HISTORY_SIZE 100 #define TAG "SubGhzReadRAW" -struct SubGhzReadRAW { - View* view; - SubGhzReadRAWCallback callback; - void* context; -}; - -typedef struct { - FuriString* frequency_str; - FuriString* preset_str; - FuriString* sample_write; - FuriString* file_name; - uint8_t* rssi_history; - uint8_t rssi_current; - bool rssi_history_end; - uint8_t ind_write; - uint8_t ind_sin; - SubGhzReadRAWStatus status; - bool raw_send_only; - float raw_threshold_rssi; - bool not_showing_samples; -} SubGhzReadRAWModel; - void subghz_read_raw_set_callback( SubGhzReadRAW* subghz_read_raw, SubGhzReadRAWCallback callback, diff --git a/applications/main/subghz/views/subghz_read_raw.h b/applications/main/subghz/views/subghz_read_raw.h index 9d63870d5..f9a56ca04 100644 --- a/applications/main/subghz/views/subghz_read_raw.h +++ b/applications/main/subghz/views/subghz_read_raw.h @@ -5,10 +5,14 @@ #define SUBGHZ_RAW_THRESHOLD_MIN -90.0f -typedef struct SubGhzReadRAW SubGhzReadRAW; - typedef void (*SubGhzReadRAWCallback)(SubGhzCustomEvent event, void* context); +typedef struct { + View* view; + SubGhzReadRAWCallback callback; + void* context; +} SubGhzReadRAW; + typedef enum { SubGhzReadRAWStatusStart, SubGhzReadRAWStatusIDLE, @@ -22,6 +26,22 @@ typedef enum { SubGhzReadRAWStatusSaveKey, } SubGhzReadRAWStatus; +typedef struct { + FuriString* frequency_str; + FuriString* preset_str; + FuriString* sample_write; + FuriString* file_name; + uint8_t* rssi_history; + uint8_t rssi_current; + bool rssi_history_end; + uint8_t ind_write; + uint8_t ind_sin; + SubGhzReadRAWStatus status; + bool raw_send_only; + float raw_threshold_rssi; + bool not_showing_samples; +} SubGhzReadRAWModel; + void subghz_read_raw_set_callback( SubGhzReadRAW* subghz_read_raw, SubGhzReadRAWCallback callback,