2021-10-25 14:37:14 +00:00
|
|
|
#include "../subghz_i.h"
|
2021-10-27 17:37:11 +00:00
|
|
|
#include "../views/subghz_read_raw.h"
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
#include <dolphin/dolphin.h>
|
2022-03-03 09:48:56 +00:00
|
|
|
#include <lib/subghz/protocols/raw.h>
|
2021-11-24 13:59:45 +00:00
|
|
|
#include <lib/toolbox/path.h>
|
|
|
|
|
2022-01-27 16:38:47 +00:00
|
|
|
#define RAW_FILE_NAME "Raw_signal_"
|
2022-03-03 09:48:56 +00:00
|
|
|
#define TAG "SubGhzSceneReadRAW"
|
2021-10-25 14:37:14 +00:00
|
|
|
|
2021-12-22 13:01:20 +00:00
|
|
|
bool subghz_scene_read_raw_update_filename(SubGhz* subghz) {
|
|
|
|
bool ret = false;
|
|
|
|
//set the path to read the file
|
2022-03-03 09:48:56 +00:00
|
|
|
string_t temp_str;
|
|
|
|
string_init(temp_str);
|
|
|
|
do {
|
|
|
|
if(!flipper_format_rewind(subghz->txrx->fff_data)) {
|
|
|
|
FURI_LOG_E(TAG, "Rewind error");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!flipper_format_read_string(subghz->txrx->fff_data, "File_name", temp_str)) {
|
|
|
|
FURI_LOG_E(TAG, "Missing File_name");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-12-22 13:01:20 +00:00
|
|
|
path_extract_filename_no_ext(string_get_cstr(temp_str), temp_str);
|
2022-04-07 11:47:47 +00:00
|
|
|
strncpy(subghz->file_name, string_get_cstr(temp_str), SUBGHZ_MAX_LEN_NAME);
|
2021-12-22 13:01:20 +00:00
|
|
|
|
|
|
|
ret = true;
|
2022-03-03 09:48:56 +00:00
|
|
|
} while(false);
|
|
|
|
|
|
|
|
string_clear(temp_str);
|
2021-12-22 13:01:20 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-10-27 17:37:11 +00:00
|
|
|
static void subghz_scene_read_raw_update_statusbar(void* context) {
|
2021-10-25 14:37:14 +00:00
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
2021-10-27 17:37:11 +00:00
|
|
|
|
2021-11-11 12:49:19 +00:00
|
|
|
string_t frequency_str;
|
|
|
|
string_t modulation_str;
|
|
|
|
|
|
|
|
string_init(frequency_str);
|
|
|
|
string_init(modulation_str);
|
|
|
|
|
|
|
|
subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
|
|
|
|
subghz_read_raw_add_data_statusbar(
|
|
|
|
subghz->subghz_read_raw, string_get_cstr(frequency_str), string_get_cstr(modulation_str));
|
|
|
|
|
|
|
|
string_clear(frequency_str);
|
|
|
|
string_clear(modulation_str);
|
2021-10-25 14:37:14 +00:00
|
|
|
}
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
void subghz_scene_read_raw_callback(SubGhzCustomEvent event, void* context) {
|
2021-10-25 14:37:14 +00:00
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
|
|
|
view_dispatcher_send_custom_event(subghz->view_dispatcher, event);
|
|
|
|
}
|
|
|
|
|
2021-11-24 13:59:45 +00:00
|
|
|
void subghz_scene_read_raw_callback_end_tx(void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
|
|
|
view_dispatcher_send_custom_event(
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->view_dispatcher, SubGhzCustomEventViewReadRAWSendStop);
|
2021-11-24 13:59:45 +00:00
|
|
|
}
|
|
|
|
|
2021-10-27 17:37:11 +00:00
|
|
|
void subghz_scene_read_raw_on_enter(void* context) {
|
2021-10-25 14:37:14 +00:00
|
|
|
SubGhz* subghz = context;
|
2021-10-27 17:37:11 +00:00
|
|
|
|
2021-12-22 13:01:20 +00:00
|
|
|
switch(subghz->txrx->rx_key_state) {
|
|
|
|
case SubGhzRxKeyStateBack:
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz_read_raw_set_status(subghz->subghz_read_raw, SubGhzReadRAWStatusIDLE, "");
|
2021-12-22 13:01:20 +00:00
|
|
|
break;
|
|
|
|
case SubGhzRxKeyStateRAWLoad:
|
|
|
|
subghz_read_raw_set_status(
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->subghz_read_raw, SubGhzReadRAWStatusLoadKeyTX, subghz->file_name);
|
2021-12-22 13:01:20 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
|
|
|
break;
|
|
|
|
case SubGhzRxKeyStateRAWSave:
|
2021-12-08 15:00:54 +00:00
|
|
|
subghz_read_raw_set_status(
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->subghz_read_raw, SubGhzReadRAWStatusSaveKey, subghz->file_name);
|
2021-12-22 13:01:20 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
|
|
|
break;
|
|
|
|
default:
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz_read_raw_set_status(subghz->subghz_read_raw, SubGhzReadRAWStatusStart, "");
|
2021-10-27 17:37:11 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
2021-12-22 13:01:20 +00:00
|
|
|
break;
|
2021-10-27 17:37:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
subghz_scene_read_raw_update_statusbar(subghz);
|
2021-10-25 14:37:14 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
//set callback view raw
|
|
|
|
subghz_read_raw_set_callback(subghz->subghz_read_raw, subghz_scene_read_raw_callback, subghz);
|
2021-10-25 14:37:14 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->txrx->decoder_result =
|
|
|
|
subghz_receiver_search_decoder_base_by_name(subghz->txrx->receiver, "RAW");
|
|
|
|
furi_assert(subghz->txrx->decoder_result);
|
2021-11-24 13:59:45 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
//set filter RAW feed
|
|
|
|
subghz_receiver_set_filter(subghz->txrx->receiver, SubGhzProtocolFlag_RAW);
|
|
|
|
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdReadRAW);
|
2021-10-25 14:37:14 +00:00
|
|
|
}
|
|
|
|
|
2021-10-27 17:37:11 +00:00
|
|
|
bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
2021-10-25 14:37:14 +00:00
|
|
|
SubGhz* subghz = context;
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
|
|
switch(event.event) {
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWBack:
|
2021-11-24 13:59:45 +00:00
|
|
|
//Stop TX
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateTx) {
|
|
|
|
subghz_tx_stop(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
}
|
|
|
|
//Stop RX
|
2021-10-25 14:37:14 +00:00
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
};
|
2021-11-24 13:59:45 +00:00
|
|
|
//Stop save file
|
2021-10-27 17:37:11 +00:00
|
|
|
subghz_protocol_raw_save_to_file_stop(
|
2022-03-03 09:48:56 +00:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);
|
2021-11-11 12:49:19 +00:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2021-11-24 13:59:45 +00:00
|
|
|
//needed save?
|
|
|
|
if((subghz->txrx->rx_key_state == SubGhzRxKeyStateAddKey) ||
|
|
|
|
(subghz->txrx->rx_key_state == SubGhzRxKeyStateBack)) {
|
2021-10-27 17:37:11 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateExit;
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
|
|
|
} else {
|
2021-11-24 13:59:45 +00:00
|
|
|
//Restore default setting
|
|
|
|
subghz->txrx->frequency = subghz_frequencies[subghz_frequencies_433_92];
|
|
|
|
subghz->txrx->preset = FuriHalSubGhzPresetOok650Async;
|
2021-12-22 13:01:20 +00:00
|
|
|
if(!scene_manager_search_and_switch_to_previous_scene(
|
|
|
|
subghz->scene_manager, SubGhzSceneSaved)) {
|
|
|
|
if(!scene_manager_search_and_switch_to_previous_scene(
|
|
|
|
subghz->scene_manager, SubGhzSceneStart)) {
|
|
|
|
scene_manager_stop(subghz->scene_manager);
|
|
|
|
view_dispatcher_stop(subghz->view_dispatcher);
|
|
|
|
}
|
|
|
|
}
|
2021-10-27 17:37:11 +00:00
|
|
|
}
|
2021-12-22 13:01:20 +00:00
|
|
|
return true;
|
|
|
|
break;
|
2021-10-27 17:37:11 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWTXRXStop:
|
2021-12-22 13:01:20 +00:00
|
|
|
//Stop TX
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateTx) {
|
|
|
|
subghz_tx_stop(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
}
|
|
|
|
//Stop RX
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
};
|
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2021-10-25 14:37:14 +00:00
|
|
|
return true;
|
|
|
|
break;
|
2021-12-22 13:01:20 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWConfig:
|
2021-10-27 17:37:11 +00:00
|
|
|
scene_manager_set_scene_state(
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet);
|
2021-10-25 14:37:14 +00:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverConfig);
|
|
|
|
return true;
|
|
|
|
break;
|
2021-12-22 13:01:20 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWErase:
|
2021-11-24 13:59:45 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
|
|
|
return true;
|
|
|
|
break;
|
2021-12-22 13:01:20 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWVibro:
|
2021-11-26 14:01:03 +00:00
|
|
|
notification_message(subghz->notifications, &sequence_single_vibro);
|
|
|
|
return true;
|
|
|
|
break;
|
2021-12-22 13:01:20 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWMore:
|
2021-12-22 13:01:20 +00:00
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
|
|
|
scene_manager_set_scene_state(
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet);
|
2021-12-22 13:01:20 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad;
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneMoreRAW);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
furi_crash(NULL);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWSendStart:
|
|
|
|
|
2021-12-22 13:01:20 +00:00
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
2021-11-24 13:59:45 +00:00
|
|
|
//start send
|
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
}
|
|
|
|
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
|
|
|
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
2022-03-03 09:48:56 +00:00
|
|
|
//ToDo FIX
|
|
|
|
|
|
|
|
if(!subghz_tx_start(subghz, subghz->txrx->fff_data)) {
|
2021-11-24 13:59:45 +00:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowOnlyRx);
|
|
|
|
} else {
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
DOLPHIN_DEED(DolphinDeedSubGhzSend);
|
2022-03-03 09:48:56 +00:00
|
|
|
// set callback end tx
|
|
|
|
subghz_protocol_raw_file_encoder_worker_set_callback_end(
|
|
|
|
(SubGhzProtocolEncoderRAW*)subghz->txrx->transmitter->protocol_instance,
|
|
|
|
subghz_scene_read_raw_callback_end_tx,
|
|
|
|
subghz);
|
2021-11-24 13:59:45 +00:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateTX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
break;
|
2021-12-22 13:01:20 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWSendStop:
|
2021-11-24 13:59:45 +00:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateTx) {
|
|
|
|
subghz_tx_stop(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
}
|
|
|
|
subghz_read_raw_stop_send(subghz->subghz_read_raw);
|
|
|
|
return true;
|
|
|
|
break;
|
2021-12-22 13:01:20 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWIDLE:
|
2021-10-25 14:37:14 +00:00
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
};
|
2021-10-27 17:37:11 +00:00
|
|
|
subghz_protocol_raw_save_to_file_stop(
|
2022-03-03 09:48:56 +00:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);
|
|
|
|
subghz_protocol_raw_gen_fff_data(subghz->txrx->fff_data, RAW_FILE_NAME);
|
2021-11-11 12:49:19 +00:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2021-10-27 17:37:11 +00:00
|
|
|
|
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateAddKey;
|
|
|
|
|
2021-10-25 14:37:14 +00:00
|
|
|
return true;
|
|
|
|
break;
|
2021-10-27 17:37:11 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWREC:
|
2021-10-27 17:37:11 +00:00
|
|
|
if(subghz->txrx->rx_key_state != SubGhzRxKeyStateIDLE) {
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
2021-10-25 14:37:14 +00:00
|
|
|
} else {
|
2022-03-03 09:48:56 +00:00
|
|
|
//subghz_get_preset_name(subghz, subghz->error_str);
|
2021-10-27 17:37:11 +00:00
|
|
|
if(subghz_protocol_raw_save_to_file_init(
|
2022-03-03 09:48:56 +00:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result,
|
2021-11-24 13:59:45 +00:00
|
|
|
RAW_FILE_NAME,
|
2021-10-27 17:37:11 +00:00
|
|
|
subghz->txrx->frequency,
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->txrx->preset)) {
|
[FL-2183] [FL-2209] Dolphin Deeds, Level up, assets generation, refactoring (#965)
* Desktop: cleanup headers
* Get loader pubsub via record
* [FL-2183] Dolphin refactoring 2022.01
* Restruct animations assets structure
* Rename assets
* Cleanup headers
* Update Recording animation
* Add BadBattery animation
* Provide loader's pubsub via record
* Fix load/unload animations
* Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin.
* Sync internal meta.txt and manifest.txt
* Reorder, rename dolphin assets
* Split essential generated assets
* Add ReadMe for dolphin assets
* Separate essential blocking animations
* Scripts: full dolphin validation before packaging
* Assets, Scripts: dolphin external resources packer
* Github: update codeowners
* Scripts: proper slots handling in dolphin animation meta
* Scripts: correct frames enumeration and fix compiled assets.
* [FL-2209] Add Dolphin Deeds points and many more
* Remove excess frame_rate
* Change dolphin assets directory
* Scripts: add internal resource support to dolphin compiler
* Scripts: add internal assets generation, renaming
* Scripts: correct assert, renaming
* Code cleanup, documentation, fixes
* Update Levelup animations
* Rename essential -> blocking
* Fix Unlocked hint
* Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates.
* Documentation: add key combos description and use information
* Scripts: cleanup templit, more debug info and add dev comment
Co-authored-by: あく <alleteam@gmail.com>
2022-01-29 09:20:41 +00:00
|
|
|
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
|
2021-10-27 17:37:11 +00:00
|
|
|
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
|
|
|
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
|
|
|
subghz_begin(subghz, subghz->txrx->preset);
|
|
|
|
subghz_rx(subghz, subghz->txrx->frequency);
|
|
|
|
}
|
2021-11-11 12:49:19 +00:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateRX;
|
2021-12-22 13:01:20 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateAddKey;
|
2021-10-27 17:37:11 +00:00
|
|
|
} else {
|
2021-12-22 13:01:20 +00:00
|
|
|
string_set(subghz->error_str, "Function requires\nan SD card.");
|
2021-10-27 17:37:11 +00:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
|
|
|
|
}
|
2021-10-25 14:37:14 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
case SubGhzCustomEventViewReadRAWSave:
|
2021-12-22 13:01:20 +00:00
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
2021-11-24 13:59:45 +00:00
|
|
|
scene_manager_set_scene_state(
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSetRAW);
|
2021-11-24 13:59:45 +00:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateBack;
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaveName);
|
2021-10-25 14:37:14 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if(event.type == SceneManagerEventTypeTick) {
|
|
|
|
switch(subghz->state_notifications) {
|
2021-11-11 12:49:19 +00:00
|
|
|
case SubGhzNotificationStateRX:
|
2021-10-25 14:37:14 +00:00
|
|
|
notification_message(subghz->notifications, &sequence_blink_blue_10);
|
2021-10-27 17:37:11 +00:00
|
|
|
subghz_read_raw_update_sample_write(
|
|
|
|
subghz->subghz_read_raw,
|
|
|
|
subghz_protocol_raw_get_sample_write(
|
2022-03-03 09:48:56 +00:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result));
|
2021-10-27 17:37:11 +00:00
|
|
|
subghz_read_raw_add_data_rssi(subghz->subghz_read_raw, furi_hal_subghz_get_rssi());
|
2021-10-25 14:37:14 +00:00
|
|
|
break;
|
2021-11-24 13:59:45 +00:00
|
|
|
case SubGhzNotificationStateTX:
|
|
|
|
notification_message(subghz->notifications, &sequence_blink_green_10);
|
|
|
|
subghz_read_raw_update_sin(subghz->subghz_read_raw);
|
|
|
|
break;
|
2021-10-25 14:37:14 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-27 17:37:11 +00:00
|
|
|
void subghz_scene_read_raw_on_exit(void* context) {
|
2021-10-25 14:37:14 +00:00
|
|
|
SubGhz* subghz = context;
|
|
|
|
|
|
|
|
//Stop CC1101
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
};
|
2021-11-11 12:49:19 +00:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2021-10-25 14:37:14 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
//filter restoration
|
|
|
|
subghz_receiver_set_filter(subghz->txrx->receiver, SubGhzProtocolFlag_Decodable);
|
2021-10-25 14:37:14 +00:00
|
|
|
}
|