Implement basic gui for profile selection. Still doesn't do anything
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <reflow-controller/oven-driver.h>
|
||||
#include <fatfs/ff.h>
|
||||
#include <reflow-controller/temp-profile-executer.h>
|
||||
|
||||
static char IN_SECTION(.ccm.bss) display_buffer[4][21] = {0};
|
||||
static struct lcd_menu IN_SECTION(.ccm.bss) reflow_menu;
|
||||
@@ -417,9 +418,12 @@ static void gui_menu_temp_profile_select(struct lcd_menu *menu, enum menu_entry_
|
||||
static void *my_parent;
|
||||
static char profile_list[10][17];
|
||||
static bool file_error = false;
|
||||
static enum pl_ret_val profile_ret_val = PL_RET_SUCCESS;
|
||||
static uint8_t currently_selected = 0U;
|
||||
static uint8_t current_scroll_offset = 0U;
|
||||
static uint8_t loaded;
|
||||
int16_t delta;
|
||||
enum button_state button;
|
||||
|
||||
int res;
|
||||
|
||||
if (entry_type == MENU_ENTRY_FIRST_ENTER) {
|
||||
@@ -431,7 +435,7 @@ static void gui_menu_temp_profile_select(struct lcd_menu *menu, enum menu_entry_
|
||||
if (res < 0) {
|
||||
file_error = true;
|
||||
}
|
||||
current_scroll_offset = 0u;
|
||||
|
||||
currently_selected = 0u;
|
||||
loaded = (uint32_t)res;
|
||||
menu_lcd_outputf(menu, 0, "Select:");
|
||||
@@ -441,28 +445,49 @@ static void gui_menu_temp_profile_select(struct lcd_menu *menu, enum menu_entry_
|
||||
}
|
||||
|
||||
if (menu_get_button_ready_state(menu)) {
|
||||
if (menu_get_button_state(menu) == BUTTON_LONG) {
|
||||
delta = menu_get_rotary_delta(menu);
|
||||
button = menu_get_button_state(menu);
|
||||
|
||||
if (button == BUTTON_LONG) {
|
||||
menu_entry_dropback(menu, my_parent);
|
||||
}
|
||||
|
||||
if (file_error) {
|
||||
menu_lcd_outputf(menu, 0, "Disk Error");
|
||||
menu_lcd_outputf(menu, 1, "SD inserted?");
|
||||
if (menu_get_button_state(menu) == BUTTON_SHORT_RELEASED)
|
||||
if (button == BUTTON_SHORT_RELEASED)
|
||||
menu_entry_dropback(menu, my_parent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (loaded == 0) {
|
||||
} else if (loaded == 0) {
|
||||
menu_lcd_outputf(menu, 0, "No profiles");
|
||||
menu_lcd_outputf(menu, 1, "found");
|
||||
if (menu_get_button_state(menu) == BUTTON_SHORT_RELEASED)
|
||||
if (button == BUTTON_SHORT_RELEASED)
|
||||
menu_entry_dropback(menu, my_parent);
|
||||
return;
|
||||
} else if (profile_ret_val != PL_RET_SUCCESS) {
|
||||
menu_lcd_outputf(menu, 0, "Profile Error");
|
||||
if (button == BUTTON_SHORT_RELEASED)
|
||||
menu_entry_dropback(menu, my_parent);
|
||||
return;
|
||||
} else if (currently_selected < loaded) {
|
||||
/* Show currently selected profile */
|
||||
menu_lcd_outputf(menu, 1, "%s", &profile_list[currently_selected][0]);
|
||||
|
||||
if (button == BUTTON_SHORT_RELEASED) {
|
||||
/* Execute selected profile */
|
||||
}
|
||||
|
||||
if (delta >= 4) {
|
||||
menu_ack_rotary_delta(menu);
|
||||
if (currently_selected < (loaded - 1))
|
||||
currently_selected++;
|
||||
} else if (delta <= -4) {
|
||||
menu_ack_rotary_delta(menu);
|
||||
if (currently_selected > 0)
|
||||
currently_selected--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void gui_menu_constant_temperature_driver_setup(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
|
||||
|
Reference in New Issue
Block a user