diff --git a/scenes/plugins/protopirate_config_plugin.c b/scenes/plugins/protopirate_config_plugin.c index d0bf333..7c6c39d 100644 --- a/scenes/plugins/protopirate_config_plugin.c +++ b/scenes/plugins/protopirate_config_plugin.c @@ -355,7 +355,7 @@ static void } } -static void plugin_on_enter(void* context) { +static void plugin_on_enter(void* context, bool show_lock_keyboard) { ProtoPirateApp* app = context; VariableItem* item; uint8_t value_index; @@ -480,10 +480,12 @@ static void plugin_on_enter(void* context) { variable_item_set_current_value_index(item, app->sound); variable_item_set_current_value_text(item, on_off_text[app->sound ? 1 : 0]); - variable_item_list_add(app->variable_item_list, "Lock Keyboard", 1, NULL, NULL); + //Only show the Lock Keyboard Option in Receiver. Timing Tuner Doesnt respect it, and its wierd in Configuration from the Main Menu. variable_item_list_set_enter_callback( app->variable_item_list, protopirate_scene_receiver_config_var_list_enter_callback, app); - + if(show_lock_keyboard) { + variable_item_list_add(app->variable_item_list, "Lock Keyboard", 1, NULL, NULL); + } view_dispatcher_switch_to_view(app->view_dispatcher, ProtoPirateViewVariableItemList); } diff --git a/scenes/plugins/protopirate_config_plugin.h b/scenes/plugins/protopirate_config_plugin.h index a1c8468..4fa028f 100644 --- a/scenes/plugins/protopirate_config_plugin.h +++ b/scenes/plugins/protopirate_config_plugin.h @@ -41,6 +41,6 @@ typedef struct ProtoPirateConfigPlugin { uint16_t model_count, SubGhzSetting* app_settings); uint16_t (*car_model_get_count)(void); - void (*on_enter)(void* app); + void (*on_enter)(void* app, bool show_lock_keyboard); void (*set_host_api)(const ProtoPirateConfigSceneHostApi* host_api); } ProtoPirateConfigPlugin; diff --git a/scenes/protopirate_scene_receiver.c b/scenes/protopirate_scene_receiver.c index ee04617..5713893 100644 --- a/scenes/protopirate_scene_receiver.c +++ b/scenes/protopirate_scene_receiver.c @@ -435,7 +435,13 @@ bool protopirate_scene_receiver_on_event(void* context, SceneManagerEvent event) } case ProtoPirateCustomEventViewReceiverConfig: + //Leaving for Subscene scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiver, 1); + + //Show the lock keyboard option. + scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig, 1); + + //Start receiver Config. scene_manager_next_scene(app->scene_manager, ProtoPirateSceneReceiverConfig); consumed = true; break; diff --git a/scenes/protopirate_scene_receiver_config.c b/scenes/protopirate_scene_receiver_config.c index 82e553f..2c1a49c 100644 --- a/scenes/protopirate_scene_receiver_config.c +++ b/scenes/protopirate_scene_receiver_config.c @@ -17,7 +17,10 @@ void protopirate_scene_receiver_config_on_enter(void* context) { return; } app->config_plugin->set_host_api(&protopirate_config_scene_host_api); - app->config_plugin->on_enter(app); + //We have to grab this from the scene manager, from inside the plugin it just doesnt work! + bool show_lock_keyboard = + (scene_manager_get_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig) == 1); + app->config_plugin->on_enter(app, show_lock_keyboard); } bool protopirate_scene_receiver_config_on_event(void* context, SceneManagerEvent event) { diff --git a/scenes/protopirate_scene_start.c b/scenes/protopirate_scene_start.c index 67c599e..fcce340 100644 --- a/scenes/protopirate_scene_start.c +++ b/scenes/protopirate_scene_start.c @@ -102,6 +102,8 @@ bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(app->scene_manager, ProtoPirateSceneSaved); consumed = true; } else if(event.event == SubmenuIndexProtoPirateReceiverConfig) { + //Hide the lock keyboard option. + scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig, 0); scene_manager_next_scene(app->scene_manager, ProtoPirateSceneReceiverConfig); consumed = true; } @@ -113,6 +115,8 @@ bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) { #endif #ifdef ENABLE_TIMING_TUNER_SCENE else if(event.event == SubmenuIndexProtoPirateTimingTuner) { + //Hide the lock keyboard option. + scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig, 0); scene_manager_next_scene(app->scene_manager, ProtoPirateSceneTimingTuner); consumed = true; }