diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 74e0b349..53a53d20 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -27,23 +27,6 @@ #endif //TMC2130 -#include - -int lcd_puts_P(const char* str) -{ - return fputs_P(str, lcdout); -} - -int lcd_printf_P(const char* format, ...) -{ - va_list args; - va_start(args, format); - int ret = vfprintf_P(lcdout, format, args); - va_end(args); - return ret; -} - - int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */ extern int lcd_change_fil_state; @@ -315,7 +298,6 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l #endif #endif - /* Helper macros for menus */ #define START_MENU() do { \ if (encoderPosition > 0x8000) encoderPosition = 0; \ @@ -427,6 +409,48 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder = 0, const boo /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */ +#include + +int lcd_puts_P(const char* str) +{ + return fputs_P(str, lcdout); +} + +int lcd_printf_P(const char* format, ...) +{ + va_list args; + va_start(args, format); + int ret = vfprintf_P(lcdout, format, args); + va_end(args); + return ret; +} + +#ifdef DEBUG_MENU_PRINTF_TEST +int menu_item_printf_P(uint8_t& item, uint8_t line, const char* format, ...) +{ + va_list args; + va_start(args, format); + int ret = 0; + if (item == line) + { + if (lcdDrawUpdate) + { + //ret = + lcd.setCursor(0, line); + lcd.print(' '); + int cnt = vfprintf_P(lcdout, format, args); + for (int i = cnt; i < 19; i++) + lcd.print(' '); + lcd.print('>'); + } + } + item++; + va_end(args); + return ret; +} +#endif //DEBUG_MENU_PRINTF_TEST + + static void lcd_status_screen() { if (firstrun == 1) @@ -5589,6 +5613,10 @@ static void lcd_main_menu() MENU_ITEM(submenu, _i("Support"), lcd_support_menu);////MSG_SUPPORT c=0 r=0 MENU_ITEM(submenu, _i("W25x20XL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0 +#ifdef DEBUG_MENU_PRINTF_TEST + menu_item_printf_P(_menuItemNr, _lineNr, _N("Test %d %d %d"), 0, 1, 2); +#endif //DEBUG_MENU_PRINTF_TEST + END_MENU(); } diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index 2cf61d55..4c9f2433 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -149,6 +149,7 @@ //#define DEBUG_BUILD //#define DEBUG_SEC_LANG //secondary language debug output at startup //#define DEBUG_W25X20CL //debug external spi flash +//#define DEBUG_MENU_PRINTF_TEST #ifdef DEBUG_BUILD //#define _NO_ASM #define DEBUG_DCODES //D codes