From b0355e7557aa6e79ef0cc1abf9a21c5cfb7ce33c Mon Sep 17 00:00:00 2001 From: Roberto Arellano Date: Wed, 14 Aug 2024 19:36:47 -0600 Subject: [PATCH] feat: ota menu callbacks working --- firmware/main/modules/menus_module/menus.h | 9 ++++++--- firmware/main/modules/ota/ota_module.c | 6 +++--- firmware/main/modules/ota/ota_module.h | 7 ++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/firmware/main/modules/menus_module/menus.h b/firmware/main/modules/menus_module/menus.h index 8d344fb4..b839c237 100644 --- a/firmware/main/modules/menus_module/menus.h +++ b/firmware/main/modules/menus_module/menus.h @@ -1,6 +1,9 @@ #pragma once #include #include + +#include "ota_module.h" + typedef enum { MENU_MAIN_2 = 0, MENU_APPLICATIONS_2, @@ -360,9 +363,9 @@ menu_t menus[] = { ////////////////////////////////// {.display_name = "Update", .menu_idx = MENU_ABOUT_UPDATE_2, .parent_idx = MENU_ABOUT_2, - .input_cb = NULL, - .on_enter_cb = NULL, - .on_exit_cb = NULL, + .input_cb = ota_module_input, + .on_enter_cb = ota_module_init, + .on_exit_cb = ota_module_deinit, .is_visible = true}, {.display_name = "Display", .menu_idx = MENU_SETTINGS_DISPLAY_2, diff --git a/firmware/main/modules/ota/ota_module.c b/firmware/main/modules/ota/ota_module.c index 1aed7409..6c472bff 100644 --- a/firmware/main/modules/ota/ota_module.c +++ b/firmware/main/modules/ota/ota_module.c @@ -4,13 +4,13 @@ #include "menu_screens_modules.h" #include "ota_module_screens.h" -static void ota_module_input(uint8_t button_name, uint8_t button_event); +void ota_module_input(uint8_t button_name, uint8_t button_event); void ota_module_init() { OTA_set_show_event_cb(ota_module_screens_show_event); ota_module_screens_show_help(); OTA_init(); - menu_screens_set_app_state(true, ota_module_input); + // menu_screens_set_app_state(true, ota_module_input); } void ota_module_deinit() { @@ -18,7 +18,7 @@ void ota_module_deinit() { esp_restart(); } -static void ota_module_input(uint8_t button_name, uint8_t button_event) { +void ota_module_input(uint8_t button_name, uint8_t button_event) { if (button_event != BUTTON_SINGLE_CLICK || is_ota_running) { return; } diff --git a/firmware/main/modules/ota/ota_module.h b/firmware/main/modules/ota/ota_module.h index cc838da3..9c78d0ce 100644 --- a/firmware/main/modules/ota/ota_module.h +++ b/firmware/main/modules/ota/ota_module.h @@ -1,2 +1,7 @@ #pragma once -void ota_module_init(); \ No newline at end of file + +#include + +void ota_module_init(); +void ota_module_deinit(); +void ota_module_input(uint8_t button_name, uint8_t button_event); \ No newline at end of file