ソースを参照

Merge branch 'codesize' of https://github.com/DRracer/Prusa-Firmware into DRracer_codesize

3d-gussner 3 年 前
コミット
7916f8b9e8
2 ファイル変更8 行追加4 行削除
  1. 6 3
      Firmware/menu.cpp
  2. 2 1
      Firmware/menu.h

+ 6 - 3
Firmware/menu.cpp

@@ -252,8 +252,7 @@ static void menu_draw_item_puts_P(char type_char, const char* str, char num)
     lcd_set_cursor(0, menu_row);
     lcd_printf_P(PSTR("%c%-.16S "), menu_selection_mark(), str);
     lcd_putc(num);
-    lcd_set_cursor(19, menu_row);
-    lcd_putc(type_char);
+    lcd_putc_at(19, menu_row, type_char);
 }
 
 /*
@@ -312,7 +311,7 @@ uint8_t menu_item_submenu_E(const Sheet &sheet, menu_func_t submenu)
     return 0;
 }
 
-uint8_t menu_item_function_E(const Sheet &sheet, menu_func_t func)
+uint8_t __attribute__((noinline)) menu_item_function_E(const Sheet &sheet, menu_func_t func)
 {
     if (menu_item == menu_line)
     {
@@ -346,6 +345,10 @@ uint8_t menu_item_back_P(const char* str)
 	return 0;
 }
 
+bool __attribute__((noinline)) menu_item_leave(){
+    return ((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving;
+}
+
 uint8_t menu_item_function_P(const char* str, menu_func_t func)
 {
 	if (menu_item == menu_line)

+ 2 - 1
Firmware/menu.h

@@ -112,7 +112,8 @@ extern uint8_t menu_item_function_E(const Sheet &sheet, menu_func_t func);
 extern uint8_t menu_item_back_P(const char* str);
 
 // leaving menu - this condition must be immediately before MENU_ITEM_BACK_P
-#define ON_MENU_LEAVE(func) do { if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving){ func } } while (0)
+#define ON_MENU_LEAVE(func) do { if (menu_item_leave()){ func } } while (0)
+extern bool menu_item_leave();
 
 #define MENU_ITEM_FUNCTION_P(str, func) do { if (menu_item_function_P(str, func)) return; } while (0)
 extern uint8_t menu_item_function_P(const char* str, menu_func_t func);