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-12-26 15:13:30 +03:00
|
|
|
#include <float_tools.h>
|
2021-11-24 16:59:45 +03:00
|
|
|
|
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
|
2023-05-05 03:51:16 +03:00
|
|
|
FuriString* temp_str = furi_string_alloc();
|
2022-03-03 12:48:56 +03:00
|
|
|
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-10-05 18:15:23 +03:00
|
|
|
furi_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);
|
|
|
|
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_free(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
|
|
|
|
2023-05-05 03:51:16 +03:00
|
|
|
FuriString* frequency_str = furi_string_alloc();
|
|
|
|
FuriString* modulation_str = furi_string_alloc();
|
2021-11-11 15:49:19 +03:00
|
|
|
|
2022-10-11 20:56:00 +03:00
|
|
|
#ifdef SUBGHZ_EXT_PRESET_NAME
|
|
|
|
subghz_get_frequency_modulation(subghz, frequency_str, NULL);
|
|
|
|
furi_string_printf(modulation_str, "%s", furi_string_get_cstr(subghz->txrx->preset->name));
|
|
|
|
#else
|
2021-11-11 15:49:19 +03:00
|
|
|
subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
|
2022-10-11 20:56:00 +03:00
|
|
|
#endif
|
2021-11-11 15:49:19 +03:00
|
|
|
subghz_read_raw_add_data_statusbar(
|
2022-10-05 18:15:23 +03:00
|
|
|
subghz->subghz_read_raw,
|
|
|
|
furi_string_get_cstr(frequency_str),
|
|
|
|
furi_string_get_cstr(modulation_str));
|
2021-11-11 15:49:19 +03:00
|
|
|
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_free(frequency_str);
|
|
|
|
furi_string_free(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;
|
2023-05-05 03:51:16 +03:00
|
|
|
FuriString* file_name = furi_string_alloc();
|
2021-10-27 20:37:11 +03:00
|
|
|
|
2023-05-06 17:47:49 +03:00
|
|
|
switch(subghz_rx_key_state_get(subghz)) {
|
2021-12-22 16:01:20 +03:00
|
|
|
case SubGhzRxKeyStateBack:
|
2022-10-26 18:13:00 +03:00
|
|
|
subghz_read_raw_set_status(
|
2023-05-06 02:00:26 +03:00
|
|
|
subghz->subghz_read_raw,
|
|
|
|
SubGhzReadRAWStatusIDLE,
|
|
|
|
"",
|
|
|
|
subghz_threshold_rssi_get(subghz->threshold_rssi));
|
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-10-05 18:15:23 +03:00
|
|
|
subghz->subghz_read_raw,
|
|
|
|
SubGhzReadRAWStatusLoadKeyTX,
|
2022-10-26 18:13:00 +03:00
|
|
|
furi_string_get_cstr(file_name),
|
2023-05-06 02:00:26 +03:00
|
|
|
subghz_threshold_rssi_get(subghz->threshold_rssi));
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
2021-12-22 16:01:20 +03:00
|
|
|
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-10-26 18:13:00 +03:00
|
|
|
subghz->subghz_read_raw,
|
|
|
|
SubGhzReadRAWStatusSaveKey,
|
|
|
|
furi_string_get_cstr(file_name),
|
2023-05-06 02:00:26 +03:00
|
|
|
subghz_threshold_rssi_get(subghz->threshold_rssi));
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
2021-12-22 16:01:20 +03:00
|
|
|
break;
|
|
|
|
default:
|
2022-10-26 18:13:00 +03:00
|
|
|
subghz_read_raw_set_status(
|
|
|
|
subghz->subghz_read_raw,
|
|
|
|
SubGhzReadRAWStatusStart,
|
|
|
|
"",
|
2023-05-06 02:00:26 +03:00
|
|
|
subghz_threshold_rssi_get(subghz->threshold_rssi));
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
2021-12-22 16:01:20 +03:00
|
|
|
break;
|
2021-10-27 20:37:11 +03:00
|
|
|
}
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_free(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-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:
|
2023-05-06 16:36:15 +03:00
|
|
|
subghz_txrx_stop(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?
|
2023-05-06 17:47:49 +03:00
|
|
|
if((subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateAddKey) ||
|
|
|
|
(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateBack)) {
|
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateExit);
|
2021-10-27 20:37:11 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
|
|
|
} else {
|
2021-11-24 16:59:45 +03:00
|
|
|
//Restore default setting
|
2022-10-02 08:50:41 +03:00
|
|
|
if(subghz->raw_send_only) {
|
|
|
|
subghz_preset_init(
|
|
|
|
subghz,
|
|
|
|
"AM650",
|
|
|
|
subghz_setting_get_default_frequency(subghz->setting),
|
|
|
|
NULL,
|
|
|
|
0);
|
|
|
|
} else {
|
2022-10-27 02:56:21 +03:00
|
|
|
subghz_preset_init(subghz, "AM650", subghz->last_settings->frequency, NULL, 0);
|
2022-10-02 08:50:41 +03:00
|
|
|
}
|
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:
|
2023-05-06 16:36:15 +03:00
|
|
|
subghz_txrx_stop(subghz);
|
2021-12-22 16:01:20 +03:00
|
|
|
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:
|
2023-05-06 17:47:49 +03:00
|
|
|
if(subghz_rx_key_state_get(subghz) == SubGhzRxKeyStateAddKey) {
|
2022-06-03 10:46:25 +03:00
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_set(subghz->file_path_tmp, subghz->file_path);
|
2022-06-03 10:46:25 +03:00
|
|
|
subghz_delete_file(subghz);
|
|
|
|
}
|
2022-05-27 22:18:41 +03:00
|
|
|
}
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, 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:
|
2022-11-10 20:14:44 +03:00
|
|
|
if(subghz_file_available(subghz)) {
|
|
|
|
if(subghz_scene_read_raw_update_filename(subghz)) {
|
|
|
|
scene_manager_set_scene_state(
|
|
|
|
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet);
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWLoad);
|
2022-11-10 20:14:44 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneMoreRAW);
|
|
|
|
consumed = true;
|
|
|
|
} else {
|
|
|
|
furi_crash("SubGhz: RAW file name update error.");
|
|
|
|
}
|
2021-12-22 16:01:20 +03:00
|
|
|
} else {
|
2022-11-10 20:14:44 +03:00
|
|
|
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-12-22 16:01:20 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2022-03-03 12:48:56 +03:00
|
|
|
case SubGhzCustomEventViewReadRAWSendStart:
|
|
|
|
|
2022-11-10 20:14:44 +03:00
|
|
|
if(subghz_file_available(subghz) && subghz_scene_read_raw_update_filename(subghz)) {
|
2021-11-24 16:59:45 +03:00
|
|
|
//start send
|
|
|
|
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
2023-05-06 16:36:15 +03:00
|
|
|
|
|
|
|
subghz_txrx_stop(subghz);
|
|
|
|
if(!subghz_tx_start(subghz, subghz->txrx->fff_data)) {
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateBack);
|
2023-05-06 16:36:15 +03:00
|
|
|
subghz_read_raw_set_status(
|
|
|
|
subghz->subghz_read_raw,
|
|
|
|
SubGhzReadRAWStatusIDLE,
|
|
|
|
"",
|
|
|
|
subghz_threshold_rssi_get(subghz->threshold_rssi));
|
|
|
|
} else {
|
|
|
|
if(scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneSaved) ||
|
|
|
|
!scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneStart)) {
|
|
|
|
DOLPHIN_DEED(DolphinDeedSubGhzSend);
|
2021-11-24 16:59:45 +03:00
|
|
|
}
|
2023-05-06 16:36:15 +03:00
|
|
|
// set callback end tx
|
|
|
|
subghz_protocol_raw_file_encoder_worker_set_callback_end(
|
|
|
|
(SubGhzProtocolEncoderRAW*)subghz_transmitter_get_protocol_instance(
|
|
|
|
subghz->txrx->transmitter),
|
|
|
|
subghz_scene_read_raw_callback_end_tx,
|
|
|
|
subghz);
|
|
|
|
subghz->state_notifications = SubGhzNotificationStateTx;
|
2021-11-24 16:59:45 +03:00
|
|
|
}
|
2022-11-10 20:14:44 +03:00
|
|
|
} else {
|
|
|
|
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-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;
|
2023-05-06 16:36:15 +03:00
|
|
|
subghz_txrx_stop(subghz);
|
2021-11-24 16:59:45 +03:00
|
|
|
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:
|
2023-05-06 16:36:15 +03:00
|
|
|
subghz_txrx_stop(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
|
|
|
|
2023-05-05 03:51:16 +03:00
|
|
|
FuriString* temp_str = furi_string_alloc();
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_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-10-05 18:15:23 +03:00
|
|
|
subghz_protocol_raw_gen_fff_data(
|
|
|
|
subghz->txrx->fff_data, furi_string_get_cstr(temp_str));
|
|
|
|
furi_string_free(temp_str);
|
2022-04-21 19:10:50 +03:00
|
|
|
|
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;
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
|
2021-10-27 20:37:11 +03:00
|
|
|
|
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:
|
2023-05-06 17:47:49 +03:00
|
|
|
if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateIDLE) {
|
2021-10-27 20:37:11 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneNeedSaving);
|
2021-10-25 17:37:14 +03:00
|
|
|
} else {
|
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);
|
2023-05-06 16:36:15 +03:00
|
|
|
subghz_txrx_stop(subghz);
|
|
|
|
subghz_begin(
|
|
|
|
subghz,
|
|
|
|
subghz_setting_get_preset_data_by_name(
|
|
|
|
subghz->setting, furi_string_get_cstr(subghz->txrx->preset->name)));
|
|
|
|
subghz_rx(subghz, subghz->txrx->preset->frequency);
|
|
|
|
|
2022-04-28 20:20:59 +03:00
|
|
|
subghz->state_notifications = SubGhzNotificationStateRx;
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateAddKey);
|
2021-10-27 20:37:11 +03:00
|
|
|
} else {
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_set(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:
|
2022-11-10 20:14:44 +03:00
|
|
|
if(subghz_file_available(subghz) && 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);
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateBack);
|
2021-11-24 16:59:45 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaveName);
|
2022-11-10 20:14:44 +03:00
|
|
|
} else {
|
|
|
|
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-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);
|
2023-05-06 02:00:26 +03:00
|
|
|
|
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));
|
2022-10-26 18:13:00 +03:00
|
|
|
|
2023-05-06 02:00:26 +03:00
|
|
|
SubGhzThresholdRssiData ret_rssi =
|
|
|
|
subghz_threshold_get_rssi_data(subghz->threshold_rssi);
|
|
|
|
subghz_read_raw_add_data_rssi(
|
|
|
|
subghz->subghz_read_raw, ret_rssi.rssi, ret_rssi.is_above);
|
|
|
|
subghz_protocol_raw_save_to_file_pause(
|
|
|
|
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result, !ret_rssi.is_above);
|
2022-10-26 18:13:00 +03:00
|
|
|
|
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
|
2023-05-06 16:36:15 +03:00
|
|
|
subghz_txrx_stop(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
|
2023-02-09 07:48:06 +03:00
|
|
|
subghz_receiver_set_filter(subghz->txrx->receiver, subghz->txrx->filter);
|
2023-02-20 18:55:53 +03:00
|
|
|
}
|