Skip to content

Commit

Permalink
feat: ota menu callbacks working
Browse files Browse the repository at this point in the history
  • Loading branch information
Otrebor671 committed Aug 15, 2024
1 parent 987208e commit b0355e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
9 changes: 6 additions & 3 deletions firmware/main/modules/menus_module/menus.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#pragma once
#include <stdbool.h>
#include <stdio.h>

#include "ota_module.h"

typedef enum {
MENU_MAIN_2 = 0,
MENU_APPLICATIONS_2,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions firmware/main/modules/ota/ota_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
#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() {
screen_module_set_screen(MENU_ABOUT_UPDATE);
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;
}
Expand Down
7 changes: 6 additions & 1 deletion firmware/main/modules/ota/ota_module.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
#pragma once
void ota_module_init();

#include <stdio.h>

void ota_module_init();
void ota_module_deinit();
void ota_module_input(uint8_t button_name, uint8_t button_event);

0 comments on commit b0355e7

Please sign in to comment.