8 #define MENU_DATA_SIZE 32
11 typedef void (*menu_func_t)(void);
22 const char* editLabel;
23 uint8_t editValueBits;
31 extern uint8_t menu_data[MENU_DATA_SIZE];
33 extern uint8_t menu_depth;
39 MENU_BLOCK_THERMAL_ERROR = 0x01,
41 MENU_BLOCK_THERMAL_MODEL_AUTOTUNE = 0x02,
43 MENU_BLOCK_STATUS_SCREEN_M0 = 0x04,
49 extern uint8_t menu_block_mask;
53 #define menu_set_block(x) menu_block_mask |= x;
54 #define menu_unset_block(x) menu_block_mask &= ~x;
55 #define menu_is_blocked(x) (menu_block_mask & x)
56 #define menu_is_any_block() (menu_block_mask != MENU_BLOCK_NONE)
58 extern uint8_t menu_line;
59 extern uint8_t menu_item;
60 extern uint8_t menu_row;
63 extern uint8_t menu_top;
64 extern uint8_t menu_clicked;
65 extern uint8_t menu_leaving;
68 extern menu_func_t menu_menu;
70 extern void menu_data_reset(
void);
72 extern void menu_goto(menu_func_t menu,
const int16_t encoder,
bool reset_menu_state,
const bool feedback=
false);
74 #define MENU_BEGIN() menu_start(); for(menu_row = 0; menu_row < LCD_HEIGHT; menu_row++, menu_line++) { menu_item = 0;
75 void menu_start(
void);
77 #define MENU_END() menu_end(); }
78 extern void menu_end(
void);
80 extern void menu_back(
void);
81 extern void menu_back_no_reset(
void);
82 extern void menu_back(uint8_t nLevel);
84 extern void menu_back_if_clicked(
void);
86 extern void menu_submenu(menu_func_t submenu,
const bool feedback=
false);
87 extern void menu_submenu_no_reset(menu_func_t submenu,
const bool feedback=
false);
89 extern void menu_item_ret(
void);
96 #define MENU_ITEM_DUMMY() menu_item_dummy()
97 extern void menu_item_dummy(
void);
99 #define MENU_ITEM_TEXT_P(str) do { menu_item_text_P(str); } while (0)
100 extern uint8_t menu_item_text_P(
const char* str);
102 #define MENU_ITEM_SUBMENU_P(str, submenu) do { menu_item_submenu_P(str, submenu); } while (0)
103 extern void menu_item_submenu_P(
const char* str, menu_func_t submenu);
105 #define MENU_ITEM_SUBMENU_E(sheet, submenu) do { menu_item_submenu_E(sheet, submenu); } while (0)
106 extern void menu_item_submenu_E(
const Sheet &sheet, menu_func_t submenu);
108 #define MENU_ITEM_FUNCTION_E(sheet, submenu) do { menu_item_function_E(sheet, submenu); } while (0)
109 extern void menu_item_function_E(
const Sheet &sheet, menu_func_t func);
111 #define MENU_ITEM_BACK_P(str) do { menu_item_back_P(str); } while (0)
112 extern void menu_item_back_P(
const char* str);
115 #define ON_MENU_LEAVE(func) do { if (menu_item_leave()){ func } } while (0)
116 extern bool menu_item_leave();
118 #define MENU_ITEM_FUNCTION_P(str, func) do { menu_item_function_P(str, func); } while (0)
119 extern void menu_item_function_P(
const char* str, menu_func_t func);
121 #define MENU_ITEM_FUNCTION_NR_P(str, number, func, fn_par) do { menu_item_function_P(str, number, func, fn_par); } while (0)
122 extern void menu_item_function_P(
const char* str,
char number,
void (*func)(uint8_t), uint8_t fn_par);
124 #define MENU_ITEM_TOGGLE_P(str, toggle, func) do { menu_item_toggle_P(str, toggle, func, 0x02); } while (0)
125 #define MENU_ITEM_TOGGLE(str, toggle, func) do { menu_item_toggle_P(str, toggle, func, 0x00); } while (0)
126 extern void menu_item_toggle_P(
const char* str,
const char* toggle, menu_func_t func,
const uint8_t settings);
128 #define MENU_ITEM_GCODE_P(str, str_gcode) do { menu_item_gcode_P(str, str_gcode); } while (0)
129 extern void menu_item_gcode_P(
const char* str,
const char* str_gcode);
132 extern const char menu_fmt_int3[];
134 extern const char menu_fmt_float31[];
135 extern const char menu_fmt_float13[];
137 extern void menu_draw_float31(
const char* str,
float val);
139 extern void menu_draw_float13(
const char* str,
float val);
148 #define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { menu_item_edit_P(str, pval, sizeof(*pval)*8, minval, maxval, 0); } while (0)
149 #define MENU_ITEM_EDIT_int3_jmp_P(str, pval, minval, maxval, jmpval) do { menu_item_edit_P(str, pval, sizeof(*pval)*8, minval, maxval, jmpval); } while (0)
150 extern void menu_item_edit_P(
const char* str,
void* pval, uint8_t pbits, int16_t min_val, int16_t max_val, int16_t jmp_val);
152 extern void menu_progressbar_init(uint16_t total,
const char* title);
153 extern void menu_progressbar_update(uint16_t newVal);
154 extern void menu_progressbar_finish(
void);