From 3405f85a6a8a0d9202d9a2ad847ce7f828d9e5a1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 15 Mar 2015 22:02:33 -0700 Subject: [PATCH 01/16] Reduce size of menu code - Get rid of _selected functions, passing selected state instead --- Marlin/dogm_lcd_implementation.h | 104 +++---- Marlin/ultralcd.cpp | 108 ++++--- .../ultralcd_implementation_hitachi_HD44780.h | 288 ++++++------------ 3 files changed, 193 insertions(+), 307 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index c1b5d2b82..c1df1cce4 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -282,7 +282,7 @@ static void lcd_implementation_status_screen() { } static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { - if ((pr_char == '>') || (pr_char == LCD_STR_UPLEVEL[0] )) { + if ((pr_char == '>') || (pr_char == LCD_STR_UPLEVEL[0])) { u8g.setColorIndex(1); // black on white u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT); u8g.setColorIndex(0); // following text must be white on black @@ -293,29 +293,29 @@ static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); } -static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) { +static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { char c; uint8_t n = LCD_WIDTH - 2; - lcd_implementation_mark_as_selected(row, pre_char); + lcd_implementation_mark_as_selected(row, sel ? pre_char : ' '); - while((c = pgm_read_byte(pstr))) { + while ((c = pgm_read_byte(pstr))) { u8g.print(c); pstr++; n--; } - while(n--) u8g.print(' '); + while (n--) u8g.print(' '); u8g.print(post_char); u8g.print(' '); } -static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, const char* data, bool pgm) { +static void _drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, const char* data, bool pgm) { char c; uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data))); - lcd_implementation_mark_as_selected(row, pre_char); + lcd_implementation_mark_as_selected(row, sel ? '>' : ' '); - while( (c = pgm_read_byte(pstr))) { + while ((c = pgm_read_byte(pstr))) { u8g.print(c); pstr++; n--; @@ -325,47 +325,29 @@ static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char p if (pgm) { lcd_printPGM(data); } else { u8g.print(data); } } -#define lcd_implementation_drawmenu_setting_edit_generic(row, pstr, pre_char, data) _drawmenu_setting_edit_generic(row, pstr, pre_char, data, false) -#define lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, pre_char, data) _drawmenu_setting_edit_generic(row, pstr, pre_char, data, true) - -#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float43_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float43(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) -#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) +#define lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, false) +#define lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, data) _drawmenu_setting_edit_generic(sel, row, pstr, data, true) + +#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, itostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr32(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr43(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51(*(data))) +#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) //Add version for callback functions -#define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float43_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float43(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) -#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) +#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, itostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr32(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr43(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) void lcd_implementation_drawedit(const char* pstr, char* value) { uint8_t rows = 1; @@ -396,19 +378,19 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { u8g.print(value); } -static void _drawmenu_sd(uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir, bool isSelected) { +static void _drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) { char c; uint8_t n = LCD_WIDTH - 1; - if (longFilename[0] != '\0') { + if (longFilename[0]) { filename = longFilename; longFilename[n] = '\0'; } - lcd_implementation_mark_as_selected(row, ((isSelected) ? '>' : ' ')); + lcd_implementation_mark_as_selected(row, sel ? '>' : ' '); if (isDir) u8g.print(LCD_STR_FOLDER[0]); - while((c = *filename) != '\0') { + while ((c = *filename)) { u8g.print(c); filename++; n--; @@ -416,19 +398,13 @@ static void _drawmenu_sd(uint8_t row, const char* pstr, const char* filename, ch while(n--) u8g.print(' '); } -#define lcd_implementation_drawmenu_sdfile_selected(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, false, true) -#define lcd_implementation_drawmenu_sdfile(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, false, false) -#define lcd_implementation_drawmenu_sddirectory_selected(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, true, true) -#define lcd_implementation_drawmenu_sddirectory(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, true, false) - -#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) -#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0]) -#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) -#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0]) -#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ') -#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ') -#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ') -#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ') +#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false) +#define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, true) + +#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) +#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) +#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') +#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') static void lcd_implementation_quick_feedback() { #if BEEPER > -1 diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 8575abbd0..6a0d8cf8e 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -116,64 +116,84 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l /* Helper macros for menus */ + +/** + * START_MENU generates the init code for a menu function + */ #define START_MENU() do { \ - encoderRateMultiplierEnabled = false; \ - if (encoderPosition > 0x8000) encoderPosition = 0; \ - if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\ - uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ - bool wasClicked = LCD_CLICKED;\ - for(uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ - _menuItemNr = 0; + encoderRateMultiplierEnabled = false; \ + if (encoderPosition > 0x8000) encoderPosition = 0; \ + uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \ + if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \ + uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ + bool wasClicked = LCD_CLICKED, itemSelected; \ + if (wasClicked) lcd_quick_feedback(); \ + for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ + _menuItemNr = 0; + +/** + * MENU_ITEM generates draw & handler code for a menu item, potentially calling: + * + * lcd_implementation_drawmenu_[type](sel, row, label, arg3...) + * menu_action_[type](arg3...) + * + * Examples: + * MENU_ITEM(back, MSG_WATCH, lcd_status_screen) + * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen) + * menu_action_back(lcd_status_screen) + * + * MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause) + * lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause) + * menu_action_function(lcd_sdcard_pause) + * + * MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999) + * MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999) + * lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999) + * menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999) + * + */ #define MENU_ITEM(type, label, args...) do { \ - if (_menuItemNr == _lineNr) { \ - if (lcdDrawUpdate) { \ - const char* _label_pstr = PSTR(label); \ - if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \ - lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \ - }else{\ - lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \ - }\ - }\ - if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) {\ - lcd_quick_feedback(); \ - menu_action_ ## type ( args ); \ - return;\ - }\ - }\ - _menuItemNr++;\ + if (_menuItemNr == _lineNr) { \ + itemSelected = encoderLine == _menuItemNr; \ + if (lcdDrawUpdate) \ + lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ + if (wasClicked && itemSelected) { \ + menu_action_ ## type(args); \ + return; \ + } \ + } \ + _menuItemNr++; \ } while(0) + #ifdef ENCODER_RATE_MULTIPLIER + /** + * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item + */ #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ if (_menuItemNr == _lineNr) { \ - if (lcdDrawUpdate) { \ - const char* _label_pstr = PSTR(label); \ - if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \ - lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \ - } \ - else { \ - lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \ - } \ - } \ - if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \ - lcd_quick_feedback(); \ + itemSelected = encoderLine == _menuItemNr; \ + if (lcdDrawUpdate) \ + lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ + if (wasClicked && itemSelected) { \ encoderRateMultiplierEnabled = true; \ lastEncoderMovementMillis = 0; \ - menu_action_ ## type ( args ); \ + menu_action_ ## type(args); \ return; \ } \ } \ _menuItemNr++; \ } while(0) #endif //ENCODER_RATE_MULTIPLIER + #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) -#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args ) -#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args ) +#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) +#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #ifdef ENCODER_RATE_MULTIPLIER - #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args ) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args ) + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #else //!ENCODER_RATE_MULTIPLIER - #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args ) - #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args ) + #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) + #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #endif //!ENCODER_RATE_MULTIPLIER #define END_MENU() \ if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \ @@ -461,9 +481,9 @@ static void lcd_tune_menu() { #if TEMP_SENSOR_BED != 0 MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15); #endif - MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); - MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999); - MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999); + MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255); + MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999); + MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999); #if TEMP_SENSOR_1 != 0 MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F1, &extruder_multiply[1], 10, 999); #endif diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 979f23615..1f8bcb826 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -610,214 +610,104 @@ static void lcd_implementation_status_screen() lcd.print(lcd_status_message); } -static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) -{ - char c; - //Use all characters in narrow LCDs - #if LCD_WIDTH < 20 - uint8_t n = LCD_WIDTH - 1 - 1; - #else - uint8_t n = LCD_WIDTH - 1 - 2; - #endif - lcd.setCursor(0, row); - lcd.print(pre_char); - while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) ) - { - lcd.print(c); - pstr++; - if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; - } - while(n--) - lcd.print(' '); - lcd.print(post_char); - lcd.print(' '); + +static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { + char c; + uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2); + lcd.setCursor(0, row); + lcd.print(sel ? pre_char : ' '); + while ((c = pgm_read_byte(pstr)) && n > 0) { + lcd.print(c); + pstr++; + if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; + } + while(n--) lcd.print(' '); + lcd.print(post_char); + lcd.print(' '); } -static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data) -{ - char c; - //Use all characters in narrow LCDs - #if LCD_WIDTH < 20 - uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen(data); - #else - uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen(data); - #endif - lcd.setCursor(0, row); - lcd.print(pre_char); - while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) ) - { - lcd.print(c); - pstr++; - if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; - } - lcd.print(':'); - while(n--) - lcd.print(' '); - lcd.print(data); +static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) { + char c; + uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen(data); + lcd.setCursor(0, row); + lcd.print(sel ? pre_char : ' '); + while ((c = pgm_read_byte(pstr)) && n > 0) { + lcd.print(c); + pstr++; + if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; + } + lcd.print(':'); + while (n--) lcd.print(' '); + lcd.print(data); } -static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data) -{ - char c; - //Use all characters in narrow LCDs - #if LCD_WIDTH < 20 - uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen_P(data); - #else - uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen_P(data); - #endif - lcd.setCursor(0, row); - lcd.print(pre_char); - while( ((c = pgm_read_byte(pstr)) != '\0') && (n>0) ) - { - lcd.print(c); - pstr++; - if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; - } - lcd.print(':'); - while(n--) - lcd.print(' '); - lcd_printPGM(data); +static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* data) { + char c; + uint8_t n = LCD_WIDTH - 1 - (LCD_WIDTH < 20 ? 1 : 2) - lcd_strlen_P(data); + lcd.setCursor(0, row); + lcd.print(sel ? pre_char : ' '); + while ((c = pgm_read_byte(pstr)) && n > 0) { + lcd.print(c); + pstr++; + if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--; + } + lcd.print(':'); + while (n--) lcd.print(' '); + lcd_printPGM(data); } -#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float43_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float43(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) -#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) +#define lcd_implementation_drawmenu_setting_edit_int3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', itostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float3(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float32(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr32(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float43(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr43(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr52(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr51(*(data))) +#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) //Add version for callback functions -#define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float43_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float43(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) -#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) -#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) - - -void lcd_implementation_drawedit(const char* pstr, char* value) -{ - lcd.setCursor(1, 1); - lcd_printPGM(pstr); - lcd.print(':'); - #if LCD_WIDTH < 20 - lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1); - #else - lcd.setCursor(LCD_WIDTH -1 - lcd_strlen(value), 1); - #endif - lcd.print(value); -} -static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) -{ - char c; - uint8_t n = LCD_WIDTH - 1; - lcd.setCursor(0, row); - lcd.print('>'); - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-1] = '\0'; - } - while( ((c = *filename) != '\0') && (n>0) ) - { - lcd.print(c); - filename++; - n--; - } - while(n--) - lcd.print(' '); +#define lcd_implementation_drawmenu_setting_edit_callback_int3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', itostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float3(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr3(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float32(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr32(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float43(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr43(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr52(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr51(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ' ', ftostr5(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) + +void lcd_implementation_drawedit(const char* pstr, char* value) { + lcd.setCursor(1, 1); + lcd_printPGM(pstr); + lcd.print(':'); + lcd.setCursor(LCD_WIDTH - (LCD_WIDTH < 20 ? 0 : 1) - lcd_strlen(value), 1); + lcd.print(value); } -static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename) -{ - char c; - uint8_t n = LCD_WIDTH - 1; - lcd.setCursor(0, row); - lcd.print(' '); - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-1] = '\0'; - } - while( ((c = *filename) != '\0') && (n>0) ) - { - lcd.print(c); - filename++; - n--; - } - while(n--) - lcd.print(' '); +static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat) { + char c; + uint8_t n = LCD_WIDTH - concat; + lcd.setCursor(0, row); + lcd.print(sel ? '>' : ' '); + if (longFilename[0]) { + filename = longFilename; + longFilename[n] = '\0'; + } + while ((c = *filename) && n > 0) { + lcd.print(c); + filename++; + n--; + } + while (n--) lcd.print(' '); } -static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) -{ - char c; - uint8_t n = LCD_WIDTH - 2; - lcd.setCursor(0, row); - lcd.print('>'); - lcd.print(LCD_STR_FOLDER[0]); - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-2] = '\0'; - } - while( ((c = *filename) != '\0') && (n>0) ) - { - lcd.print(c); - filename++; - n--; - } - while(n--) - lcd.print(' '); + +static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) { + lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 1); } -static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename) -{ - char c; - uint8_t n = LCD_WIDTH - 2; - lcd.setCursor(0, row); - lcd.print(' '); - lcd.print(LCD_STR_FOLDER[0]); - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-2] = '\0'; - } - while( ((c = *filename) != '\0') && (n>0) ) - { - lcd.print(c); - filename++; - n--; - } - while(n--) - lcd.print(' '); +static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) { + lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2); } -#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) -#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0]) -#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) -#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0]) -#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ') -#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ') -#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ') -#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ') +#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) +#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) +#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, ' ', ' ') +#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, ' ', ' ') static void lcd_implementation_quick_feedback() { From 7629c4f05c59004759a8e41e8aedd335cff2961f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 15 Mar 2015 22:54:54 -0700 Subject: [PATCH 02/16] Cleanup for menu optimization - Compare pr_char to space - Fewer calls to lcd_strlen --- Marlin/dogm_lcd_implementation.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index c1df1cce4..a488b01b3 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -282,7 +282,7 @@ static void lcd_implementation_status_screen() { } static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { - if ((pr_char == '>') || (pr_char == LCD_STR_UPLEVEL[0])) { + if (pr_char != ' ') { u8g.setColorIndex(1); // black on white u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT); u8g.setColorIndex(0); // following text must be white on black @@ -351,22 +351,22 @@ static void _drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* ps void lcd_implementation_drawedit(const char* pstr, char* value) { uint8_t rows = 1; - uint8_t lcd_width = LCD_WIDTH; - uint8_t char_width = DOG_CHAR_WIDTH; + uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH; + uint8_t vallen = lcd_strlen(value); #ifdef USE_BIG_EDIT_FONT if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { u8g.setFont(FONT_MENU_EDIT); lcd_width = LCD_WIDTH_EDIT + 1; char_width = DOG_CHAR_WIDTH_EDIT; - if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - lcd_strlen(value)) rows = 2; + if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - vallen) rows = 2; } else { u8g.setFont(FONT_MENU); } #endif - if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - lcd_strlen(value)) rows = 2; + if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - vallen) rows = 2; const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2; float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3 @@ -374,7 +374,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { u8g.setPrintPos(0, rowHeight + kHalfChar); lcd_printPGM(pstr); u8g.print(':'); - u8g.setPrintPos((lcd_width-1-lcd_strlen(value)) * char_width, rows * rowHeight + kHalfChar); + u8g.setPrintPos((lcd_width - 1 - vallen) * char_width, rows * rowHeight + kHalfChar); u8g.print(value); } From e6cb8ee1884db31d0a4034ded7f26e928e7b8a22 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 16 Mar 2015 11:18:27 +0100 Subject: [PATCH 03/16] Remove 6x9 font in dogm_lcd_implementation.h by using standard font and shifting down temperature displays by one pixel Saves 2300 bytes. --- Marlin/dogm_lcd_implementation.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index c1b5d2b82..4d835ae85 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -48,7 +48,6 @@ */ #define USE_BIG_EDIT_FONT // save 3120 bytes of PROGMEM by commenting out this line -#define FONT_STATUSMENU u8g_font_6x9 #define FONT_MENU u8g_font_6x10_marlin // DOGM parameters (size in pixels) @@ -66,6 +65,8 @@ #define LCD_WIDTH_EDIT 22 #endif +#define FONT_STATUSMENU FONT_MENU + #define START_ROW 0 /* Custom characters defined in font font_6x10_marlin.c */ @@ -153,10 +154,10 @@ static void _draw_heater_status(int x, int heater) { bool isBed = heater < 0; int y = 17 + (isBed ? 1 : 0); u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(x,6); + u8g.setPrintPos(x,7); u8g.print(itostr3(int((heater >= 0 ? degTargetHotend(heater) : degTargetBed()) + 0.5))); lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - u8g.setPrintPos(x,27); + u8g.setPrintPos(x,28); u8g.print(itostr3(int(heater >= 0 ? degHotend(heater) : degBed()) + 0.5)); lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); if (!isHeatingHotend(0)) { From be79235ef255a5c42fd385820447ec351f23b9b1 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Tue, 17 Mar 2015 10:33:02 +0100 Subject: [PATCH 04/16] Add new (cleaner) Marlin font with sources in /fonts --- Marlin/dogm_font_data_ISO10646_1_Marlin.h | 176 +++++++++++ Marlin/dogm_font_data_marlin.h | 337 ---------------------- Marlin/dogm_lcd_implementation.h | 6 +- Marlin/fonts/ISO10646-1-Marlin.fon | Bin 0 -> 4224 bytes Marlin/fonts/ISO10646-1.fon | Bin 0 -> 4192 bytes Marlin/fonts/Marlin_symbols.fon | Bin 0 -> 784 bytes Marlin/fonts/make_fonts.bat | 8 + 7 files changed, 187 insertions(+), 340 deletions(-) create mode 100644 Marlin/dogm_font_data_ISO10646_1_Marlin.h delete mode 100644 Marlin/dogm_font_data_marlin.h create mode 100644 Marlin/fonts/ISO10646-1-Marlin.fon create mode 100644 Marlin/fonts/ISO10646-1.fon create mode 100644 Marlin/fonts/Marlin_symbols.fon create mode 100644 Marlin/fonts/make_fonts.bat diff --git a/Marlin/dogm_font_data_ISO10646_1_Marlin.h b/Marlin/dogm_font_data_ISO10646_1_Marlin.h new file mode 100644 index 000000000..eeec3b2de --- /dev/null +++ b/Marlin/dogm_font_data_ISO10646_1_Marlin.h @@ -0,0 +1,176 @@ +/* + Fontname: ISO10646-1-Marlin + Copyright: A.Hardtung, public domain + Capital A Height: 7, '1' Height: 7 + Calculated Max Values w= 5 h=10 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 9 + Font Bounding box w= 6 h= 9 x= 0 y=-2 + Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 + Pure Font ascent = 7 descent=-1 + X Font ascent = 7 descent=-1 + Max Font ascent = 8 descent=-2 +*/ +#include +const u8g_fntpgm_uint8_t ISO10646_1_Marlin_5x7[2596] U8G_SECTION(".progmem.ISO10646_1_Marlin_5x7") = { + 0,6,9,0,254,7,1,146,3,33,32,255,255,8,254,7, + 255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128, + 128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6, + 0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32, + 120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32, + 64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104, + 2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32, + 64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32, + 32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5, + 5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192, + 64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192, + 192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6, + 0,0,112,136,136,136,136,136,112,3,7,7,6,1,0,64, + 192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112, + 128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240, + 5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7, + 6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0, + 112,128,128,240,136,136,112,5,7,7,6,0,0,248,8,16, + 32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136, + 112,5,7,7,6,0,0,112,136,136,120,8,8,112,2,5, + 5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192, + 192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64, + 32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1, + 0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136, + 8,16,32,0,32,5,7,7,6,0,0,112,136,8,104,168, + 168,112,5,7,7,6,0,0,112,136,136,248,136,136,136,5, + 7,7,6,0,0,240,136,136,240,136,136,240,5,7,7,6, + 0,0,112,136,128,128,128,136,112,5,7,7,6,0,0,240, + 136,136,136,136,136,240,5,7,7,6,0,0,248,128,128,240, + 128,128,248,5,7,7,6,0,0,248,128,128,240,128,128,128, + 5,7,7,6,0,0,112,136,128,184,136,136,112,5,7,7, + 6,0,0,136,136,136,248,136,136,136,1,7,7,6,2,0, + 128,128,128,128,128,128,128,5,7,7,6,0,0,56,16,16, + 16,16,144,96,5,7,7,6,0,0,136,144,160,192,160,144, + 136,5,7,7,6,0,0,128,128,128,128,128,128,248,5,7, + 7,6,0,0,136,216,168,136,136,136,136,5,7,7,6,0, + 0,136,136,200,168,152,136,136,5,7,7,6,0,0,112,136, + 136,136,136,136,112,5,7,7,6,0,0,240,136,136,240,128, + 128,128,5,7,7,6,0,0,112,136,136,136,168,144,104,5, + 7,7,6,0,0,240,136,136,240,160,144,136,5,7,7,6, + 0,0,120,128,128,112,8,8,240,5,7,7,6,0,0,248, + 32,32,32,32,32,32,5,7,7,6,0,0,136,136,136,136, + 136,136,112,5,7,7,6,0,0,136,136,136,136,136,80,32, + 5,7,7,6,0,0,136,136,136,136,136,168,80,5,7,7, + 6,0,0,136,136,80,32,80,136,136,5,7,7,6,0,0, + 136,136,136,80,32,32,32,5,7,7,6,0,0,248,8,16, + 32,64,128,248,3,7,7,6,1,0,224,128,128,128,128,128, + 224,5,5,5,6,0,1,128,64,32,16,8,3,7,7,6, + 1,0,224,32,32,32,32,32,224,5,3,3,6,0,4,32, + 80,136,5,1,1,6,0,0,248,2,2,2,6,2,5,128, + 64,5,5,5,6,0,0,112,8,120,136,120,5,7,7,6, + 0,0,128,128,176,200,136,136,240,5,5,5,6,0,0,112, + 128,128,136,112,5,7,7,6,0,0,8,8,104,152,136,136, + 120,5,5,5,6,0,0,112,136,248,128,112,5,7,7,6, + 0,0,48,72,224,64,64,64,64,5,6,6,6,0,255,112, + 136,136,120,8,112,5,7,7,6,0,0,128,128,176,200,136, + 136,136,1,7,7,6,2,0,128,0,128,128,128,128,128,3, + 8,8,6,1,255,32,0,32,32,32,32,160,64,4,7,7, + 6,0,0,128,128,144,160,192,160,144,3,7,7,6,1,0, + 192,64,64,64,64,64,224,5,5,5,6,0,0,208,168,168, + 168,168,5,5,5,6,0,0,176,200,136,136,136,5,5,5, + 6,0,0,112,136,136,136,112,5,6,6,6,0,255,240,136, + 136,240,128,128,5,6,6,6,0,255,120,136,136,120,8,8, + 5,5,5,6,0,0,176,200,128,128,128,5,5,5,6,0, + 0,112,128,112,8,240,4,7,7,6,0,0,64,64,224,64, + 64,64,48,5,5,5,6,0,0,136,136,136,152,104,5,5, + 5,6,0,0,136,136,136,80,32,5,5,5,6,0,0,136, + 136,168,168,80,5,5,5,6,0,0,136,80,32,80,136,5, + 6,6,6,0,255,136,136,136,120,8,112,5,5,5,6,0, + 0,248,16,32,64,248,3,7,7,6,1,0,32,64,64,128, + 64,64,32,1,7,7,6,2,0,128,128,128,128,128,128,128, + 3,7,7,6,1,0,128,64,64,32,64,64,128,5,2,2, + 6,0,2,104,144,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0, + 6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0, + 0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0, + 0,1,7,7,6,2,0,128,0,128,128,128,128,128,5,7, + 7,6,0,0,32,112,168,160,168,112,32,5,7,7,6,0, + 0,48,64,64,224,64,80,168,5,5,5,6,0,0,136,112, + 80,112,136,5,7,7,6,0,0,136,80,32,248,32,248,32, + 1,7,7,6,2,0,128,128,128,0,128,128,128,5,8,8, + 6,0,0,48,72,32,80,80,32,144,96,3,1,1,6,1, + 7,160,5,7,7,6,0,0,248,136,184,184,184,136,248,5, + 7,7,6,0,1,112,8,120,136,120,0,248,5,5,5,6, + 0,1,40,80,160,80,40,5,3,3,6,0,1,248,8,8, + 2,2,2,6,2,6,64,128,5,7,7,6,0,0,248,136, + 168,136,152,168,248,5,1,1,6,0,6,248,4,4,4,6, + 0,3,96,144,144,96,5,7,7,6,0,0,32,32,248,32, + 32,0,248,4,5,5,6,0,3,96,144,32,64,240,3,5, + 5,6,0,3,224,32,224,32,224,2,2,2,6,2,6,64, + 128,5,8,8,6,0,255,136,136,136,136,152,232,128,128,5, + 7,7,6,0,0,120,152,152,120,24,24,24,2,2,2,6, + 2,2,192,192,2,2,2,6,2,255,64,128,3,5,5,6, + 0,3,64,192,64,64,224,5,7,7,6,0,1,112,136,136, + 136,112,0,248,5,5,5,6,0,1,160,80,40,80,160,5, + 7,7,6,0,0,136,144,168,88,184,8,8,5,7,7,6, + 0,0,136,144,184,72,152,32,56,5,8,8,6,0,0,192, + 64,192,72,216,56,8,8,5,7,7,6,0,0,32,0,32, + 64,128,136,112,5,8,8,6,0,0,64,32,0,112,136,248, + 136,136,5,8,8,6,0,0,16,32,0,112,136,248,136,136, + 5,8,8,6,0,0,32,80,0,112,136,248,136,136,5,8, + 8,6,0,0,104,144,0,112,136,248,136,136,5,8,8,6, + 0,0,80,0,112,136,136,248,136,136,5,8,8,6,0,0, + 32,80,32,112,136,248,136,136,5,7,7,6,0,0,56,96, + 160,184,224,160,184,5,8,8,6,0,255,112,136,128,128,136, + 112,32,96,5,8,8,6,0,0,64,32,0,248,128,240,128, + 248,5,8,8,6,0,0,8,16,0,248,128,240,128,248,5, + 8,8,6,0,0,32,80,0,248,128,240,128,248,5,7,7, + 6,0,0,80,0,248,128,240,128,248,3,8,8,6,1,0, + 128,64,0,224,64,64,64,224,3,8,8,6,1,0,32,64, + 0,224,64,64,64,224,3,8,8,6,1,0,64,160,0,224, + 64,64,64,224,3,7,7,6,1,0,160,0,224,64,64,64, + 224,5,7,7,6,0,0,112,72,72,232,72,72,112,5,8, + 8,6,0,0,104,144,0,136,200,168,152,136,5,8,8,6, + 0,0,64,32,112,136,136,136,136,112,5,8,8,6,0,0, + 16,32,112,136,136,136,136,112,5,8,8,6,0,0,32,80, + 0,112,136,136,136,112,5,8,8,6,0,0,104,144,0,112, + 136,136,136,112,5,8,8,6,0,0,80,0,112,136,136,136, + 136,112,5,5,5,6,0,1,136,80,32,80,136,5,8,8, + 6,0,255,16,112,168,168,168,168,112,64,5,8,8,6,0, + 0,64,32,136,136,136,136,136,112,5,8,8,6,0,0,16, + 32,136,136,136,136,136,112,5,8,8,6,0,0,32,80,0, + 136,136,136,136,112,5,8,8,6,0,0,80,0,136,136,136, + 136,136,112,5,8,8,6,0,0,16,32,136,80,32,32,32, + 32,5,9,9,6,0,255,192,64,112,72,72,112,64,64,224, + 4,8,8,6,1,255,96,144,144,160,144,144,224,128,5,8, + 8,6,0,0,64,32,0,112,8,120,136,120,5,8,8,6, + 0,0,16,32,0,112,8,120,136,120,5,8,8,6,0,0, + 32,80,0,112,8,120,136,120,5,8,8,6,0,0,104,144, + 0,112,8,120,136,120,5,7,7,6,0,0,80,0,112,8, + 120,136,120,5,8,8,6,0,0,32,80,32,112,8,120,136, + 120,5,6,6,6,0,0,208,40,120,160,168,80,5,6,6, + 6,0,255,112,128,136,112,32,96,5,8,8,6,0,0,64, + 32,0,112,136,248,128,112,5,8,8,6,0,0,16,32,0, + 112,136,248,128,112,5,8,8,6,0,0,32,80,0,112,136, + 248,128,112,5,7,7,6,0,0,80,0,112,136,248,128,112, + 3,8,8,6,1,0,128,64,0,64,192,64,64,224,3,8, + 8,6,1,0,32,64,0,64,192,64,64,224,3,8,8,6, + 1,0,64,160,0,64,192,64,64,224,3,7,7,6,1,0, + 160,0,64,192,64,64,224,5,7,7,6,0,0,160,64,160, + 16,120,136,112,5,8,8,6,0,0,104,144,0,176,200,136, + 136,136,5,8,8,6,0,0,64,32,0,112,136,136,136,112, + 5,8,8,6,0,0,16,32,0,112,136,136,136,112,5,8, + 8,6,0,0,32,80,0,112,136,136,136,112,5,8,8,6, + 0,0,104,144,0,112,136,136,136,112,5,7,7,6,0,0, + 80,0,112,136,136,136,112,5,5,5,6,0,1,32,0,248, + 0,32,5,8,8,6,0,0,64,240,200,136,136,152,120,16, + 5,8,8,6,0,0,192,248,136,136,136,136,136,248,5,5, + 5,6,0,1,32,48,248,48,32,5,8,8,6,0,0,32, + 112,248,32,32,32,32,224,5,9,9,6,0,255,32,112,168, + 168,184,136,136,112,32,5,9,9,6,0,255,224,128,192,176, + 168,40,48,40,40,5,9,9,6,0,255,248,168,136,136,136, + 136,136,168,248,5,10,10,6,0,254,32,80,80,80,80,136, + 168,168,136,112}; diff --git a/Marlin/dogm_font_data_marlin.h b/Marlin/dogm_font_data_marlin.h deleted file mode 100644 index 6b83903cf..000000000 --- a/Marlin/dogm_font_data_marlin.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - Fontname: -Misc-Fixed-Medium-R-Normal--9-90-75-75-C-60-ISO10646-1 - Copyright: Public domain font. Share and enjoy. - Capital A Height: 6, '1' Height: 6 - Calculated Max Values w= 6 h= 9 x= 2 y= 7 dx= 6 dy= 0 ascent= 7 len= 9 - Font Bounding box w= 6 h= 9 x= 0 y=-2 - Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 - Pure Font ascent = 6 descent=-2 - X Font ascent = 6 descent=-2 - Max Font ascent = 7 descent=-2 -*/ -#include -const u8g_fntpgm_uint8_t u8g_font_6x9[2300] U8G_SECTION(".progmem.u8g_font_6x9") = { - 0,6,9,0,254,6,1,137,2,254,32,255,254,7,254,6, - 254,0,0,0,6,0,7,1,6,6,6,2,0,128,128,128, - 128,0,128,3,3,3,6,1,3,160,160,160,5,7,7,6, - 0,255,80,80,248,80,248,80,80,5,9,9,6,0,254,32, - 112,168,160,112,40,168,112,32,6,8,8,6,0,255,64,168, - 72,16,32,72,84,8,5,7,7,6,0,255,96,144,144,96, - 152,144,104,1,3,3,6,2,3,128,128,128,2,7,7,6, - 2,255,64,128,128,128,128,128,64,2,7,7,6,2,255,128, - 64,64,64,64,64,128,5,5,5,6,0,0,136,80,248,80, - 136,5,5,5,6,0,0,32,32,248,32,32,2,4,4,6, - 2,254,192,64,64,128,5,1,1,6,0,2,248,2,2,2, - 6,2,0,192,192,4,6,6,6,1,0,16,16,32,64,128, - 128,4,6,6,6,1,0,96,144,144,144,144,96,3,6,6, - 6,1,0,64,192,64,64,64,224,4,6,6,6,1,0,96, - 144,16,32,64,240,4,6,6,6,1,0,240,32,96,16,16, - 224,5,6,6,6,0,0,16,48,80,144,248,16,4,6,6, - 6,1,0,240,128,224,16,16,224,4,6,6,6,1,0,96, - 128,224,144,144,96,4,6,6,6,1,0,240,16,16,32,64, - 64,4,6,6,6,1,0,96,144,96,144,144,96,4,6,6, - 6,1,0,96,144,144,112,16,96,2,5,5,6,2,0,192, - 192,0,192,192,2,7,7,6,2,254,192,192,0,192,64,64, - 128,5,5,5,6,0,0,24,96,128,96,24,5,3,3,6, - 0,1,248,0,248,5,5,5,6,0,0,192,48,8,48,192, - 4,7,7,6,1,0,96,144,16,96,64,0,64,5,6,6, - 6,0,0,112,144,168,176,128,112,5,6,6,6,0,0,32, - 80,136,248,136,136,5,6,6,6,0,0,240,136,240,136,136, - 240,4,6,6,6,1,0,96,144,128,128,144,96,4,6,6, - 6,1,0,224,144,144,144,144,224,4,6,6,6,1,0,240, - 128,224,128,128,240,4,6,6,6,1,0,240,128,224,128,128, - 128,4,6,6,6,1,0,96,144,128,176,144,96,4,6,6, - 6,1,0,144,144,240,144,144,144,3,6,6,6,1,0,224, - 64,64,64,64,224,5,6,6,6,0,0,56,16,16,16,144, - 96,4,6,6,6,1,0,144,160,192,160,144,144,4,6,6, - 6,1,0,128,128,128,128,128,240,5,6,6,6,0,0,136, - 216,168,168,136,136,4,6,6,6,1,0,144,208,176,144,144, - 144,5,6,6,6,0,0,112,136,136,136,136,112,4,6,6, - 6,1,0,224,144,144,224,128,128,4,7,7,6,1,255,96, - 144,144,208,176,96,16,4,6,6,6,1,0,224,144,144,224, - 144,144,4,6,6,6,1,0,96,144,64,32,144,96,5,6, - 6,6,0,0,248,32,32,32,32,32,4,6,6,6,1,0, - 144,144,144,144,144,96,4,6,6,6,1,0,144,144,144,240, - 96,96,5,6,6,6,0,0,136,136,168,168,216,136,5,6, - 6,6,0,0,136,80,32,32,80,136,5,6,6,6,0,0, - 136,136,80,32,32,32,4,6,6,6,1,0,240,16,32,64, - 128,240,3,6,6,6,1,0,224,128,128,128,128,224,4,6, - 6,6,1,0,128,128,64,32,16,16,3,6,6,6,1,0, - 224,32,32,32,32,224,5,3,3,6,0,3,32,80,136,5, - 1,1,6,0,254,248,2,2,2,6,2,4,128,64,4,4, - 4,6,1,0,112,144,144,112,4,6,6,6,1,0,128,128, - 224,144,144,224,4,4,4,6,1,0,112,128,128,112,4,6, - 6,6,1,0,16,16,112,144,144,112,4,4,4,6,1,0, - 96,176,192,112,4,6,6,6,1,0,32,80,64,224,64,64, - 4,6,6,6,1,254,96,144,144,112,16,96,4,6,6,6, - 1,0,128,128,224,144,144,144,3,6,6,6,1,0,64,0, - 192,64,64,224,3,8,8,6,1,254,32,0,96,32,32,32, - 160,64,4,6,6,6,1,0,128,128,160,192,160,144,3,6, - 6,6,1,0,192,64,64,64,64,224,5,4,4,6,0,0, - 208,168,168,136,4,4,4,6,1,0,224,144,144,144,4,4, - 4,6,1,0,96,144,144,96,4,6,6,6,1,254,224,144, - 144,224,128,128,4,6,6,6,1,254,112,144,144,112,16,16, - 4,4,4,6,1,0,160,208,128,128,4,4,4,6,1,0, - 112,192,48,224,4,6,6,6,1,0,64,64,224,64,80,32, - 4,4,4,6,1,0,144,144,144,112,4,4,4,6,1,0, - 144,144,96,96,5,4,4,6,0,0,136,168,168,80,4,4, - 4,6,1,0,144,96,96,144,4,6,6,6,1,254,144,144, - 144,112,144,96,4,4,4,6,1,0,240,32,64,240,3,7, - 7,6,1,0,32,64,64,128,64,64,32,1,7,7,6,2, - 255,128,128,128,128,128,128,128,3,7,7,6,1,0,128,64, - 64,32,64,64,128,4,2,2,6,1,3,80,160,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0, - 0,6,0,7,1,6,6,6,2,0,128,0,128,128,128,128, - 4,6,6,6,1,255,32,112,160,160,112,32,5,7,7,6, - 0,255,48,72,64,240,64,64,248,5,5,5,6,0,0,168, - 80,136,80,168,5,6,6,6,0,0,136,80,248,32,248,32, - 1,7,7,6,2,255,128,128,128,0,128,128,128,4,7,7, - 6,1,255,112,128,96,144,96,16,224,3,1,1,6,1,5, - 160,6,7,7,6,0,0,120,132,148,164,148,132,120,3,5, - 5,6,1,1,96,160,96,0,224,5,5,5,6,0,0,40, - 80,160,80,40,4,3,3,6,1,0,240,16,16,4,1,1, - 6,1,2,240,6,7,7,6,0,0,120,132,180,164,164,132, - 120,4,1,1,6,1,5,240,4,3,3,6,1,2,96,144, - 96,5,7,7,6,0,255,32,32,248,32,32,0,248,3,5, - 5,6,1,1,64,160,32,64,224,3,5,5,6,1,1,192, - 32,64,32,192,2,2,2,6,2,4,64,128,4,5,5,6, - 1,255,144,144,176,208,128,5,6,6,6,0,0,120,232,232, - 104,40,40,1,1,1,6,2,2,128,2,2,2,6,2,254, - 64,128,3,5,5,6,1,1,64,192,64,64,224,3,5,5, - 6,1,1,64,160,64,0,224,5,5,5,6,0,0,160,80, - 40,80,160,5,8,8,6,0,255,64,192,64,80,112,48,120, - 16,5,8,8,6,0,255,64,192,64,80,104,8,16,56,5, - 8,8,6,0,255,192,32,64,48,240,48,120,16,4,7,7, - 6,1,0,32,0,32,96,128,144,96,5,7,7,6,0,0, - 64,32,32,80,112,136,136,5,7,7,6,0,0,16,32,32, - 80,112,136,136,5,7,7,6,0,0,32,80,32,80,112,136, - 136,5,7,7,6,0,0,40,80,32,80,112,136,136,5,7, - 7,6,0,0,80,0,32,80,112,136,136,5,7,7,6,0, - 0,32,80,32,80,112,136,136,5,6,6,6,0,0,120,160, - 240,160,160,184,4,8,8,6,1,254,96,144,128,128,144,96, - 32,64,4,7,7,6,1,0,64,32,240,128,224,128,240,4, - 7,7,6,1,0,32,64,240,128,224,128,240,4,7,7,6, - 1,0,32,80,240,128,224,128,240,4,7,7,6,1,0,80, - 0,240,128,224,128,240,3,7,7,6,1,0,128,64,224,64, - 64,64,224,3,7,7,6,1,0,32,64,224,64,64,64,224, - 3,7,7,6,1,0,64,160,224,64,64,64,224,3,7,7, - 6,1,0,160,0,224,64,64,64,224,5,6,6,6,0,0, - 112,72,232,72,72,112,4,7,7,6,1,0,80,160,144,208, - 176,144,144,4,7,7,6,1,0,64,32,96,144,144,144,96, - 4,7,7,6,1,0,32,64,96,144,144,144,96,4,7,7, - 6,1,0,32,80,96,144,144,144,96,4,7,7,6,1,0, - 80,160,96,144,144,144,96,4,7,7,6,1,0,80,0,96, - 144,144,144,96,5,5,5,6,0,0,136,80,32,80,136,4, - 8,8,6,1,255,16,112,176,176,208,208,224,128,4,7,7, - 6,1,0,64,32,144,144,144,144,96,4,7,7,6,1,0, - 32,64,144,144,144,144,96,4,7,7,6,1,0,32,80,144, - 144,144,144,96,4,7,7,6,1,0,80,0,144,144,144,144, - 96,5,7,7,6,0,0,16,32,136,80,32,32,32,4,6, - 6,6,1,0,128,224,144,144,224,128,4,6,6,6,1,0, - 96,144,160,160,144,160,4,7,7,6,1,0,64,32,0,112, - 144,144,112,4,7,7,6,1,0,32,64,0,112,144,144,112, - 4,7,7,6,1,0,32,80,0,112,144,144,112,4,7,7, - 6,1,0,80,160,0,112,144,144,112,4,6,6,6,1,0, - 80,0,112,144,144,112,4,7,7,6,1,0,32,80,32,112, - 144,144,112,5,4,4,6,0,0,112,168,176,120,4,6,6, - 6,1,254,112,128,128,112,32,64,4,7,7,6,1,0,64, - 32,0,96,176,192,112,4,7,7,6,1,0,32,64,0,96, - 176,192,112,4,7,7,6,1,0,32,80,0,96,176,192,112, - 4,6,6,6,1,0,80,0,96,176,192,112,3,7,7,6, - 1,0,128,64,0,192,64,64,224,3,7,7,6,1,0,32, - 64,0,192,64,64,224,3,7,7,6,1,0,64,160,0,192, - 64,64,224,3,6,6,6,1,0,160,0,192,64,64,224,4, - 7,7,6,1,0,48,96,16,112,144,144,96,4,7,7,6, - 1,0,80,160,0,224,144,144,144,4,7,7,6,1,0,64, - 32,0,96,144,144,96,4,7,7,6,1,0,32,64,0,96, - 144,144,96,4,7,7,6,1,0,32,80,0,96,144,144,96, - 4,7,7,6,1,0,80,160,0,96,144,144,96,4,6,6, - 6,1,0,80,0,96,144,144,96,5,5,5,6,0,0,32, - 0,248,0,32,4,4,4,6,1,0,112,176,208,224,4,7, - 7,6,1,0,64,32,0,144,144,144,112,4,7,7,6,1, - 0,32,64,0,144,144,144,112,4,7,7,6,1,0,32,80, - 0,144,144,144,112,4,6,6,6,1,0,80,0,144,144,144, - 112,4,9,9,6,1,254,32,64,0,144,144,144,112,144,96, - 4,8,8,6,1,254,128,128,224,144,144,224,128,128,4,8, - 8,6,1,254,80,0,144,144,144,112,144,96}; - -// STB Marlin -/* - Fontname: u8g_font_6x10_marlin - Copyright: Public domain terminal emulator font. Share and enjoy. - Capital A Height: 7, '1' Height: 7 - Calculated Max Values w= 6 h=10 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len=10 - Font Bounding box w= 6 h= 9 x= 0 y=-2 - Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 - Pure Font ascent = 7 descent=-2 - X Font ascent = 7 descent=-2 - Max Font ascent = 8 descent=-2 -*/ -#include -const u8g_fntpgm_uint8_t u8g_font_6x10_marlin[2617] U8G_SECTION(".progmem.u8g_font_6x10_marlin") = { - 0,6,9,0,254,7,1,153,3,43,32,255,254,8,254,7, - 254,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128, - 128,128,0,128,3,3,3,6,1,4,160,160,160,5,7,7, - 6,0,0,80,80,248,80,248,80,80,5,7,7,6,0,0, - 32,112,160,112,40,112,32,5,7,7,6,0,0,72,168,80, - 32,80,168,144,5,7,7,6,0,0,64,160,160,64,168,144, - 104,1,3,3,6,2,4,128,128,128,3,7,7,6,1,0, - 32,64,128,128,128,64,32,3,7,7,6,1,0,128,64,32, - 32,32,64,128,5,5,5,6,0,1,136,80,248,80,136,5, - 5,5,6,0,1,32,32,248,32,32,3,3,3,6,1,255, - 96,64,128,5,1,1,6,0,3,248,3,3,3,6,1,255, - 64,224,64,5,7,7,6,0,0,8,8,16,32,64,128,128, - 5,7,7,6,0,0,32,80,136,136,136,80,32,5,7,7, - 6,0,0,32,96,160,32,32,32,248,5,7,7,6,0,0, - 112,136,8,48,64,128,248,5,7,7,6,0,0,248,8,16, - 48,8,136,112,5,7,7,6,0,0,16,48,80,144,248,16, - 16,5,7,7,6,0,0,248,128,176,200,8,136,112,5,7, - 7,6,0,0,48,64,128,176,200,136,112,5,7,7,6,0, - 0,248,8,16,16,32,64,64,5,7,7,6,0,0,112,136, - 136,112,136,136,112,5,7,7,6,0,0,112,136,152,104,8, - 16,96,3,7,7,6,1,255,64,224,64,0,64,224,64,3, - 7,7,6,1,255,64,224,64,0,96,64,128,4,7,7,6, - 1,0,16,32,64,128,64,32,16,5,3,3,6,0,2,248, - 0,248,4,7,7,6,1,0,128,64,32,16,32,64,128,5, - 7,7,6,0,0,112,136,16,32,32,0,32,5,7,7,6, - 0,0,112,136,152,168,176,128,112,5,7,7,6,0,0,32, - 80,136,136,248,136,136,5,7,7,6,0,0,240,72,72,112, - 72,72,240,5,7,7,6,0,0,112,136,128,128,128,136,112, - 5,7,7,6,0,0,240,72,72,72,72,72,240,5,7,7, - 6,0,0,248,128,128,240,128,128,248,5,7,7,6,0,0, - 248,128,128,240,128,128,128,5,7,7,6,0,0,112,136,128, - 128,152,136,112,5,7,7,6,0,0,136,136,136,248,136,136, - 136,3,7,7,6,1,0,224,64,64,64,64,64,224,5,7, - 7,6,0,0,56,16,16,16,16,144,96,5,7,7,6,0, - 0,136,144,160,192,160,144,136,5,7,7,6,0,0,128,128, - 128,128,128,128,248,5,7,7,6,0,0,136,136,216,168,136, - 136,136,5,7,7,6,0,0,136,136,200,168,152,136,136,5, - 7,7,6,0,0,112,136,136,136,136,136,112,5,7,7,6, - 0,0,240,136,136,240,128,128,128,5,8,8,6,0,255,112, - 136,136,136,136,168,112,8,5,7,7,6,0,0,240,136,136, - 240,160,144,136,5,7,7,6,0,0,112,136,128,112,8,136, - 112,5,7,7,6,0,0,248,32,32,32,32,32,32,5,7, - 7,6,0,0,136,136,136,136,136,136,112,5,7,7,6,0, - 0,136,136,136,80,80,80,32,5,7,7,6,0,0,136,136, - 136,168,168,216,136,5,7,7,6,0,0,136,136,80,32,80, - 136,136,5,7,7,6,0,0,136,136,80,32,32,32,32,5, - 7,7,6,0,0,248,8,16,32,64,128,248,3,7,7,6, - 1,0,224,128,128,128,128,128,224,5,7,7,6,0,0,128, - 128,64,32,16,8,8,3,7,7,6,1,0,224,32,32,32, - 32,32,224,5,3,3,6,0,4,32,80,136,5,1,1,6, - 0,255,248,2,2,2,6,2,6,128,64,5,5,5,6,0, - 0,112,8,120,136,120,5,7,7,6,0,0,128,128,176,200, - 136,200,176,5,5,5,6,0,0,112,136,128,136,112,5,7, - 7,6,0,0,8,8,104,152,136,152,104,5,5,5,6,0, - 0,112,136,248,128,112,5,7,7,6,0,0,48,72,64,240, - 64,64,64,5,7,7,6,0,254,120,136,136,120,8,136,112, - 5,7,7,6,0,0,128,128,176,200,136,136,136,3,7,7, - 6,1,0,64,0,192,64,64,64,224,4,9,9,6,1,254, - 16,0,48,16,16,16,144,144,96,5,7,7,6,0,0,128, - 128,136,144,224,144,136,3,7,7,6,1,0,192,64,64,64, - 64,64,224,5,5,5,6,0,0,208,168,168,168,136,5,5, - 5,6,0,0,176,200,136,136,136,5,5,5,6,0,0,112, - 136,136,136,112,5,7,7,6,0,254,176,200,136,200,176,128, - 128,5,7,7,6,0,254,104,152,136,152,104,8,8,5,5, - 5,6,0,0,176,200,128,128,128,5,5,5,6,0,0,112, - 128,112,8,240,5,7,7,6,0,0,64,64,240,64,64,72, - 48,5,5,5,6,0,0,136,136,136,152,104,5,5,5,6, - 0,0,136,136,80,80,32,5,5,5,6,0,0,136,136,168, - 168,80,5,5,5,6,0,0,136,80,32,80,136,5,7,7, - 6,0,254,136,136,152,104,8,136,112,5,5,5,6,0,0, - 248,16,32,64,248,4,7,7,6,1,0,48,64,32,192,32, - 64,48,1,7,7,6,2,0,128,128,128,128,128,128,128,4, - 7,7,6,1,0,192,32,64,48,64,32,192,5,3,3,6, - 0,4,72,168,144,0,0,0,1,0,0,0,0,0,1,0, - 0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0, - 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0, - 0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0, - 0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0, - 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0, - 0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0, - 0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0, - 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0, - 0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0, - 0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0, - 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0, - 0,0,1,0,0,0,0,0,1,0,0,0,0,0,6,0, - 0,1,7,7,6,2,0,128,0,128,128,128,128,128,5,7, - 7,6,0,255,32,120,160,160,160,120,32,5,7,7,6,0, - 0,48,72,64,224,64,72,176,5,5,5,6,0,0,136,112, - 80,112,136,5,8,8,6,0,255,136,136,80,32,248,32,32, - 32,1,7,7,6,2,0,128,128,128,0,128,128,128,5,8, - 8,6,0,255,112,128,224,144,72,56,8,112,3,1,1,6, - 1,7,160,5,7,7,6,0,0,112,136,168,200,168,136,112, - 4,6,6,6,1,1,112,144,176,80,0,240,6,5,5,6, - 0,0,36,72,144,72,36,4,2,2,6,1,2,240,16,4, - 1,1,6,1,3,240,5,7,7,6,0,0,112,136,232,200, - 200,136,112,5,1,1,6,0,7,248,3,3,3,6,1,4, - 64,160,64,5,6,6,6,0,0,32,32,248,32,32,248,4, - 5,5,6,1,3,96,144,32,64,240,4,5,5,6,1,3, - 224,16,96,16,224,2,2,2,6,2,6,64,128,5,6,6, - 6,0,255,136,136,136,200,176,128,5,7,7,6,0,0,120, - 232,232,104,40,40,40,1,1,1,6,2,3,128,2,2,2, - 6,2,254,64,128,3,5,5,6,1,3,64,192,64,64,224, - 4,6,6,6,1,1,96,144,144,96,0,240,6,5,5,6, - 0,0,144,72,36,72,144,6,9,9,6,0,255,64,192,64, - 64,228,12,20,60,4,6,9,9,6,0,255,64,192,64,64, - 232,20,4,8,28,5,9,9,6,0,255,192,32,64,32,200, - 24,40,120,8,5,7,7,6,0,0,32,0,32,32,64,136, - 112,5,8,8,6,0,0,64,32,112,136,136,248,136,136,5, - 8,8,6,0,0,16,32,112,136,136,248,136,136,5,8,8, - 6,0,0,32,80,112,136,136,248,136,136,5,8,8,6,0, - 0,72,176,112,136,136,248,136,136,5,8,8,6,0,0,80, - 0,112,136,136,248,136,136,5,8,8,6,0,0,32,80,112, - 136,136,248,136,136,6,7,7,6,0,0,60,80,144,156,240, - 144,156,5,9,9,6,0,254,112,136,128,128,128,136,112,32, - 64,5,8,8,6,0,0,64,248,128,128,240,128,128,248,5, - 8,8,6,0,0,16,248,128,128,240,128,128,248,5,8,8, - 6,0,0,32,248,128,128,240,128,128,248,5,8,8,6,0, - 0,80,248,128,128,240,128,128,248,3,8,8,6,1,0,128, - 64,224,64,64,64,64,224,3,8,8,6,1,0,32,64,224, - 64,64,64,64,224,3,8,8,6,1,0,64,160,224,64,64, - 64,64,224,3,8,8,6,1,0,160,0,224,64,64,64,64, - 224,5,7,7,6,0,0,240,72,72,232,72,72,240,5,8, - 8,6,0,0,40,80,136,200,168,152,136,136,5,8,8,6, - 0,0,64,32,112,136,136,136,136,112,5,8,8,6,0,0, - 16,32,112,136,136,136,136,112,5,8,8,6,0,0,32,80, - 112,136,136,136,136,112,5,8,8,6,0,0,40,80,112,136, - 136,136,136,112,5,8,8,6,0,0,80,0,112,136,136,136, - 136,112,5,5,5,6,0,0,136,80,32,80,136,5,7,7, - 6,0,0,112,152,152,168,200,200,112,5,8,8,6,0,0, - 64,32,136,136,136,136,136,112,5,8,8,6,0,0,16,32, - 136,136,136,136,136,112,5,8,8,6,0,0,32,80,0,136, - 136,136,136,112,5,8,8,6,0,0,80,0,136,136,136,136, - 136,112,5,8,8,6,0,0,16,32,136,136,80,32,32,32, - 5,7,7,6,0,0,128,240,136,240,128,128,128,5,7,7, - 6,0,0,112,136,144,160,144,136,176,5,8,8,6,0,0, - 64,32,0,112,8,120,136,120,5,8,8,6,0,0,16,32, - 0,112,8,120,136,120,5,8,8,6,0,0,32,80,0,112, - 8,120,136,120,5,8,8,6,0,0,40,80,0,112,8,120, - 136,120,5,7,7,6,0,0,80,0,112,8,120,136,120,5, - 8,8,6,0,0,32,80,32,112,8,120,136,120,6,5,5, - 6,0,0,120,20,124,144,124,5,7,7,6,0,254,112,136, - 128,136,112,32,64,5,8,8,6,0,0,64,32,0,112,136, - 248,128,112,5,8,8,6,0,0,16,32,0,112,136,248,128, - 112,5,8,8,6,0,0,32,80,0,112,136,248,128,112,5, - 7,7,6,0,0,80,0,112,136,248,128,112,3,8,8,6, - 1,0,128,64,0,192,64,64,64,224,3,8,8,6,1,0, - 64,128,0,192,64,64,64,224,3,8,8,6,1,0,64,160, - 0,192,64,64,64,224,6,10,10,6,0,254,164,168,0,252, - 132,128,128,128,132,252,6,10,10,6,0,254,84,148,0,252, - 132,4,4,4,132,252,5,8,8,6,0,0,40,80,0,176, - 200,136,136,136,5,8,8,6,0,0,64,32,0,112,136,136, - 136,112,4,10,10,6,2,254,48,64,128,144,144,144,144,144, - 144,144,4,10,10,6,0,254,192,32,16,144,144,144,144,144, - 144,144,6,7,7,6,0,1,68,140,140,132,128,64,60,6, - 7,7,6,0,1,136,196,196,132,4,8,240,5,5,5,6, - 0,1,32,0,248,0,32,5,8,8,6,0,0,64,240,200, - 136,136,152,120,16,5,8,8,6,0,0,224,248,136,136,136, - 136,136,248,5,5,5,6,0,1,32,48,248,48,32,5,8, - 8,6,0,0,32,112,248,32,32,32,32,224,5,9,9,6, - 0,255,32,112,168,168,184,136,136,80,32,5,9,9,6,0, - 255,224,128,192,176,168,168,48,40,40,5,9,9,6,0,255, - 248,168,136,136,136,136,136,168,248,5,10,10,6,0,254,32, - 80,80,80,80,136,168,168,136,112}; - diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 4d835ae85..b60d68936 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -32,7 +32,7 @@ #include #include "DOGMbitmaps.h" -#include "dogm_font_data_marlin.h" +#include "dogm_font_data_ISO10646_1_Marlin.h" #include "ultralcd.h" #include "ultralcd_st7920_u8glib_rrd.h" @@ -48,7 +48,7 @@ */ #define USE_BIG_EDIT_FONT // save 3120 bytes of PROGMEM by commenting out this line -#define FONT_MENU u8g_font_6x10_marlin +#define FONT_MENU ISO10646_1_Marlin_5x7 // DOGM parameters (size in pixels) #define DOG_CHAR_WIDTH 6 @@ -59,7 +59,7 @@ #define DOG_CHAR_HEIGHT_EDIT 18 #define LCD_WIDTH_EDIT 14 #else - #define FONT_MENU_EDIT u8g_font_6x10_marlin + #define FONT_MENU_EDIT ISO10646_1_Marlin_5x7 #define DOG_CHAR_WIDTH_EDIT 6 #define DOG_CHAR_HEIGHT_EDIT 12 #define LCD_WIDTH_EDIT 22 diff --git a/Marlin/fonts/ISO10646-1-Marlin.fon b/Marlin/fonts/ISO10646-1-Marlin.fon new file mode 100644 index 0000000000000000000000000000000000000000..e9e4cfc2cafd065e08c4bef980876ecddf743888 GIT binary patch literal 4224 zcmeH|e`r-@7{}k4&ZFr#g~SM}SCP2H9A^<@iNr}%uA=jxqeMdPY}OWQJ6)$;BH~aH zN0GRQ$VEghA#sq95fT@P7!fg|LL_2@#E1~Fh!ql-i0pYj@3~uG`B(H;@7X^0d!P5m z^Ssadp6Bk|_p@m;#w?cqTepm9$fvdt-WiE>cRX~d!(3eU#hOOjjxW{>438YLae4gt z^5BcMeDI~iBjtmK?9P#A%j1W}pPR5xkBkkCzkH~B&mQUN4%~vmHjVwRtizZm zyNiS6p^3v|&v)7Q@PW~hXYJ7Vi-T_Q`SJfGJX4aVwJlR^Yil>ljcJ$1-ZD00-d9WV z>9>WouZT6}mvTnD>hAKV0Yz^7mdz5plSYcPc; z;2HQXoP?L)C-6%+1HXem!e60Ts!=V6tKfsM03U@L;Z_*IeQ*el!3umG9*3u39iE35 z;YV;9UV&HPH8=-;cmX!x$MAFb zHJpVv;7#}k^p*~ODskf)E-D$6uc84^y&- zH!NGzUfoGE(e;Ajth!T^?ylmA(alvqaz6Qve4`QQMv{aCN^glyA~lyYX<{=*{kj-6 zTdr5LMFLGleRyu1%c;f}bN|9nV+mMArq+gAiu`E?Gx8@&6WHn{X6|vQ*^pZrT2exI zoW2^w%nUPJb)Wz9U(dk8eX(&?&tfYc0zK9!!&e$dv7VcpUsE1Yaz^~iMYK_5^$m^0 zoVRA$Xf#qeRd=oRc#SDU^{CJqz+Lif{#9;4nx(Z&2fD%9QL6Idi*lt?dP-Fr&S{^S zweq0;vWnckw02!@Y^7GKbar+!Ag`-V%RMvUlk6Olc$NF~r^GfGB8!^-C zOs)#dzqEd=#Uc)66~tj)x)}9(S1lP zd3Ds7TRU$le2|TW{K+c$IEg{7w4}gAR!Nv zctpe?B14D_5%LHLiHJcYmJkt1Swcc2WDyCGh)qO>2<@EDy|Zgb{uTYzeY2lAbMBAx zz31L{cHOq$O^Y#RlKee-WK3PYwMFphNTqw`i|1yVZ>C;(sot{o%1fJjdiUF8pnvzk zj(v9E-S-ak4!pbHuIqhgpnre=u0i`&Z(n!+`};d)Oq=JIUcYMcvLh%kCiw8lc(00* z$PAhz@=R2rD4h`akrOAGDJgFAyqRj^=?m!yyl<|#YYKB)Qa5_a>J95RuUxZn+L}!p zItxn{FL|v~J6=)u##NhaXQ8n0^(FGLOYQg&+hq@Sb`;zaqEw=w2 z)-s}+o_#{bwHBis&m!2}+HN8zWi3O|Qu;J0uHUWV7; zO?U_1gMY$SxgxD5gmd6L*a5rX3b+<-fhD*H4#LAQgU8@Wcp9FC=imi+6<&w8;IHrj zlvhnuO@p)G3$Pt7g3I7)7{hI_8}`96JOV#~CtwYJ3BQ5g!AtN*_%r+kj>13SBwnML zunoQp7s4elf^Wjj@NL)w2jB!Yce6o`K)OA$S>HgE!$Fcn|&wTW4_p;T$**cEB#U0jnsd+|8N$30k*?Ma2Z?;W4H}=!#-GsN8l&$gzz7# zz13!{RN6RhmfJXP$fG}Pxt6q#YVXjc&_>lZu}YO%lvjGxvXM}m^hJ>k#S(_{OPw}P za;t{1wjn{9tq?l9(R9dnfq#X8%uLmrWZDw3Y)J*Gm1IGZraGw++As)4#R>~?r4fee zOGkr%88T?p&27kf(xg|`(~q;tL7)~vU0e;1Dvj^4|1>WAJmO^GHBY3gf;Dz6?Zb>r$zl??K$s9G}V<| z&vj|FvP*dtOSULYRjCjeD3JT?GOi#sq z|IdFt1LOC_CV4GStVAg2vBo*EvLsIQ+~oWk@`xp8#GhP58^>1P&{*8QHL`lWp2?}Y zYpus?OnY35+nWQpOQH2Y}6r3NOA`u5?OIsbZs1?K2}*9<0Y!k=vJ5 z@92#!SF7c=wl)U%y6SAXXC@kwz46msbr(|9#WnS2m3(U*fmx+qtlBOq{LxVHdKW&~ zcSK!_tiFx<&d8G9vT@Ur+vTC$$^ zNqW7daV7nUi|Z_n>ns`9w31@+PO&KCL<{9n%ed}X-|leC(z(uuW_q2=Re`aWHcYfw zB$2G5i?~&qmaO7^&hWjlsIr9ZT9_sPm3}fd++Y^efNHT-j~Z9e*gyn9`X){09|rYNiv)c1__5& z9z*cp?}xkGK|frqNg67ue6E%nsEQYtk}7JLk;Zo-#HM7%U z3;=xBlk?UIlO*WSA?l?>8B>>Ul*I;f~06*k{Q5Nuxe9OcuEOCaD?M)wMi+lU| zP^P5TrRIs&Zk)+=jRs>hlus2fE(p=B4f5bN78J28mFie<@~|qa=#)DBC~}m$J3(Mq z6-&BU!Iq@gFfBLR7>^}lo8PHZEgzf`9j^s99LGZdfG5iN=?9hPaf`_X#*u&L@sV#VRZtFh|6+EK?!>_+64z{*+Jfs(i=* literal 0 HcmV?d00001 diff --git a/Marlin/fonts/make_fonts.bat b/Marlin/fonts/make_fonts.bat new file mode 100644 index 000000000..4684ffa63 --- /dev/null +++ b/Marlin/fonts/make_fonts.bat @@ -0,0 +1,8 @@ +.\bdf2u8g.exe -b 1 -e 9 Marlin_symbols.bdf Marlin_symbols dogm_font_data_Marlin_symbols.h +.\bdf2u8g.exe -b 16 -e 255 HD44780_W.bdf HD44780_W_5x7 dogm_font_data_HD44780_W.h +.\bdf2u8g.exe -b 32 -e 255 HD44780_C.bdf HD44780_C_5x7 dogm_font_data_HD44780_C.h +.\bdf2u8g.exe -b 32 -e 255 HD44780_J.bdf HD44780_J_5x7 dogm_font_data_HD44780_J.h +.\bdf2u8g.exe -b 32 -e 255 ISO10646-1.bdf ISO10646_1_5x7 dogm_font_data_ISO10646_1.h +.\bdf2u8g.exe -b 32 -e 255 ISO10646-1-Marlin.bdf ISO10646_1_Marlin_5x7 dogm_font_data_ISO10646_1_Marlin.h +.\bdf2u8g.exe -b 32 -e 255 ISO10646_5_Cyrillic.bdf ISO10646_5_Cyrillic_5x7 dogm_font_data_ISO10646_5_Cyrillic.h +.\bdf2u8g.exe -b 32 -e 255 ISO10646_Kana.bdf ISO10646_Kana_5x7 dogm_font_data_ISO10646_Kana.h From 00adb2a6c16f90c1a59a679307c98c415e220f23 Mon Sep 17 00:00:00 2001 From: Wurstnase Date: Wed, 18 Mar 2015 01:02:29 +0100 Subject: [PATCH 05/16] optional parameters must be named when ignoring order --- Marlin/Marlin_main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5ad45ef2e..1ba680d21 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2330,9 +2330,9 @@ inline void gcode_G28() { z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract, verbose_level); } else { - z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level); - z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level); - z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level); + z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level=verbose_level); + z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level); + z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level); } clean_up_after_endstop_move(); set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3); From d1658eebfc9373e92fcab372a7fe0f3978ef143d Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 18 Mar 2015 01:45:42 +0100 Subject: [PATCH 06/16] Decrease KILL_DELAY Users hat to press kill-button for unexpexted lon times. See #1593 --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5ad45ef2e..5ad44e5e2 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5574,7 +5574,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #if defined(KILL_PIN) && KILL_PIN > -1 static int killCount = 0; // make the inactivity button a bit less responsive - const int KILL_DELAY = 10000; + const int KILL_DELAY = 750; #endif #if defined(FILRUNOUT_PIN) && FILRUNOUT_PIN > -1 @@ -5585,7 +5585,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #if defined(HOME_PIN) && HOME_PIN > -1 static int homeDebounceCount = 0; // poor man's debouncing count - const int HOME_DEBOUNCE_DELAY = 10000; + const int HOME_DEBOUNCE_DELAY = 750; #endif From 450b89e63c50bd65be16e4d6ff119ed08b9358f6 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 18 Mar 2015 10:31:34 +0100 Subject: [PATCH 07/16] Negative times are unlikly While bunting an other bug I stumbled across: ultralcd.cpp:1250: warning: comparison between signed and unsigned integer expressions Changed to the type of lcd_next_update_millis. --- Marlin/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 8575abbd0..15267a1f1 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1246,7 +1246,7 @@ void lcd_update() { } #endif//CARDINSERTED - long ms = millis(); + uint32_t ms = millis(); if (ms > lcd_next_update_millis) { #ifdef ULTIPANEL From 5d81c779cced18d533c1ebd0c33efbaa20ae6b5b Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 18 Mar 2015 10:39:59 +0100 Subject: [PATCH 08/16] lcd_control_retract_menu() is conditional. Got: ultralcd.cpp:64: warning: 'void lcd_control_retract_menu()' declared 'static' but never defined --- Marlin/ultralcd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 8575abbd0..4be930106 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -61,7 +61,9 @@ static void lcd_control_volumetric_menu(); #ifdef DOGLCD static void lcd_set_contrast(); #endif +#ifdef FWRETRACT static void lcd_control_retract_menu(); +#endif static void lcd_sdcard_menu(); #ifdef DELTA_CALIBRATION_MENU From 5099b86ad430e475a6aace4cc1cc7007bb7d4633 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 18 Mar 2015 10:51:13 +0100 Subject: [PATCH 09/16] lcd_autostart_sd() has two conditions. got: ultralcd.cpp:408: warning: 'void lcd_autostart_sd()' defined but not used --- Marlin/ultralcd.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 8575abbd0..c05532f91 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -402,7 +402,7 @@ static void lcd_main_menu() { END_MENU(); } -#ifdef SDSUPPORT +#if defined( SDSUPPORT ) && defined( MENU_ADDAUTOSTART ) static void lcd_autostart_sd() { card.autostart_index = 0; card.setroot(); @@ -587,10 +587,8 @@ void lcd_cooldown() { static void lcd_prepare_menu() { START_MENU(); MENU_ITEM(back, MSG_MAIN, lcd_main_menu); - #ifdef SDSUPPORT - #ifdef MENU_ADDAUTOSTART - MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd); - #endif + #if defined( SDSUPPORT ) && defined( MENU_ADDAUTOSTART ) + MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd); #endif MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); From e90985a4e818d3ce07a217a26cafde40fbbb2237 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 18 Mar 2015 11:11:49 +0100 Subject: [PATCH 10/16] delta[3] not used when DELTA not defined. got: Marlin_main.cpp:387: warning: 'delta' defined but not used Compiles cleaner when definition is removed. --- Marlin/Marlin_main.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5ad45ef2e..7e3d19893 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -383,10 +383,6 @@ const char echomagic[] PROGMEM = "echo:"; const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'}; static float destination[NUM_AXIS] = { 0, 0, 0, 0 }; -#ifndef DELTA - static float delta[3] = { 0, 0, 0 }; -#endif - static float offset[3] = { 0, 0, 0 }; static bool home_all_axis = true; static float feedrate = 1500.0, next_feedrate, saved_feedrate; From b94dd336410f522566a7acea3305903653ff5109 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 18 Mar 2015 11:23:41 +0100 Subject: [PATCH 11/16] G4 could wait for an undefined time Got: Marlin_main.cpp:1689: warning: 'codenum' may be used uninitialized in this function And indeed codenum is undefined when no parameter is given. --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5ad45ef2e..61d4247d8 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1690,7 +1690,7 @@ inline void gcode_G2_G3(bool clockwise) { * G4: Dwell S or P */ inline void gcode_G4() { - unsigned long codenum; + unsigned long codenum=0; LCD_MESSAGEPGM(MSG_DWELL); From f8c4d438869927c824968eb87dc090faf22ecd52 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Wed, 18 Mar 2015 12:14:49 +0100 Subject: [PATCH 12/16] delta[3] is used with SCARA Shoot in the dark. --- Marlin/Marlin_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7e3d19893..6b73f7cc3 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -357,6 +357,7 @@ int fanSpeed = 0; #ifdef SCARA float axis_scaling[3] = { 1, 1, 1 }; // Build size scaling, default to 1 + static float delta[3] = { 0, 0, 0 }; #endif bool cancel_heatup = false; From e650d4044ede9b8e44bf84e9bea6b257b0503d8d Mon Sep 17 00:00:00 2001 From: alexborro Date: Thu, 19 Mar 2015 14:16:18 -0300 Subject: [PATCH 13/16] Fix "Stop Print" function in the LCD menu When one hit "Stop Print" option in LCD menu, the command buffer was not cleared. The printer keep moving until the buffer has been emptied. Actually I could not clear the command buffer as well.. I don't know why, it doesnt work as expected. I need to implement a routine inside Stepper ISR to handle such situation. --- Marlin/cardreader.cpp | 1 - Marlin/stepper.cpp | 13 +++++++++++++ Marlin/ultralcd.cpp | 7 +------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index a51d77bf0..125caab01 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -504,7 +504,6 @@ void CardReader::printingHasFinished() { startFileprint(); } else { - quickStop(); file.close(); sdprinting = false; if (SD_FINISHED_STEPPERRELEASE) { diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index e9c58e9f4..1c79ea3b4 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -46,6 +46,7 @@ block_t *current_block; // A pointer to the block currently being traced // Variables used by The Stepper Driver Interrupt static unsigned char out_bits; // The next stepping-bits to be output +static unsigned int cleaning_buffer_counter; // Counter variables for the bresenham line tracer static long counter_x, counter_y, counter_z, counter_e; @@ -346,6 +347,17 @@ FORCE_INLINE void trapezoid_generator_reset() { // "The Stepper Driver Interrupt" - This timer interrupt is the workhorse. // It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately. ISR(TIMER1_COMPA_vect) { + + if(cleaning_buffer_counter) + { + current_block = NULL; + plan_discard_current_block(); + if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); + cleaning_buffer_counter--; + OCR1A = 200; + return; + } + // If there is no current block, attempt to pop one from the buffer if (!current_block) { // Anything in the buffer? @@ -972,6 +984,7 @@ void finishAndDisableSteppers() { } void quickStop() { + cleaning_buffer_counter = 5000; DISABLE_STEPPER_DRIVER_INTERRUPT(); while (blocks_queued()) plan_discard_current_block(); current_block = NULL; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index f6edc42e8..c0105db43 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -349,16 +349,11 @@ static void lcd_sdcard_pause() { card.pauseSDPrint(); } static void lcd_sdcard_resume() { card.startFileprint(); } static void lcd_sdcard_stop() { + quickStop(); card.sdprinting = false; card.closefile(); - quickStop(); - if (SD_FINISHED_STEPPERRELEASE) { - enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); - } autotempShutdown(); - cancel_heatup = true; - lcd_setstatus(MSG_PRINT_ABORTED); } From 15d29efad506bfd4351b6060d09fe09663074fe2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 19 Mar 2015 13:40:36 -0700 Subject: [PATCH 14/16] Pass sel to lcd_implementation_mark_as_selected - Pass selected state directly to lcd_implementation_mark_as_selected - Rename sel function parameter - Include a minor fix for SdBaseFile.h --- Marlin/SdBaseFile.h | 4 ++-- Marlin/dogm_lcd_implementation.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/SdBaseFile.h b/Marlin/SdBaseFile.h index b0e77ecb4..dea299a64 100644 --- a/Marlin/SdBaseFile.h +++ b/Marlin/SdBaseFile.h @@ -171,9 +171,9 @@ static inline uint8_t FAT_SECOND(uint16_t fatTime) { return 2*(fatTime & 0X1F); } /** Default date for file timestamps is 1 Jan 2000 */ -uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | BIT(5) | 1; +uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1; /** Default time for file timestamp is 1 am */ -uint16_t const FAT_DEFAULT_TIME = BIT(11); +uint16_t const FAT_DEFAULT_TIME = (1 << 11); //------------------------------------------------------------------------------ /** * \class SdBaseFile diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 83c3b3f2b..ff63fe126 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -282,8 +282,8 @@ static void lcd_implementation_status_screen() { #endif } -static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { - if (pr_char != ' ') { +static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) { + if (isSelected) { u8g.setColorIndex(1); // black on white u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT); u8g.setColorIndex(0); // following text must be white on black @@ -294,11 +294,11 @@ static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); } -static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { +static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) { char c; uint8_t n = LCD_WIDTH - 2; - lcd_implementation_mark_as_selected(row, sel ? pre_char : ' '); + lcd_implementation_mark_as_selected(row, isSelected); while ((c = pgm_read_byte(pstr))) { u8g.print(c); @@ -310,11 +310,11 @@ static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const cha u8g.print(' '); } -static void _drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, const char* data, bool pgm) { +static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) { char c; uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data))); - lcd_implementation_mark_as_selected(row, sel ? '>' : ' '); + lcd_implementation_mark_as_selected(row, isSelected); while ((c = pgm_read_byte(pstr))) { u8g.print(c); @@ -379,7 +379,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { u8g.print(value); } -static void _drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) { +static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) { char c; uint8_t n = LCD_WIDTH - 1; @@ -388,7 +388,7 @@ static void _drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* fi longFilename[n] = '\0'; } - lcd_implementation_mark_as_selected(row, sel ? '>' : ' '); + lcd_implementation_mark_as_selected(row, isSelected); if (isDir) u8g.print(LCD_STR_FOLDER[0]); while ((c = *filename)) { From 90ba61b9b8a5229d7e5df8edb63474be2ae7801b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 19 Mar 2015 13:49:06 -0700 Subject: [PATCH 15/16] Include indicator for new drawmenu_generic In the new method we pass the character that should be used for selected state, not the character to print always. --- Marlin/ultralcd_implementation_hitachi_HD44780.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index 1f8bcb826..0ee097184 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -706,8 +706,8 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const } #define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) -#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, ' ', ' ') -#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, ' ', ' ') +#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') +#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') static void lcd_implementation_quick_feedback() { From 7279e4f82fe4047062d8729b6d710e9a7c2d8e36 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 19 Mar 2015 14:01:33 -0700 Subject: [PATCH 16/16] Small code tweaks re lcd.print --- Marlin/dogm_lcd_implementation.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index ff63fe126..27734b866 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -139,7 +139,7 @@ static void lcd_implementation_init() u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1); u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2); #endif - } while(u8g.nextPage()); + } while (u8g.nextPage()); } static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop @@ -222,7 +222,7 @@ static void lcd_implementation_status_screen() { int per = ((fanSpeed + 1) * 100) / 256; if (per) { u8g.print(itostr3(per)); - u8g.print("%"); + u8g.print('%'); } else #endif @@ -235,7 +235,7 @@ static void lcd_implementation_status_screen() { u8g.drawBox(0,29,128,10); u8g.setColorIndex(0); // white on black u8g.setPrintPos(2,37); - u8g.print("X"); + u8g.print('X'); u8g.drawPixel(8,33); u8g.drawPixel(8,35); u8g.setPrintPos(10,37); @@ -247,7 +247,7 @@ static void lcd_implementation_status_screen() { u8g.setPrintPos(51,37); u8g.print(ftostr31ns(current_position[Y_AXIS])); u8g.setPrintPos(83,37); - u8g.print("Z"); + u8g.print('Z'); u8g.drawPixel(89,33); u8g.drawPixel(89,35); u8g.setPrintPos(91,37); @@ -285,7 +285,7 @@ static void lcd_implementation_status_screen() { static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) { if (isSelected) { u8g.setColorIndex(1); // black on white - u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT); + u8g.drawBox(0, row * DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT); u8g.setColorIndex(0); // following text must be white on black } else { @@ -322,7 +322,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c n--; } u8g.print(':'); - while(n--) u8g.print(' '); + while (n--) u8g.print(' '); if (pgm) { lcd_printPGM(data); } else { u8g.print(data); } } @@ -396,7 +396,7 @@ static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const c filename++; n--; } - while(n--) u8g.print(' '); + while (n--) u8g.print(' '); } #define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false)