Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkorpionm <85568270+Skorpionm@users.noreply.github.com>2021-12-22 16:01:20 +0300
committerGitHub <noreply@github.com>2021-12-22 16:01:20 +0300
commit3a86da5526282ff4eece5d397803c50d7b9293ec (patch)
tree8cc0cf22c08eeb88217b5baace64daffd4eb1a90 /applications/subghz/subghz.c
parent51aa169c3b8424eb65dca6684fe20fdbaec92da4 (diff)
[FL-2139] SubGhz: refactoring GUI SubGhz (#910)
* SubGhz: refactoring GUI ReadRAW * SubGhz: replacing memcpy with strcpy * SubGhz: fix button name "Mode", fix delete scene, fix show name when loading a key * SubGhz: refactoring GUI SubGhz * scene_manager: add exit from last scene API * subghz: stop scene manager before stopping view dispatcher Co-authored-by: gornekich <n.gorbadey@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/subghz/subghz.c')
-rw-r--r--applications/subghz/subghz.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/applications/subghz/subghz.c b/applications/subghz/subghz.c
index 5ae24b7b..23599739 100644
--- a/applications/subghz/subghz.c
+++ b/applications/subghz/subghz.c
@@ -1,3 +1,8 @@
+/*
+* Give up hope, everyone who enters here!!!
+* Оставь надежду, всяк сюда входящий!!!
+*/
+
#include "subghz_i.h"
#include <lib/toolbox/path.h>
@@ -191,13 +196,6 @@ SubGhz* subghz_alloc() {
//Init Error_str
string_init(subghz->error_str);
- subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes");
- subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes_user");
- subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/nice_flor_s_rx");
- subghz_parser_load_came_atomo_file(subghz->txrx->parser, "/ext/subghz/came_atomo");
-
- //subghz_parser_enable_dump_text(subghz->protocol, subghz_text_callback, subghz);
-
return subghz;
}
@@ -285,19 +283,41 @@ void subghz_free(SubGhz* subghz) {
int32_t subghz_app(void* p) {
SubGhz* subghz = subghz_alloc();
+ //Load database
+ bool load_database =
+ subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes");
+ subghz_parser_load_keeloq_file(subghz->txrx->parser, "/ext/subghz/keeloq_mfcodes_user");
+ subghz_parser_load_nice_flor_s_file(subghz->txrx->parser, "/ext/subghz/nice_flor_s_rx");
+ subghz_parser_load_came_atomo_file(subghz->txrx->parser, "/ext/subghz/came_atomo");
+
// Check argument and run corresponding scene
if(p && subghz_key_load(subghz, p)) {
string_t filename;
string_init(filename);
path_extract_filename_no_ext(p, filename);
- strlcpy(
- subghz->file_name, string_get_cstr(filename), strlen(string_get_cstr(filename)) + 1);
+ strcpy(subghz->file_name, string_get_cstr(filename));
string_clear(filename);
- scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTransmitter);
+ if((!strcmp(subghz->txrx->protocol_result->name, "RAW"))) {
+ //Load Raw TX
+ subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad;
+ scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW);
+ } else {
+ //Load transmitter TX
+ scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTransmitter);
+ }
} else {
- scene_manager_next_scene(subghz->scene_manager, SubGhzSceneStart);
+ if(load_database) {
+ scene_manager_next_scene(subghz->scene_manager, SubGhzSceneStart);
+ } else {
+ scene_manager_set_scene_state(
+ subghz->scene_manager, SubGhzSceneShowError, SubghzCustomEventManagerSet);
+ string_set(
+ subghz->error_str,
+ "No SD card or\ndatabase found.\nSome app function\nmay be reduced.");
+ scene_manager_next_scene(subghz->scene_manager, SubGhzSceneShowError);
+ }
}
furi_hal_power_suppress_charge_enter();