瀏覽代碼

Make local functions static. Saves 30B of flash with Arduino 1.6.9. No difference with Arduino 1.8.5.

Marek Bel 6 年之前
父節點
當前提交
5a7c9e3ffd
共有 2 個文件被更改,包括 5 次插入12 次删除
  1. 5 5
      Firmware/menu.cpp
  2. 0 7
      Firmware/menu.h

+ 5 - 5
Firmware/menu.cpp

@@ -92,7 +92,7 @@ void menu_back(void)
 	}
 }
 
-void menu_back_no_reset(void)
+static void menu_back_no_reset(void)
 {
 	if (menu_depth > 0)
 	{
@@ -126,7 +126,7 @@ void menu_submenu(menu_func_t submenu)
 	}
 }
 
-void menu_submenu_no_reset(menu_func_t submenu)
+static void menu_submenu_no_reset(menu_func_t submenu)
 {
 	if (menu_depth <= MENU_DEPTH_MAX)
 	{
@@ -164,7 +164,7 @@ int menu_draw_item_printf_P(char type_char, const char* format, ...)
 }
 */
 
-int menu_draw_item_puts_P(char type_char, const char* str)
+static int menu_draw_item_puts_P(char type_char, const char* str)
 {
     lcd_set_cursor(0, menu_row);
 	int cnt = lcd_printf_P(PSTR("%c%-18S%c"), (lcd_encoder == menu_item)?'>':' ', str, type_char);
@@ -270,7 +270,7 @@ const char menu_fmt_float31[] PROGMEM = "%c%.12S:%s%+06.1f";
 const char menu_fmt_float13[] PROGMEM = "%c%.12S:%s%+06.3f";
 
 template<typename T>
-void menu_draw_P(char chr, const char* str, int16_t val);
+static void menu_draw_P(char chr, const char* str, int16_t val);
 
 template<>
 void menu_draw_P<int16_t*>(char chr, const char* str, int16_t val)
@@ -306,7 +306,7 @@ void menu_draw_float13(char chr, const char* str, float val)
 }
 
 template <typename T>
-void _menu_edit_P(void)
+static void _menu_edit_P(void)
 {
 	menu_data_edit_t* _md = (menu_data_edit_t*)&(menu_data[0]);
 	if (lcd_draw_update)

+ 0 - 7
Firmware/menu.h

@@ -55,21 +55,16 @@ extern void menu_end(void);
 
 extern void menu_back(void);
 
-extern void menu_back_no_reset(void);
-
 extern void menu_back_if_clicked(void);
 
 extern void menu_back_if_clicked_fb(void);
 
 extern void menu_submenu(menu_func_t submenu);
 
-extern void menu_submenu_no_reset(menu_func_t submenu);
-
 extern uint8_t menu_item_ret(void);
 
 //extern int menu_draw_item_printf_P(char type_char, const char* format, ...);
 
-extern int menu_draw_item_puts_P(char type_char, const char* str);
 
 //int menu_draw_item_puts_P_int16(char type_char, const char* str, int16_t val, );
 
@@ -96,13 +91,11 @@ extern const char menu_fmt_int3[];
 
 extern const char menu_fmt_float31[];
 
-extern void menu_draw_int3(char chr, const char* str, int16_t val);
 
 extern void menu_draw_float31(char chr, const char* str, float val);
 
 extern void menu_draw_float13(char chr, const char* str, float val);
 
-extern void _menu_edit_int3(void);
 
 #define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) do { if (menu_item_edit_P<int16_t*>(str, pval, minval, maxval)) return; } while (0)
 //#define MENU_ITEM_EDIT_int3_P(str, pval, minval, maxval) MENU_ITEM_EDIT(int3, str, pval, minval, maxval)