2021-10-25 17:37:14 +03:00
|
|
|
#include "../subghz_i.h"
|
2021-10-27 20:37:11 +03: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 12:20:41 +03:00
|
|
|
#include <dolphin/dolphin.h>
|
2022-03-03 12:48:56 +03:00
|
|
|
#include <lib/subghz/protocols/raw.h>
|
2021-11-24 16:59:45 +03:00
|
|
|
#include <lib/toolbox/path.h>
|
|
|
|
|
2022-06-28 01:54:37 +03:00
|
|
|
#define RAW_FILE_NAME "RAW_"
|
2022-03-03 12:48:56 +03:00
|
|
|
#define TAG "SubGhzSceneReadRAW"
|
2021-10-25 17:37:14 +03:00
|
|
|
|
2021-12-22 16:01:20 +03:00
|
|
|
bool subghz_scene_read_raw_update_filename(SubGhz* subghz) {
|
|
|
|
bool ret = false;
|
|
|
|
//set the path to read the file
|
2022-03-03 12:48:56 +03: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;
|
|
|
|
}
|
|
|
|
|
2022-06-01 16:07:53 +03:00
|
|
|
string_set(subghz->file_path, temp_str);
|
2021-12-22 16:01:20 +03:00
|
|
|
|
|
|
|
ret = true;
|
2022-03-03 12:48:56 +03:00
|
|
|
} while(false);
|
|
|
|
|
|
|
|
string_clear(temp_str);
|
2021-12-22 16:01:20 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-10-27 20:37:11 +03:00
|
|
|
static void subghz_scene_read_raw_update_statusbar(void* context) {
|
2021-10-25 17:37:14 +03:00
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
2021-10-27 20:37:11 +03:00
|
|
|
|
2021-11-11 15:49:19 +03: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 17:37:14 +03:00
|
|
|
}
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
void subghz_scene_read_raw_callback(SubGhzCustomEvent event, void* context) {
|
2021-10-25 17:37:14 +03:00
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
|
|
|
view_dispatcher_send_custom_event(subghz->view_dispatcher, event);
|
|
|
|
}
|
|
|
|
|
2021-11-24 16:59:45 +03: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 12:48:56 +03:00
|
|
|
subghz->view_dispatcher, SubGhzCustomEventViewReadRAWSendStop);
|
2021-11-24 16:59:45 +03:00
|
|
|
}
|
|
|
|
|
2021-10-27 20:37:11 +03:00
|
|
|
void subghz_scene_read_raw_on_enter(void* context) {
|
2021-10-25 17:37:14 +03:00
|
|
|
SubGhz* subghz = context;
|
2022-04-21 19:10:50 +03:00
|
|
|
string_t file_name;
|
|
|
|
string_init(file_name);
|
2021-10-27 20:37:11 +03:00
|
|
|
|
2021-12-22 16:01:20 +03:00
|
|
|
switch(subghz->txrx->rx_key_state) {
|
|
|
|
case SubGhzRxKeyStateBack:
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz_read_raw_set_status(subghz->subghz_read_raw, SubGhzReadRAWStatusIDLE, "");
|
2021-12-22 16:01:20 +03:00
|
|
|
break;
|
|
|
|
case SubGhzRxKeyStateRAWLoad:
|
2022-06-01 16:07:53 +03:00
|
|
|
path_extract_filename(subghz->file_path, file_name, true);
|
2021-12-22 16:01:20 +03:00
|
|
|
subghz_read_raw_set_status(
|
2022-04-21 19:10:50 +03:00
|
|
|
subghz->subghz_read_raw, SubGhzReadRAWStatusLoadKeyTX, string_get_cstr(file_name));
|
2021-12-22 16:01:20 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
|
|
|
break;
|
|
|
|
case SubGhzRxKeyStateRAWSave:
|
2022-06-01 16:07:53 +03:00
|
|
|
path_extract_filename(subghz->file_path, file_name, true);
|
2021-12-08 18:00:54 +03:00
|
|
|
subghz_read_raw_set_status(
|
2022-04-21 19:10:50 +03:00
|
|
|
subghz->subghz_read_raw, SubGhzReadRAWStatusSaveKey, string_get_cstr(file_name));
|
2021-12-22 16:01:20 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
|
|
|
break;
|
|
|
|
default:
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz_read_raw_set_status(subghz->subghz_read_raw, SubGhzReadRAWStatusStart, "");
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
2021-12-22 16:01:20 +03:00
|
|
|
break;
|
2021-10-27 20:37:11 +03:00
|
|
|
}
|
2022-04-21 19:10:50 +03:00
|
|
|
string_clear(file_name);
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz_scene_read_raw_update_statusbar(subghz);
|
2021-10-25 17:37:14 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
//set callback view raw
|
|
|
|
subghz_read_raw_set_callback(subghz->subghz_read_raw, subghz_scene_read_raw_callback, subghz);
|
2021-10-25 17:37:14 +03:00
|
|
|
|
2022-04-21 19:10:50 +03:00
|
|
|
subghz->txrx->decoder_result = subghz_receiver_search_decoder_base_by_name(
|
|
|
|
subghz->txrx->receiver, SUBGHZ_PROTOCOL_RAW_NAME);
|
2022-03-03 12:48:56 +03:00
|
|
|
furi_assert(subghz->txrx->decoder_result);
|
2021-11-24 16:59:45 +03:00
|
|
|
|
2022-09-14 16:01:30 +03:00
|
|
|
// make sure we're not in auto-detect mode, which is only meant for the Read app
|
|
|
|
subghz_protocol_decoder_raw_set_auto_mode(subghz->txrx->decoder_result, false);
|
|
|
|
|
2022-03-03 12:48:56 +03: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 17:37:14 +03:00
|
|
|
}
|
|
|
|
|
2021-10-27 20:37:11 +03:00
|
|
|
bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
|
2021-10-25 17:37:14 +03:00
|
|
|
SubGhz* subghz = context;
|
2022-07-03 19:03:36 +03:00
|
|
|
bool consumed = false;
|
2021-10-25 17:37:14 +03:00
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
|
|
switch(event.event) {
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWBack:
|
2021-11-24 16:59:45 +03:00
|
|
|
//Stop TX
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateTx) {
|
|
|
|
subghz_tx_stop(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
}
|
|
|
|
//Stop RX
|
2021-10-25 17:37:14 +03:00
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
};
|
2021-11-24 16:59:45 +03:00
|
|
|
//Stop save file
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz_protocol_raw_save_to_file_stop(
|
2022-03-03 12:48:56 +03:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);
|
2021-11-11 15:49:19 +03:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2021-11-24 16:59:45 +03:00
|
|
|
//needed save?
|
|
|
|
if((subghz->txrx->rx_key_state == SubGhzRxKeyStateAddKey) ||
|
|
|
|
(subghz->txrx->rx_key_state == SubGhzRxKeyStateBack)) {
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateExit;
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
|
|
|
} else {
|
2021-11-24 16:59:45 +03:00
|
|
|
//Restore default setting
|
2022-07-26 17:16:59 +03:00
|
|
|
subghz_preset_init(
|
|
|
|
subghz,
|
2022-09-28 01:01:09 +03:00
|
|
|
subghz_setting_get_preset_name(subghz->setting, subghz->last_settings->preset),
|
|
|
|
subghz->last_settings->frequency,
|
2022-07-26 17:16:59 +03:00
|
|
|
NULL,
|
|
|
|
0);
|
2021-12-22 16:01:20 +03: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 20:37:11 +03:00
|
|
|
}
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-12-22 16:01:20 +03:00
|
|
|
break;
|
2021-10-27 20:37:11 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWTXRXStop:
|
2021-12-22 16:01:20 +03: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;
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-10-25 17:37:14 +03:00
|
|
|
break;
|
2021-12-22 16:01:20 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWConfig:
|
2021-10-27 20:37:11 +03:00
|
|
|
scene_manager_set_scene_state(
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet);
|
2021-10-25 17:37:14 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiverConfig);
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-10-25 17:37:14 +03:00
|
|
|
break;
|
2021-12-22 16:01:20 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWErase:
|
2022-06-03 10:46:25 +03:00
|
|
|
if(subghz->txrx->rx_key_state == SubGhzRxKeyStateAddKey) {
|
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
|
|
|
string_set(subghz->file_path_tmp, subghz->file_path);
|
|
|
|
subghz_delete_file(subghz);
|
|
|
|
}
|
2022-05-27 22:18:41 +03:00
|
|
|
}
|
2022-06-03 10:46:25 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateIDLE;
|
2022-04-28 20:20:59 +03:00
|
|
|
notification_message(subghz->notifications, &sequence_reset_rgb);
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-11-26 17:01:03 +03:00
|
|
|
break;
|
2021-12-22 16:01:20 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWMore:
|
2021-12-22 16:01:20 +03:00
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
|
|
|
scene_manager_set_scene_state(
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet);
|
2021-12-22 16:01:20 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad;
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneMoreRAW);
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-12-22 16:01:20 +03:00
|
|
|
} else {
|
2022-06-01 01:35:31 +03:00
|
|
|
furi_crash("SubGhz: RAW file name update error.");
|
2021-12-22 16:01:20 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWSendStart:
|
|
|
|
|
2021-12-22 16:01:20 +03:00
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
2021-11-24 16:59:45 +03: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 12:48:56 +03:00
|
|
|
if(!subghz_tx_start(subghz, subghz->txrx->fff_data)) {
|
2022-07-26 15:58:07 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateBack;
|
2021-11-24 16:59:45 +03: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 12:20:41 +03:00
|
|
|
DOLPHIN_DEED(DolphinDeedSubGhzSend);
|
2022-03-03 12:48:56 +03:00
|
|
|
// set callback end tx
|
|
|
|
subghz_protocol_raw_file_encoder_worker_set_callback_end(
|
2022-05-08 20:50:20 +03:00
|
|
|
(SubGhzProtocolEncoderRAW*)subghz_transmitter_get_protocol_instance(
|
|
|
|
subghz->txrx->transmitter),
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz_scene_read_raw_callback_end_tx,
|
|
|
|
subghz);
|
2022-04-28 20:20:59 +03:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateTx;
|
2021-11-24 16:59:45 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-11-24 16:59:45 +03:00
|
|
|
break;
|
2021-12-22 16:01:20 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWSendStop:
|
2021-11-24 16:59:45 +03: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);
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-11-24 16:59:45 +03:00
|
|
|
break;
|
2021-12-22 16:01:20 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWIDLE:
|
2021-10-25 17:37:14 +03:00
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
};
|
2022-04-28 20:20:59 +03:00
|
|
|
|
|
|
|
size_t spl_count = subghz_protocol_raw_get_sample_write(
|
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);
|
|
|
|
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz_protocol_raw_save_to_file_stop(
|
2022-03-03 12:48:56 +03:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);
|
2021-10-27 20:37:11 +03:00
|
|
|
|
2022-04-21 19:10:50 +03:00
|
|
|
string_t temp_str;
|
|
|
|
string_init(temp_str);
|
|
|
|
string_printf(
|
2022-06-28 01:54:37 +03:00
|
|
|
temp_str, "%s/%s%s", SUBGHZ_RAW_FOLDER, RAW_FILE_NAME, SUBGHZ_APP_EXTENSION);
|
2022-04-21 19:10:50 +03:00
|
|
|
subghz_protocol_raw_gen_fff_data(subghz->txrx->fff_data, string_get_cstr(temp_str));
|
|
|
|
string_clear(temp_str);
|
|
|
|
|
2022-04-28 20:20:59 +03:00
|
|
|
if(spl_count > 0) {
|
|
|
|
notification_message(subghz->notifications, &sequence_set_green_255);
|
|
|
|
} else {
|
|
|
|
notification_message(subghz->notifications, &sequence_reset_rgb);
|
|
|
|
}
|
|
|
|
|
2022-04-21 19:10:50 +03:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateAddKey;
|
|
|
|
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-10-25 17:37:14 +03:00
|
|
|
break;
|
2021-10-27 20:37:11 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWREC:
|
2021-10-27 20:37:11 +03:00
|
|
|
if(subghz->txrx->rx_key_state != SubGhzRxKeyStateIDLE) {
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
2021-10-25 17:37:14 +03:00
|
|
|
} else {
|
2022-03-03 12:48:56 +03:00
|
|
|
//subghz_get_preset_name(subghz, subghz->error_str);
|
2021-10-27 20:37:11 +03:00
|
|
|
if(subghz_protocol_raw_save_to_file_init(
|
2022-03-03 12:48:56 +03:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result,
|
2022-06-28 01:54:37 +03:00
|
|
|
RAW_FILE_NAME,
|
2022-03-03 12:48:56 +03: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 12:20:41 +03:00
|
|
|
DOLPHIN_DEED(DolphinDeedSubGhzRawRec);
|
2021-10-27 20:37:11 +03:00
|
|
|
if((subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) ||
|
|
|
|
(subghz->txrx->txrx_state == SubGhzTxRxStateSleep)) {
|
2022-07-26 17:16:59 +03:00
|
|
|
subghz_begin(
|
|
|
|
subghz,
|
|
|
|
subghz_setting_get_preset_data_by_name(
|
|
|
|
subghz->setting, string_get_cstr(subghz->txrx->preset->name)));
|
|
|
|
subghz_rx(subghz, subghz->txrx->preset->frequency);
|
2021-10-27 20:37:11 +03:00
|
|
|
}
|
2022-04-28 20:20:59 +03:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateRx;
|
2021-12-22 16:01:20 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateAddKey;
|
2021-10-27 20:37:11 +03:00
|
|
|
} else {
|
2022-06-01 16:07:53 +03:00
|
|
|
string_set_str(subghz->error_str, "Function requires\nan SD card.");
|
2021-10-27 20:37:11 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
|
|
|
|
}
|
2021-10-25 17:37:14 +03:00
|
|
|
}
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-10-25 17:37:14 +03:00
|
|
|
break;
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWSave:
|
2021-12-22 16:01:20 +03:00
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
2021-11-24 16:59:45 +03:00
|
|
|
scene_manager_set_scene_state(
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSetRAW);
|
2021-11-24 16:59:45 +03:00
|
|
|
subghz->txrx->rx_key_state = SubGhzRxKeyStateBack;
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaveName);
|
2021-10-25 17:37:14 +03:00
|
|
|
}
|
2022-07-03 19:03:36 +03:00
|
|
|
consumed = true;
|
2021-10-25 17:37:14 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if(event.type == SceneManagerEventTypeTick) {
|
|
|
|
switch(subghz->state_notifications) {
|
2022-04-28 20:20:59 +03:00
|
|
|
case SubGhzNotificationStateRx:
|
|
|
|
notification_message(subghz->notifications, &sequence_blink_cyan_10);
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz_read_raw_update_sample_write(
|
|
|
|
subghz->subghz_read_raw,
|
|
|
|
subghz_protocol_raw_get_sample_write(
|
2022-03-03 12:48:56 +03:00
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result));
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz_read_raw_add_data_rssi(subghz->subghz_read_raw, furi_hal_subghz_get_rssi());
|
2021-10-25 17:37:14 +03:00
|
|
|
break;
|
2022-04-28 20:20:59 +03:00
|
|
|
case SubGhzNotificationStateTx:
|
|
|
|
notification_message(subghz->notifications, &sequence_blink_magenta_10);
|
2021-11-24 16:59:45 +03:00
|
|
|
subghz_read_raw_update_sin(subghz->subghz_read_raw);
|
|
|
|
break;
|
2021-10-25 17:37:14 +03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2022-07-03 19:03:36 +03:00
|
|
|
return consumed;
|
2021-10-25 17:37:14 +03:00
|
|
|
}
|
|
|
|
|
2021-10-27 20:37:11 +03:00
|
|
|
void subghz_scene_read_raw_on_exit(void* context) {
|
2021-10-25 17:37:14 +03:00
|
|
|
SubGhz* subghz = context;
|
|
|
|
|
|
|
|
//Stop CC1101
|
|
|
|
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
|
|
|
|
subghz_rx_end(subghz);
|
|
|
|
subghz_sleep(subghz);
|
|
|
|
};
|
2021-11-11 15:49:19 +03:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2022-04-28 20:20:59 +03:00
|
|
|
notification_message(subghz->notifications, &sequence_reset_rgb);
|
2021-10-25 17:37:14 +03:00
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
//filter restoration
|
2022-10-01 07:39:51 +03:00
|
|
|
subghz_last_settings_set_detect_raw_values(subghz);
|
2022-06-28 01:54:37 +03:00
|
|
|
}
|