Same codebase as fap

This commit is contained in:
gid9798
2023-05-30 17:41:49 +03:00
parent b3e8b2c487
commit a312aa422a
7 changed files with 21 additions and 34 deletions

View File

@@ -12,6 +12,6 @@ App(
"dialogs", "dialogs",
], ],
icon="A_SubGHzRemote_14", icon="A_SubGHzRemote_14",
stack_size=3 * 1024, stack_size=2 * 1024,
order=11, order=11,
) )

View File

@@ -1,3 +1,5 @@
#ifndef SUBREM_LIGHT
ADD_SCENE(subrem, start, Start) ADD_SCENE(subrem, start, Start)
#endif
ADD_SCENE(subrem, open_map_file, OpenMapFile) ADD_SCENE(subrem, open_map_file, OpenMapFile)
ADD_SCENE(subrem, remote, Remote) ADD_SCENE(subrem, remote, Remote)

View File

@@ -5,19 +5,11 @@ void subrem_scene_open_map_file_on_enter(void* context) {
SubGhzRemoteApp* app = context; SubGhzRemoteApp* app = context;
SubRemLoadMapState load_state = subrem_load_from_file(app); SubRemLoadMapState load_state = subrem_load_from_file(app);
uint32_t start_scene_state =
scene_manager_get_scene_state(app->scene_manager, SubRemSceneStart);
// TODO if optimization if(load_state == SubRemLoadMapStateOK || load_state == SubRemLoadMapStateNotAllOK) {
scene_manager_next_scene(app->scene_manager, SubRemSceneRemote);
if(load_state == SubRemLoadMapStateBack) { } else {
if(!scene_manager_previous_scene(app->scene_manager)) { if(load_state != SubRemLoadMapStateBack) {
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
}
} else if(start_scene_state == SubmenuIndexSubRemOpenMapFile) {
if(load_state != SubRemLoadMapStateOK && load_state != SubRemLoadMapStateNotAllOK &&
load_state != SubRemLoadMapStateBack) {
#ifdef SUBREM_LIGHT #ifdef SUBREM_LIGHT
dialog_message_show_storage_error(app->dialogs, "Can't load\nMap file"); dialog_message_show_storage_error(app->dialogs, "Can't load\nMap file");
#else #else
@@ -32,15 +24,10 @@ void subrem_scene_open_map_file_on_enter(void* context) {
dialog_message_free(message); dialog_message_free(message);
#endif #endif
} }
if(load_state == SubRemLoadMapStateOK || load_state == SubRemLoadMapStateNotAllOK) { // TODO: Map Preset Reset
scene_manager_next_scene(app->scene_manager, SubRemSceneRemote); if(!scene_manager_previous_scene(app->scene_manager)) {
} else { scene_manager_stop(app->scene_manager);
// TODO: Map Preset Reset view_dispatcher_stop(app->view_dispatcher);
if(!scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, SubRemSceneStart)) {
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
}
} }
} }
} }

View File

@@ -49,13 +49,9 @@ bool subrem_scene_remote_on_event(void* context, SceneManagerEvent event) {
SubGhzRemoteApp* app = context; SubGhzRemoteApp* app = context;
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubRemCustomEventViewRemoteBack) { if(event.event == SubRemCustomEventViewRemoteBack) {
if(!scene_manager_search_and_switch_to_previous_scene( if(!scene_manager_previous_scene(app->scene_manager)) {
app->scene_manager, SubRemSceneOpenMapFile)) { scene_manager_stop(app->scene_manager);
if(!scene_manager_search_and_switch_to_previous_scene( view_dispatcher_stop(app->view_dispatcher);
app->scene_manager, SubRemSceneStart)) {
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
}
} }
return true; return true;
} else if( } else if(

View File

@@ -33,10 +33,10 @@ void subrem_scene_start_on_enter(void* context) {
// SubmenuIndexSubGhzRemoteAbout, // SubmenuIndexSubGhzRemoteAbout,
// subrem_scene_start_submenu_callback, // subrem_scene_start_submenu_callback,
// app); // app);
#ifndef SUBREM_LIGHT
submenu_set_selected_item( submenu_set_selected_item(
submenu, scene_manager_get_scene_state(app->scene_manager, SubRemSceneStart)); submenu, scene_manager_get_scene_state(app->scene_manager, SubRemSceneStart));
#endif
view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDSubmenu); view_dispatcher_switch_to_view(app->view_dispatcher, SubRemViewIDSubmenu);
} }
@@ -48,8 +48,10 @@ bool subrem_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexSubRemOpenMapFile) { if(event.event == SubmenuIndexSubRemOpenMapFile) {
#ifndef SUBREM_LIGHT
scene_manager_set_scene_state( scene_manager_set_scene_state(
app->scene_manager, SubRemSceneStart, SubmenuIndexSubRemOpenMapFile); app->scene_manager, SubRemSceneStart, SubmenuIndexSubRemOpenMapFile);
#endif
scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile); scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile);
consumed = true; consumed = true;
} }

View File

@@ -252,11 +252,11 @@ bool subrem_tx_stop_sub(SubGhzRemoteApp* app, bool forced) {
if(sub_preset->type == SubGhzProtocolTypeDynamic) { if(sub_preset->type == SubGhzProtocolTypeDynamic) {
keeloq_reset_mfname(); keeloq_reset_mfname();
keeloq_reset_kl_type(); keeloq_reset_kl_type();
keeloq_reset_original_btn();
subghz_custom_btns_reset();
star_line_reset_mfname(); star_line_reset_mfname();
star_line_reset_kl_type(); star_line_reset_kl_type();
} }
keeloq_reset_original_btn();
subghz_custom_btns_reset();
#endif #endif
return true; return true;
} }

View File

@@ -8,7 +8,7 @@
#ifdef APP_SUBGHZREMOTE #ifdef APP_SUBGHZREMOTE
#include <assets_icons.h> #include <assets_icons.h>
#elif #else
#include <subrem_remote_fap_icons.h> #include <subrem_remote_fap_icons.h>
#endif #endif