uhf_scene_settings.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "../uhf_app_i.h"
  2. #include "../uhf_module.h"
  3. void uhf_settings_set_module_baudrate(VariableItem* item) {
  4. UNUSED(item);
  5. }
  6. void uhf_scene_settings_on_enter(void* ctx) {
  7. UHFApp* uhf_app = ctx;
  8. VariableItem* item;
  9. uint8_t value_index = 0;
  10. M100Module* uhf_module = uhf_app->worker->module;
  11. item = variable_item_list_add(
  12. uhf_app->variable_item_list,
  13. "Baud Rate:",
  14. get_baudrate_count(),
  15. uhf_settings_set_module_baudrate,
  16. uhf_module);
  17. // value_index = subghz_scene_receiver_config_next_frequency(preset.frequency, subghz);
  18. scene_manager_set_scene_state(uhf_app->scene_manager, UHFSceneSettings, (uint32_t)item);
  19. variable_item_set_current_value_index(item, value_index);
  20. char text_buf[10] = {0};
  21. snprintf(text_buf, sizeof(text_buf), "%d", uhf_module->baudrate);
  22. variable_item_set_current_value_text(item, text_buf);
  23. view_dispatcher_switch_to_view(uhf_app->view_dispatcher, UHFViewMenu);
  24. }
  25. bool uhf_scene_settings_on_event(void* ctx, SceneManagerEvent event) {
  26. UHFApp* uhf_app = ctx;
  27. bool consumed = false;
  28. if(event.type == SceneManagerEventTypeCustom) {
  29. if(event.event == UHFCustomEventSceneSettingLock) {
  30. scene_manager_previous_scene(uhf_app->scene_manager);
  31. consumed = true;
  32. }
  33. }
  34. return consumed;
  35. }
  36. void uhf_scene_settings_on_exit(void* ctx) {
  37. UHFApp* uhf_app = ctx;
  38. submenu_reset(uhf_app->submenu);
  39. }