2021-12-22 23:04:08 +03:00
|
|
|
/* Abandon hope, all ye who enter here. */
|
2021-12-22 16:01:20 +03:00
|
|
|
|
2023-08-08 07:58:20 +03:00
|
|
|
#include <furi/core/log.h>
|
2022-09-16 17:38:08 +03:00
|
|
|
#include <subghz/types.h>
|
2021-11-11 15:49:19 +03:00
|
|
|
#include <lib/toolbox/path.h>
|
2023-08-08 16:31:46 +03:00
|
|
|
#include <float_tools.h>
|
2022-09-16 17:38:08 +03:00
|
|
|
#include "subghz_i.h"
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2022-09-28 01:01:09 +03:00
|
|
|
#define TAG "SubGhzApp"
|
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
bool subghz_custom_event_callback(void* context, uint32_t event) {
|
2021-03-31 20:52:26 +03:00
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
return scene_manager_handle_custom_event(subghz->scene_manager, event);
|
|
|
|
}
|
2021-03-31 20:52:26 +03:00
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
bool subghz_back_event_callback(void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
|
|
|
return scene_manager_handle_back_event(subghz->scene_manager);
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
void subghz_tick_event_callback(void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
|
|
|
scene_manager_handle_tick_event(subghz->scene_manager);
|
2021-03-31 20:52:26 +03:00
|
|
|
}
|
|
|
|
|
2022-08-02 15:54:12 +03:00
|
|
|
static void subghz_rpc_command_callback(RpcAppSystemEvent event, void* context) {
|
2022-07-04 16:09:46 +03:00
|
|
|
furi_assert(context);
|
|
|
|
SubGhz* subghz = context;
|
|
|
|
|
2022-08-02 15:54:12 +03:00
|
|
|
furi_assert(subghz->rpc_ctx);
|
2022-07-04 16:09:46 +03:00
|
|
|
|
|
|
|
if(event == RpcAppEventSessionClose) {
|
2022-08-02 15:54:12 +03:00
|
|
|
view_dispatcher_send_custom_event(
|
|
|
|
subghz->view_dispatcher, SubGhzCustomEventSceneRpcSessionClose);
|
2022-08-12 05:18:27 +03:00
|
|
|
rpc_system_app_set_callback(subghz->rpc_ctx, NULL, NULL);
|
|
|
|
subghz->rpc_ctx = NULL;
|
2022-07-04 16:09:46 +03:00
|
|
|
} else if(event == RpcAppEventAppExit) {
|
|
|
|
view_dispatcher_send_custom_event(subghz->view_dispatcher, SubGhzCustomEventSceneExit);
|
|
|
|
} else if(event == RpcAppEventLoadFile) {
|
2022-08-02 15:54:12 +03:00
|
|
|
view_dispatcher_send_custom_event(subghz->view_dispatcher, SubGhzCustomEventSceneRpcLoad);
|
2022-07-04 16:09:46 +03:00
|
|
|
} else if(event == RpcAppEventButtonPress) {
|
2022-08-02 15:54:12 +03:00
|
|
|
view_dispatcher_send_custom_event(
|
|
|
|
subghz->view_dispatcher, SubGhzCustomEventSceneRpcButtonPress);
|
2022-07-04 16:09:46 +03:00
|
|
|
} else if(event == RpcAppEventButtonRelease) {
|
2022-08-02 15:54:12 +03:00
|
|
|
view_dispatcher_send_custom_event(
|
|
|
|
subghz->view_dispatcher, SubGhzCustomEventSceneRpcButtonRelease);
|
|
|
|
} else {
|
|
|
|
rpc_system_app_confirm(subghz->rpc_ctx, event, false);
|
2022-07-04 16:09:46 +03:00
|
|
|
}
|
2022-08-02 15:54:12 +03:00
|
|
|
}
|
|
|
|
|
2023-06-13 22:17:54 +03:00
|
|
|
static void subghz_load_custom_presets(SubGhzSetting* setting) {
|
|
|
|
furi_assert(setting);
|
|
|
|
|
|
|
|
const char* presets[][2] = {
|
|
|
|
{"FM95",
|
|
|
|
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 83 10 67 15 24 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
|
|
|
|
2023-07-24 01:15:55 +03:00
|
|
|
// #2-FSK 200khz BW / 135kHz Filter/ 15.86Khz Deviation + Ramping
|
|
|
|
{"FM15k",
|
|
|
|
"02 0D 03 47 08 32 0B 06 15 32 14 00 13 00 12 00 11 32 10 A7 18 18 19 1D 1D 92 1C 00 1B 04 20 FB 22 17 21 B6 00 00 00 12 0E 34 60 C5 C1 C0"},
|
2023-06-13 22:17:54 +03:00
|
|
|
|
|
|
|
// Pagers
|
|
|
|
{"Pagers",
|
|
|
|
"02 0D 07 04 08 32 0B 06 10 64 11 93 12 0C 13 02 14 00 15 15 18 18 19 16 1B 07 1C 00 1D 91 20 FB 21 56 22 10 00 00 C0 00 00 00 00 00 00 00"},
|
|
|
|
|
|
|
|
// # HND - FM preset
|
|
|
|
{"HND_1",
|
|
|
|
"02 0D 0B 06 08 32 07 04 14 00 13 02 12 04 11 36 10 69 15 32 18 18 19 16 1D 91 1C 00 1B 07 20 FB 22 10 21 56 00 00 C0 00 00 00 00 00 00 00"},
|
|
|
|
};
|
|
|
|
|
|
|
|
FlipperFormat* fff_temp = flipper_format_string_alloc();
|
|
|
|
|
2023-08-08 07:58:20 +03:00
|
|
|
for(size_t i = 0; i < COUNT_OF(presets); i++) {
|
2023-06-13 22:17:54 +03:00
|
|
|
flipper_format_insert_or_update_string_cstr(fff_temp, "Custom_preset_data", presets[i][1]);
|
|
|
|
|
|
|
|
flipper_format_rewind(fff_temp);
|
|
|
|
subghz_setting_load_custom_preset(setting, presets[i][0], fff_temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
flipper_format_free(fff_temp);
|
|
|
|
|
|
|
|
#ifdef FURI_DEBUG
|
|
|
|
subghz_setting_customs_presets_to_log(setting);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
SubGhz* subghz_alloc(bool alloc_for_tx_only) {
|
2022-02-18 22:53:46 +03:00
|
|
|
SubGhz* subghz = malloc(sizeof(SubGhz));
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2022-10-05 18:15:23 +03:00
|
|
|
subghz->file_path = furi_string_alloc();
|
|
|
|
subghz->file_path_tmp = furi_string_alloc();
|
2022-06-01 16:07:53 +03:00
|
|
|
|
2021-03-31 20:52:26 +03:00
|
|
|
// GUI
|
2022-07-26 15:21:51 +03:00
|
|
|
subghz->gui = furi_record_open(RECORD_GUI);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
// View Dispatcher
|
|
|
|
subghz->view_dispatcher = view_dispatcher_alloc();
|
2021-05-25 13:19:07 +03:00
|
|
|
view_dispatcher_enable_queue(subghz->view_dispatcher);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
subghz->scene_manager = scene_manager_alloc(&subghz_scene_handlers, subghz);
|
|
|
|
view_dispatcher_set_event_callback_context(subghz->view_dispatcher, subghz);
|
|
|
|
view_dispatcher_set_custom_event_callback(
|
|
|
|
subghz->view_dispatcher, subghz_custom_event_callback);
|
|
|
|
view_dispatcher_set_navigation_event_callback(
|
|
|
|
subghz->view_dispatcher, subghz_back_event_callback);
|
|
|
|
view_dispatcher_set_tick_event_callback(
|
|
|
|
subghz->view_dispatcher, subghz_tick_event_callback, 100);
|
|
|
|
|
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 22:56:23 +03:00
|
|
|
// Open Notification record
|
2022-07-26 15:21:51 +03:00
|
|
|
subghz->notifications = furi_record_open(RECORD_NOTIFICATION);
|
2023-08-25 06:48:04 +03:00
|
|
|
#if SUBGHZ_MEASURE_LOADING
|
2023-08-25 05:14:13 +03:00
|
|
|
uint32_t load_ticks = furi_get_tick();
|
|
|
|
#endif
|
2023-07-06 16:50:25 +03:00
|
|
|
subghz->txrx = subghz_txrx_alloc();
|
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
|
|
|
// SubMenu
|
|
|
|
subghz->submenu = submenu_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher, SubGhzViewIdMenu, submenu_get_view(subghz->submenu));
|
|
|
|
|
|
|
|
// Receiver
|
|
|
|
subghz->subghz_receiver = subghz_view_receiver_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher,
|
|
|
|
SubGhzViewIdReceiver,
|
|
|
|
subghz_view_receiver_get_view(subghz->subghz_receiver));
|
|
|
|
}
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
// Popup
|
|
|
|
subghz->popup = popup_alloc();
|
|
|
|
view_dispatcher_add_view(
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz->view_dispatcher, SubGhzViewIdPopup, popup_get_view(subghz->popup));
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
|
|
|
// Text Input
|
|
|
|
subghz->text_input = text_input_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher,
|
|
|
|
SubGhzViewIdTextInput,
|
|
|
|
text_input_get_view(subghz->text_input));
|
|
|
|
|
|
|
|
// Byte Input
|
|
|
|
subghz->byte_input = byte_input_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher,
|
|
|
|
SubGhzViewIdByteInput,
|
|
|
|
byte_input_get_view(subghz->byte_input));
|
|
|
|
|
|
|
|
// Custom Widget
|
|
|
|
subghz->widget = widget_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher, SubGhzViewIdWidget, widget_get_view(subghz->widget));
|
|
|
|
}
|
2021-11-11 15:49:19 +03:00
|
|
|
//Dialog
|
2022-07-26 15:21:51 +03:00
|
|
|
subghz->dialogs = furi_record_open(RECORD_DIALOGS);
|
2021-11-11 15:49:19 +03:00
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
// Transmitter
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz->subghz_transmitter = subghz_view_transmitter_alloc();
|
2021-03-31 20:52:26 +03:00
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher,
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzViewIdTransmitter,
|
|
|
|
subghz_view_transmitter_get_view(subghz->subghz_transmitter));
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
|
|
|
// Variable Item List
|
|
|
|
subghz->variable_item_list = variable_item_list_alloc();
|
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher,
|
|
|
|
SubGhzViewIdVariableItemList,
|
|
|
|
variable_item_list_get_view(subghz->variable_item_list));
|
|
|
|
|
|
|
|
// Frequency Analyzer
|
2023-07-06 16:50:25 +03:00
|
|
|
// View knows too much
|
|
|
|
subghz->subghz_frequency_analyzer = subghz_frequency_analyzer_alloc(subghz->txrx);
|
2022-10-02 08:50:41 +03:00
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher,
|
|
|
|
SubGhzViewIdFrequencyAnalyzer,
|
|
|
|
subghz_frequency_analyzer_get_view(subghz->subghz_frequency_analyzer));
|
|
|
|
}
|
2021-10-27 20:37:11 +03:00
|
|
|
// Read RAW
|
2022-10-02 08:50:41 +03:00
|
|
|
subghz->subghz_read_raw = subghz_read_raw_alloc(alloc_for_tx_only);
|
2021-10-25 17:37:14 +03:00
|
|
|
view_dispatcher_add_view(
|
|
|
|
subghz->view_dispatcher,
|
2022-03-03 12:48:56 +03:00
|
|
|
SubGhzViewIdReadRAW,
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz_read_raw_get_view(subghz->subghz_read_raw));
|
2021-10-25 17:37:14 +03:00
|
|
|
|
2023-05-09 17:30:01 +03:00
|
|
|
//init threshold rssi
|
|
|
|
subghz->threshold_rssi = subghz_threshold_rssi_alloc();
|
|
|
|
|
|
|
|
//init TxRx & Protocol & History & KeyBoard
|
|
|
|
subghz_unlock(subghz);
|
|
|
|
|
|
|
|
SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
|
2022-12-11 00:42:26 +03:00
|
|
|
|
2023-06-13 22:17:54 +03:00
|
|
|
subghz_load_custom_presets(setting);
|
2022-04-14 17:05:40 +03:00
|
|
|
|
2022-09-28 01:01:09 +03:00
|
|
|
// Load last used values for Read, Read RAW, etc. or default
|
2023-03-16 15:02:23 +03:00
|
|
|
subghz->last_settings = subghz_last_settings_alloc();
|
2023-08-08 07:58:20 +03:00
|
|
|
size_t preset_count = subghz_setting_get_preset_count(setting);
|
|
|
|
subghz_last_settings_load(subghz->last_settings, preset_count);
|
|
|
|
#ifdef FURI_DEBUG
|
2023-08-08 16:31:46 +03:00
|
|
|
subghz_last_settings_log(subghz->last_settings);
|
2023-08-08 07:58:20 +03:00
|
|
|
#endif
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
2023-08-25 06:48:04 +03:00
|
|
|
#if SUBGHZ_LAST_SETTING_SAVE_PRESET
|
2023-08-08 07:58:20 +03:00
|
|
|
subghz_txrx_set_preset_internal(
|
|
|
|
subghz->txrx, subghz->last_settings->frequency, subghz->last_settings->preset_index);
|
2023-08-25 06:48:04 +03:00
|
|
|
#else
|
|
|
|
subghz_txrx_set_default_preset(subghz->txrx, subghz->last_settings->frequency);
|
|
|
|
#endif
|
2023-08-04 17:52:16 +03:00
|
|
|
subghz->history = subghz_history_alloc();
|
2022-10-02 08:50:41 +03:00
|
|
|
}
|
2023-05-09 17:30:01 +03:00
|
|
|
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);
|
2023-05-09 17:30:01 +03:00
|
|
|
|
2023-05-09 12:07:36 +03:00
|
|
|
subghz->secure_data = malloc(sizeof(SecureData));
|
2023-08-08 16:31:46 +03:00
|
|
|
|
2023-08-08 07:58:20 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
|
|
|
subghz->ignore_filter = subghz->last_settings->ignore_filter;
|
|
|
|
subghz->filter = subghz->last_settings->filter;
|
|
|
|
} else {
|
|
|
|
subghz->filter = SubGhzProtocolFlag_Decodable;
|
|
|
|
subghz->ignore_filter = 0x0;
|
|
|
|
}
|
2023-05-09 17:30:01 +03:00
|
|
|
subghz_txrx_receiver_set_filter(subghz->txrx, subghz->filter);
|
2023-05-09 21:54:56 +03:00
|
|
|
subghz_txrx_set_need_save_callback(subghz->txrx, subghz_save_to_file, subghz);
|
2023-05-09 12:07:36 +03:00
|
|
|
|
2023-08-08 07:58:20 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
2023-08-08 16:31:46 +03:00
|
|
|
if(!float_is_equal(subghz->last_settings->rssi, 0)) {
|
2023-08-08 07:58:20 +03:00
|
|
|
subghz_threshold_rssi_set(subghz->threshold_rssi, subghz->last_settings->rssi);
|
|
|
|
} else {
|
|
|
|
subghz->last_settings->rssi = SUBGHZ_LAST_SETTING_FREQUENCY_ANALYZER_TRIGGER;
|
|
|
|
}
|
|
|
|
}
|
2023-08-25 06:48:04 +03:00
|
|
|
#if SUBGHZ_MEASURE_LOADING
|
2023-08-25 05:14:13 +03:00
|
|
|
load_ticks = furi_get_tick() - load_ticks;
|
|
|
|
FURI_LOG_I(TAG, "Loaded: %ld ms.", load_ticks);
|
|
|
|
#endif
|
2021-09-10 03:29:57 +03:00
|
|
|
//Init Error_str
|
2022-10-05 18:15:23 +03:00
|
|
|
subghz->error_str = furi_string_alloc();
|
2021-09-10 03:29:57 +03:00
|
|
|
|
2021-03-31 20:52:26 +03:00
|
|
|
return subghz;
|
|
|
|
}
|
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
void subghz_free(SubGhz* subghz, bool alloc_for_tx_only) {
|
2021-03-31 20:52:26 +03:00
|
|
|
furi_assert(subghz);
|
|
|
|
|
2022-07-04 16:09:46 +03:00
|
|
|
if(subghz->rpc_ctx) {
|
|
|
|
rpc_system_app_set_callback(subghz->rpc_ctx, NULL, NULL);
|
2022-07-25 17:16:45 +03:00
|
|
|
rpc_system_app_send_exited(subghz->rpc_ctx);
|
2022-08-02 15:54:12 +03:00
|
|
|
subghz_blink_stop(subghz);
|
2022-07-04 16:09:46 +03:00
|
|
|
subghz->rpc_ctx = NULL;
|
|
|
|
}
|
|
|
|
|
2023-05-09 19:10:56 +03:00
|
|
|
subghz_txrx_speaker_off(subghz->txrx);
|
2023-05-09 15:11:54 +03:00
|
|
|
subghz_txrx_stop(subghz->txrx);
|
2023-05-09 19:10:56 +03:00
|
|
|
subghz_txrx_sleep(subghz->txrx);
|
2023-02-09 07:48:06 +03:00
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
|
|
|
// Receiver
|
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdReceiver);
|
|
|
|
subghz_view_receiver_free(subghz->subghz_receiver);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
// TextInput
|
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdTextInput);
|
|
|
|
text_input_free(subghz->text_input);
|
2022-04-20 19:04:19 +03:00
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
// ByteInput
|
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdByteInput);
|
|
|
|
byte_input_free(subghz->byte_input);
|
2021-09-10 03:29:57 +03:00
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
// Custom Widget
|
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdWidget);
|
|
|
|
widget_free(subghz->widget);
|
|
|
|
}
|
2021-11-11 15:49:19 +03:00
|
|
|
//Dialog
|
2022-07-26 15:21:51 +03:00
|
|
|
furi_record_close(RECORD_DIALOGS);
|
2021-11-11 15:49:19 +03:00
|
|
|
|
2021-09-10 03:29:57 +03:00
|
|
|
// Transmitter
|
2022-03-03 12:48:56 +03:00
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdTransmitter);
|
|
|
|
subghz_view_transmitter_free(subghz->subghz_transmitter);
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
|
|
|
// Variable Item List
|
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdVariableItemList);
|
|
|
|
variable_item_list_free(subghz->variable_item_list);
|
|
|
|
|
|
|
|
// Frequency Analyzer
|
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdFrequencyAnalyzer);
|
|
|
|
subghz_frequency_analyzer_free(subghz->subghz_frequency_analyzer);
|
|
|
|
}
|
2021-10-27 20:37:11 +03:00
|
|
|
// Read RAW
|
2022-03-03 12:48:56 +03:00
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdReadRAW);
|
2021-10-27 20:37:11 +03:00
|
|
|
subghz_read_raw_free(subghz->subghz_read_raw);
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
|
|
|
// Submenu
|
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdMenu);
|
|
|
|
submenu_free(subghz->submenu);
|
|
|
|
}
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
// Popup
|
2022-03-03 12:48:56 +03:00
|
|
|
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdPopup);
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
popup_free(subghz->popup);
|
|
|
|
|
|
|
|
// Scene manager
|
|
|
|
scene_manager_free(subghz->scene_manager);
|
2021-06-30 00:19:20 +03:00
|
|
|
|
2021-03-31 20:52:26 +03:00
|
|
|
// View Dispatcher
|
|
|
|
view_dispatcher_free(subghz->view_dispatcher);
|
|
|
|
|
|
|
|
// GUI
|
2022-07-26 15:21:51 +03:00
|
|
|
furi_record_close(RECORD_GUI);
|
2021-03-31 20:52:26 +03:00
|
|
|
subghz->gui = NULL;
|
|
|
|
|
2023-05-10 23:07:06 +03:00
|
|
|
subghz_last_settings_free(subghz->last_settings);
|
2023-05-06 02:00:26 +03:00
|
|
|
|
|
|
|
// threshold rssi
|
|
|
|
subghz_threshold_rssi_free(subghz->threshold_rssi);
|
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
if(!alloc_for_tx_only) {
|
2023-05-09 15:11:54 +03:00
|
|
|
subghz_history_free(subghz->history);
|
2022-10-02 08:50:41 +03:00
|
|
|
}
|
2023-05-09 17:30:01 +03:00
|
|
|
|
2023-05-09 12:07:36 +03:00
|
|
|
free(subghz->secure_data);
|
2023-05-09 17:30:01 +03:00
|
|
|
|
|
|
|
//TxRx
|
|
|
|
subghz_txrx_free(subghz->txrx);
|
2021-09-10 03:29:57 +03:00
|
|
|
|
|
|
|
//Error string
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_free(subghz->error_str);
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
|
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 22:56:23 +03:00
|
|
|
// Notifications
|
2022-07-26 15:21:51 +03:00
|
|
|
furi_record_close(RECORD_NOTIFICATION);
|
SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited
* SubGhz: Fix displaying Nice FlorS in the Raed scene
* SubGhz: Fix displaying Faac SLH in the Raed scene
* SubGhz: Fix displaying iDo in the Raed scene
* SubGhz: Fix displaying Star Line in the Raed scene
* SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control)
* SubGhz: subghz_beginadded common encoder upload signal
* SubGhz: add Came encoder
* SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder
* SubGhz: add nice flo encoder, need testing no remote control
* SubGhz: add gate_tx encoder
* SubGhz: add nero_sketch encoder
* SubGhz: add keelog encoder
* SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions)
* SubGhz: fix max upload
* SubGhz: Fix structure subghz add encoder
* SubGhz: add generating and sending a dynamic keelog key, refactoring the code
* SubGhz: add notifications
* SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan)
* SubGhz: Fix load file, fix scene start
* Subghz: Fix show key
* SubGhz: Fix subghz_cli
* SubGhz: Fix furi-hal-subghz
* Format sources
* SubGhz: standard notification scheme, fix broken assert in DMA.
* SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-16 22:56:23 +03:00
|
|
|
subghz->notifications = NULL;
|
|
|
|
|
2022-06-01 16:07:53 +03:00
|
|
|
// Path strings
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_free(subghz->file_path);
|
|
|
|
furi_string_free(subghz->file_path_tmp);
|
2022-04-07 14:47:47 +03:00
|
|
|
|
2021-03-31 20:52:26 +03:00
|
|
|
// The rest
|
|
|
|
free(subghz);
|
|
|
|
}
|
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
int32_t subghz_app(void* p) {
|
2022-10-02 08:50:41 +03:00
|
|
|
bool alloc_for_tx;
|
|
|
|
if(p && strlen(p)) {
|
|
|
|
alloc_for_tx = true;
|
|
|
|
} else {
|
|
|
|
alloc_for_tx = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SubGhz* subghz = subghz_alloc(alloc_for_tx);
|
|
|
|
|
|
|
|
if(alloc_for_tx) {
|
|
|
|
subghz->raw_send_only = true;
|
|
|
|
} else {
|
|
|
|
subghz->raw_send_only = false;
|
|
|
|
}
|
2021-03-31 20:52:26 +03:00
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
// Check argument and run corresponding scene
|
2022-08-04 05:02:23 +03:00
|
|
|
if(p && strlen(p)) {
|
2022-07-04 16:09:46 +03:00
|
|
|
uint32_t rpc_ctx = 0;
|
2023-03-13 23:19:33 +03:00
|
|
|
|
2022-07-04 16:09:46 +03:00
|
|
|
if(sscanf(p, "RPC %lX", &rpc_ctx) == 1) {
|
|
|
|
subghz->rpc_ctx = (void*)rpc_ctx;
|
|
|
|
rpc_system_app_set_callback(subghz->rpc_ctx, subghz_rpc_command_callback, subghz);
|
2022-07-25 17:16:45 +03:00
|
|
|
rpc_system_app_send_started(subghz->rpc_ctx);
|
|
|
|
view_dispatcher_attach_to_gui(
|
|
|
|
subghz->view_dispatcher, subghz->gui, ViewDispatcherTypeDesktop);
|
2022-07-04 16:09:46 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneRpc);
|
2022-07-25 17:16:45 +03:00
|
|
|
} else {
|
|
|
|
view_dispatcher_attach_to_gui(
|
|
|
|
subghz->view_dispatcher, subghz->gui, ViewDispatcherTypeFullscreen);
|
|
|
|
if(subghz_key_load(subghz, p, true)) {
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_set(subghz->file_path, (const char*)p);
|
2022-07-25 17:16:45 +03:00
|
|
|
|
2023-05-10 13:21:42 +03:00
|
|
|
if(subghz_get_load_type_file(subghz) == SubGhzLoadTypeFileRaw) {
|
2022-07-25 17:16:45 +03:00
|
|
|
//Load Raw TX
|
2023-05-06 17:47:49 +03:00
|
|
|
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWLoad);
|
2022-07-25 17:16:45 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);
|
|
|
|
} else {
|
|
|
|
//Load transmitter TX
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTransmitter);
|
|
|
|
}
|
2022-04-01 14:10:21 +03:00
|
|
|
} else {
|
2022-07-25 17:16:45 +03:00
|
|
|
//exit app
|
|
|
|
scene_manager_stop(subghz->scene_manager);
|
|
|
|
view_dispatcher_stop(subghz->view_dispatcher);
|
2022-04-01 14:10:21 +03:00
|
|
|
}
|
2021-12-22 16:01:20 +03:00
|
|
|
}
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
} else {
|
2022-07-25 17:16:45 +03:00
|
|
|
view_dispatcher_attach_to_gui(
|
|
|
|
subghz->view_dispatcher, subghz->gui, ViewDispatcherTypeFullscreen);
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_set(subghz->file_path, SUBGHZ_APP_FOLDER);
|
2023-05-09 21:54:56 +03:00
|
|
|
if(subghz_txrx_is_database_loaded(subghz->txrx)) {
|
2021-12-22 16:01:20 +03:00
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneStart);
|
|
|
|
} else {
|
|
|
|
scene_manager_set_scene_state(
|
2022-03-03 12:48:56 +03:00
|
|
|
subghz->scene_manager, SubGhzSceneShowError, SubGhzCustomEventManagerSet);
|
2022-10-05 18:15:23 +03:00
|
|
|
furi_string_set(
|
2021-12-22 16:01:20 +03:00
|
|
|
subghz->error_str,
|
|
|
|
"No SD card or\ndatabase found.\nSome app function\nmay be reduced.");
|
|
|
|
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
|
|
|
|
}
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 17:42:56 +03:00
|
|
|
}
|
|
|
|
|
2021-10-04 10:01:41 +03:00
|
|
|
furi_hal_power_suppress_charge_enter();
|
|
|
|
|
2021-05-25 13:19:07 +03:00
|
|
|
view_dispatcher_run(subghz->view_dispatcher);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
2021-10-04 10:01:41 +03:00
|
|
|
furi_hal_power_suppress_charge_exit();
|
|
|
|
|
2022-10-02 08:50:41 +03:00
|
|
|
subghz_free(subghz, alloc_for_tx);
|
2021-03-31 20:52:26 +03:00
|
|
|
|
|
|
|
return 0;
|
2022-05-27 22:18:41 +03:00
|
|
|
}
|