From 6d355ed978b520e2ed9edc24f60d92d0ad6d9710 Mon Sep 17 00:00:00 2001 From: Mylan719 Date: Fri, 27 May 2022 11:58:49 +0200 Subject: [PATCH 1/7] Mackerel now compiles if full graphical is chosen - implemented lyman extruder greeting --- Mackerel/Configuration.h | 4 +-- Mackerel/dogm_lcd_implementation.h | 29 +++++++++++++++++-- Mackerel/ultralcd.cpp | 7 +---- .../ultralcd_implementation_hitachi_HD44780.h | 10 +++++++ 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Mackerel/Configuration.h b/Mackerel/Configuration.h index 807f8c8..febc95b 100644 --- a/Mackerel/Configuration.h +++ b/Mackerel/Configuration.h @@ -675,7 +675,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // The RepRapDiscount Smart Controller (white PCB) // http://reprap.org/wiki/RepRapDiscount_Smart_Controller -#define REPRAP_DISCOUNT_SMART_CONTROLLER +//#define REPRAP_DISCOUNT_SMART_CONTROLLER // The GADGETS3D G3D LCD/SD Controller (blue PCB) // http://reprap.org/wiki/RAMPS_1.3/1.4_GADGETS3D_Shield_with_Panel @@ -685,7 +685,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib -//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER // The RepRapWorld REPRAPWORLD_KEYPAD v1.1 // http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626 diff --git a/Mackerel/dogm_lcd_implementation.h b/Mackerel/dogm_lcd_implementation.h index d63e9ad..01c75ed 100644 --- a/Mackerel/dogm_lcd_implementation.h +++ b/Mackerel/dogm_lcd_implementation.h @@ -88,6 +88,19 @@ U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 #endif +static void lcd_implementation_greet() +{ + u8g.firstPage(); + do { + u8g.setFont(u8g_font_5x8); + u8g.drawStr(5,20, SPLASH1); + u8g.setFont(u8g_font_5x8); + u8g.drawStr(5,30, SPLASH2); + u8g.setFont(u8g_font_5x8); + u8g.drawStr(5,40, SPLASH3); + } while( u8g.nextPage() ); +} + static void lcd_implementation_init() { #ifdef LCD_PIN_BL @@ -127,7 +140,7 @@ static void lcd_implementation_init() u8g.drawBitmapP(0,0,START_BMPBYTEWIDTH,START_BMPHEIGHT,start_bmp); // Welcome message u8g.setFont(u8g_font_6x10_marlin); - u8g.drawStr(62,10,"MARLIN"); + u8g.drawStr(62,10,"Mackerel"); u8g.setFont(u8g_font_5x8); u8g.drawStr(62,19,"V1.0.0 RC2-mm"); u8g.setFont(u8g_font_6x10_marlin); @@ -176,7 +189,7 @@ static void lcd_implementation_status_screen() u8g.setColorIndex(1); // black on white // Symbols menu graphics, animated fan - if ((blink % 2) && fanSpeed ) u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen0_bmp); + if ((blink % 2) && winderSpeed ) u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen0_bmp); else u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen1_bmp); #ifdef SDSUPPORT @@ -427,12 +440,18 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons #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_float22_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr22(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float22(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr22(*(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_float53_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr53(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float53(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr53(*(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_float6_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr6(*(data))) +#define lcd_implementation_drawmenu_setting_edit_float6(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr6(*(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)) @@ -445,12 +464,18 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons #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_float22_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr22(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float22(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr22(*(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_float53_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr53(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float53(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr53(*(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_float6_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr6(*(data))) +#define lcd_implementation_drawmenu_setting_edit_callback_float6(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr6(*(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)) diff --git a/Mackerel/ultralcd.cpp b/Mackerel/ultralcd.cpp index 8e0626c..3375082 100644 --- a/Mackerel/ultralcd.cpp +++ b/Mackerel/ultralcd.cpp @@ -1378,12 +1378,7 @@ static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) void lcd_init() { lcd_implementation_init(); - lcd.setCursor(0, 1); - lcd_printPGM(PSTR(SPLASH1)); - lcd.setCursor(0, 2); - lcd_printPGM(PSTR(SPLASH2)); - lcd.setCursor(0, 3); - lcd_printPGM(PSTR(SPLASH3)); + lcd_implementation_greet(); #ifdef NEWPANEL pinMode(BTN_EN1,INPUT); pinMode(BTN_EN2,INPUT); diff --git a/Mackerel/ultralcd_implementation_hitachi_HD44780.h b/Mackerel/ultralcd_implementation_hitachi_HD44780.h index 339a9ca..2e6937f 100644 --- a/Mackerel/ultralcd_implementation_hitachi_HD44780.h +++ b/Mackerel/ultralcd_implementation_hitachi_HD44780.h @@ -211,6 +211,16 @@ extern volatile uint16_t buttons; //an extended version of the last checked but #define LCD_STR_CLOCK "\x07" #define LCD_STR_ARROW_RIGHT "\x7E" /* from the default character set */ +static void lcd_implementation_greet() +{ + lcd.setCursor(0, 1); + lcd_printPGM(PSTR(SPLASH1)); + lcd.setCursor(0, 2); + lcd_printPGM(PSTR(SPLASH2)); + lcd.setCursor(0, 3); + lcd_printPGM(PSTR(SPLASH3)); +} + static void lcd_implementation_init() { byte bedTemp[8] = From f62072fad8e484a6053a9ee91fd5dc54e4ec3b50 Mon Sep 17 00:00:00 2001 From: Mylan719 Date: Fri, 27 May 2022 19:20:22 +0200 Subject: [PATCH 2/7] Status screen implemented -full graphical display now displays all extrusion info. --- Mackerel/DOGMbitmaps.h | 148 +--- Mackerel/dogm_lcd_implementation.h | 807 +++++++++--------- .../ultralcd_implementation_hitachi_HD44780.h | 14 - 3 files changed, 408 insertions(+), 561 deletions(-) diff --git a/Mackerel/DOGMbitmaps.h b/Mackerel/DOGMbitmaps.h index b2ccc31..9a43011 100644 --- a/Mackerel/DOGMbitmaps.h +++ b/Mackerel/DOGMbitmaps.h @@ -1,122 +1,28 @@ -#define START_BMPWIDTH 60 //Width in pixels -#define START_BMPHEIGHT 64 //Height in pixels -#define START_BMPBYTEWIDTH 8 //Width in bytes -const unsigned char start_bmp[574] PROGMEM = { //AVR-GCC, WinAVR -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xF9,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xF0,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xE0,0x7F,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xC0,0x3F,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0x80,0x1F,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0x00,0x0F,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFE,0x00,0x07,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFC,0x00,0x03,0xFF,0xFF,0xF0, -0xFF,0xFF,0xF8,0x00,0x01,0xFF,0xFF,0xF0, -0xFF,0xFF,0xF0,0x00,0x00,0xFF,0xFF,0xF0, -0xFF,0xFF,0xE0,0x00,0x00,0x7F,0xFF,0xF0, -0xFF,0xFF,0xC0,0x00,0x00,0x3F,0xFF,0xF0, -0xFF,0xFF,0x80,0x00,0x00,0x3F,0xFF,0xF0, -0xFF,0xFF,0x00,0x00,0x00,0x1F,0xFF,0xF0, -0xFF,0xFE,0x00,0x00,0x00,0x0F,0xFF,0xF0, -0xFF,0xFE,0x00,0x00,0x00,0x07,0xFF,0xF0, -0xFF,0xFC,0x00,0x00,0x00,0x07,0xFF,0xF0, -0xFF,0xFC,0x00,0x00,0x00,0x03,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x03,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x03,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x01,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x03,0xFF,0xF0, -0xFF,0xF8,0x00,0x00,0x00,0x03,0xFF,0xF0, -0xFF,0xFC,0x00,0x00,0x00,0x03,0xFF,0xF0, -0xFF,0xFC,0x00,0x00,0x00,0x07,0xFF,0xF0, -0xFF,0xFE,0x00,0x00,0x00,0x07,0xFF,0xF0, -0xFF,0xFE,0x00,0x00,0x00,0x0F,0xFF,0xF0, -0xFF,0xFF,0x00,0x00,0x00,0x1F,0xFF,0xF0, -0xFF,0xFF,0x80,0x00,0x00,0x1F,0xFF,0xF0, -0xFF,0xFF,0xC0,0x00,0x00,0x3F,0xFF,0xF0, -0xFF,0xFF,0xE0,0x00,0x00,0x7F,0xFF,0xF0, -0xFF,0xFF,0xF0,0x00,0x01,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFC,0x00,0x03,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0x00,0x1F,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, -0x83,0xFF,0xFF,0xFE,0x0F,0xFF,0xFF,0xF0, -0x80,0xFF,0xFF,0xFE,0x03,0xFF,0xFF,0xF0, -0x88,0x7F,0xFF,0xFE,0x23,0xFF,0xFF,0xF0, -0x8C,0x70,0x38,0x0E,0x71,0x81,0xC0,0x70, -0x8C,0x60,0x38,0x0E,0x63,0x80,0xC0,0x30, -0x80,0xE3,0x19,0xC6,0x07,0xF8,0xC7,0x30, -0x80,0xE0,0x19,0xC6,0x03,0x80,0xC7,0x10, -0x8C,0x62,0x79,0xC6,0x63,0x9C,0xC7,0x30, -0x8C,0x63,0xF8,0xC6,0x71,0x18,0xC6,0x30, -0x8E,0x30,0x18,0x0E,0x71,0x80,0xC0,0x30, -0x9E,0x38,0x39,0x1E,0x79,0xC4,0xC4,0xF0, -0xFF,0xFF,0xF9,0xFF,0xFF,0xFF,0xC7,0xF0, -0xFF,0xFF,0xF9,0xFF,0xFF,0xFF,0xC7,0xF0, -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0 -}; - -#define STATUS_SCREENWIDTH 115 //Width in pixels -#define STATUS_SCREENHEIGHT 19 //Height in pixels -#define STATUS_SCREENBYTEWIDTH 15 //Width in bytes -const unsigned char status_screen0_bmp[] PROGMEM = { //AVR-GCC, WinAVR -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xE0, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xE0, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x0C,0x60, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x0E,0x20, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4F,0x0F,0x20, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5F,0x0F,0xA0, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x07,0xA0, -0x7F,0x80,0x00,0x3F,0xC0,0x00,0x3F,0xC0,0x00,0x41,0x04,0x00,0x40,0x60,0x20, -0xFB,0xC0,0x00,0x79,0xE0,0x00,0x79,0xE0,0x00,0x20,0x82,0x00,0x40,0xF0,0x20, -0xF3,0xC0,0x00,0x76,0xE0,0x00,0x76,0xE0,0x00,0x20,0x82,0x00,0x40,0xF0,0x20, -0xEB,0xC0,0x00,0x7E,0xE0,0x00,0x7E,0xE0,0x00,0x41,0x04,0x00,0x40,0x60,0x20, -0x7B,0x80,0x00,0x3D,0xC0,0x00,0x39,0xC0,0x00,0x82,0x08,0x00,0x5E,0x07,0xA0, -0x7B,0x80,0x00,0x3B,0xC0,0x00,0x3E,0xC0,0x01,0x04,0x10,0x00,0x5F,0x0F,0xA0, -0xFB,0xC0,0x00,0x77,0xE0,0x00,0x76,0xE0,0x01,0x04,0x10,0x00,0x4F,0x0F,0x20, -0xFB,0xC0,0x00,0x70,0xE0,0x00,0x79,0xE0,0x00,0x82,0x08,0x00,0x47,0x0E,0x20, -0xFF,0xC0,0x00,0x7F,0xE0,0x00,0x7F,0xE0,0x00,0x41,0x04,0x00,0x63,0x0C,0x60, -0x3F,0x00,0x00,0x1F,0x80,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x70,0x00,0xE0, -0x1E,0x00,0x00,0x0F,0x00,0x00,0x0F,0x00,0x01,0xFF,0xFF,0x80,0x7F,0xFF,0xE0, -0x0C,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x01,0xFF,0xFF,0x80,0x00,0x00,0x00 -}; - -#define STATUS_SCREENWIDTH 115 //Width in pixels -#define STATUS_SCREENHEIGHT 19 //Height in pixels -#define STATUS_SCREENBYTEWIDTH 15 //Width in bytes -const unsigned char status_screen1_bmp[] PROGMEM = { //AVR-GCC, WinAVR -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xE0, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xE0, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x61,0xF8,0x60, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0xF8,0x20, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xF0,0x20, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x60,0x20, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0x01,0xA0, -0x7F,0x80,0x00,0x3F,0xC0,0x00,0x3F,0xC0,0x00,0x41,0x04,0x00,0x5C,0x63,0xA0, -0xFB,0xC0,0x00,0x79,0xE0,0x00,0x79,0xE0,0x00,0x20,0x82,0x00,0x5E,0xF7,0xA0, -0xF3,0xC0,0x00,0x76,0xE0,0x00,0x76,0xE0,0x00,0x20,0x82,0x00,0x5E,0xF7,0xA0, -0xEB,0xC0,0x00,0x7E,0xE0,0x00,0x7E,0xE0,0x00,0x41,0x04,0x00,0x5C,0x63,0xA0, -0x7B,0x80,0x00,0x3D,0xC0,0x00,0x39,0xC0,0x00,0x82,0x08,0x00,0x58,0x01,0xA0, -0x7B,0x80,0x00,0x3B,0xC0,0x00,0x3E,0xC0,0x01,0x04,0x10,0x00,0x40,0x60,0x20, -0xFB,0xC0,0x00,0x77,0xE0,0x00,0x76,0xE0,0x01,0x04,0x10,0x00,0x40,0xF0,0x20, -0xFB,0xC0,0x00,0x70,0xE0,0x00,0x79,0xE0,0x00,0x82,0x08,0x00,0x41,0xF8,0x20, -0xFF,0xC0,0x00,0x7F,0xE0,0x00,0x7F,0xE0,0x00,0x41,0x04,0x00,0x61,0xF8,0x60, -0x3F,0x00,0x00,0x1F,0x80,0x00,0x1F,0x80,0x00,0x00,0x00,0x00,0x70,0x00,0xE0, -0x1E,0x00,0x00,0x0F,0x00,0x00,0x0F,0x00,0x01,0xFF,0xFF,0x80,0x7F,0xFF,0xE0, -0x0C,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x01,0xFF,0xFF,0x80,0x00,0x00,0x00 -}; - - +#define STATUS_SCREENWIDTH 67 //Width in pixels +#define STATUS_SCREENHEIGHT 38 //Height in pixels +#define STATUS_SCREENBYTEWIDTH 9 //Width in bytes +const unsigned char status_screen0_bmp[] PROGMEM = { + 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x40, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0xc0, 0xc0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x13, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0xc0, 0xc0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x80, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0xe1, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0xe0, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x80, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x20, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x20, 0x1c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x13, 0x00, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x1c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; \ No newline at end of file diff --git a/Mackerel/dogm_lcd_implementation.h b/Mackerel/dogm_lcd_implementation.h index 01c75ed..fa5f04f 100644 --- a/Mackerel/dogm_lcd_implementation.h +++ b/Mackerel/dogm_lcd_implementation.h @@ -11,7 +11,6 @@ *License: http://opensource.org/licenses/BSD-3-Clause */ - #ifndef ULTRA_LCD_IMPLEMENTATION_DOGM_H #define ULTRA_LCD_IMPLEMENTATION_DOGM_H @@ -23,14 +22,14 @@ #define BLEN_A 0 #define BLEN_B 1 #define BLEN_C 2 -#define EN_A (1< @@ -39,7 +38,6 @@ #include "ultralcd.h" #include "ultralcd_st7920_u8glib_rrd.h" - /* Russian language not supported yet, needs custom font #if LANGUAGE_CHOICE == 6 @@ -52,27 +50,25 @@ */ // DOGM parameters (size in pixels) -#define DOG_CHAR_WIDTH 6 -#define DOG_CHAR_HEIGHT 12 -#define DOG_CHAR_WIDTH_LARGE 9 -#define DOG_CHAR_HEIGHT_LARGE 18 - - -#define START_ROW 0 +#define DOG_CHAR_WIDTH 6 +#define DOG_CHAR_HEIGHT 12 +#define DOG_CHAR_WIDTH_LARGE 9 +#define DOG_CHAR_HEIGHT_LARGE 18 +#define START_ROW 0 /* Custom characters defined in font font_6x10_marlin.c */ -#define LCD_STR_BEDTEMP "\xFE" -#define LCD_STR_DEGREE "\xB0" +#define LCD_STR_BEDTEMP "\xFE" +#define LCD_STR_DEGREE "\xB0" #define LCD_STR_THERMOMETER "\xFF" -#define LCD_STR_UPLEVEL "\xFB" -#define LCD_STR_REFRESH "\xF8" -#define LCD_STR_FOLDER "\xF9" -#define LCD_STR_FEEDRATE "\xFD" -#define LCD_STR_CLOCK "\xFC" +#define LCD_STR_UPLEVEL "\xFB" +#define LCD_STR_REFRESH "\xF8" +#define LCD_STR_FOLDER "\xF9" +#define LCD_STR_FEEDRATE "\xFD" +#define LCD_STR_CLOCK "\xFC" #define LCD_STR_ARROW_RIGHT "\xFA" -#define FONT_STATUSMENU u8g_font_6x9 +#define FONT_STATUSMENU u8g_font_6x9 int lcd_contrast; @@ -85,353 +81,312 @@ U8GLIB_ST7920_128X64_RRD u8g(0); U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); #else // for regular DOGM128 display with HW-SPI -U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 +U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 #endif static void lcd_implementation_greet() { - u8g.firstPage(); - do { - u8g.setFont(u8g_font_5x8); - u8g.drawStr(5,20, SPLASH1); - u8g.setFont(u8g_font_5x8); - u8g.drawStr(5,30, SPLASH2); - u8g.setFont(u8g_font_5x8); - u8g.drawStr(5,40, SPLASH3); - } while( u8g.nextPage() ); + } static void lcd_implementation_init() { #ifdef LCD_PIN_BL - pinMode(LCD_PIN_BL, OUTPUT); // Enable LCD backlight + pinMode(LCD_PIN_BL, OUTPUT); // Enable LCD backlight digitalWrite(LCD_PIN_BL, HIGH); #endif - u8g.setContrast(lcd_contrast); + u8g.setContrast(lcd_contrast); // Uncomment this if you have the first generation (V1.10) of STBs board // pinMode(17, OUTPUT); // Enable LCD backlight // digitalWrite(17, HIGH); - + u8g.firstPage(); - do { + do + { u8g.setFont(u8g_font_6x10_marlin); u8g.setColorIndex(1); - u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight()); + u8g.drawBox(0, 0, u8g.getWidth(), u8g.getHeight()); u8g.setColorIndex(1); - } while( u8g.nextPage() ); + } while (u8g.nextPage()); #ifdef LCD_SCREEN_ROT_90 - u8g.setRot90(); // Rotate screen by 90° + u8g.setRot90(); // Rotate screen by 90° #endif #ifdef LCD_SCREEN_ROT_180 - u8g.setRot180(); // Rotate screen by 180° + u8g.setRot180(); // Rotate screen by 180° #endif #ifdef LCD_SCREEN_ROT_270 - u8g.setRot270(); // Rotate screen by 270° + u8g.setRot270(); // Rotate screen by 270° #endif - u8g.firstPage(); - do { - // RepRap init bmp - u8g.drawBitmapP(0,0,START_BMPBYTEWIDTH,START_BMPHEIGHT,start_bmp); - // Welcome message - u8g.setFont(u8g_font_6x10_marlin); - u8g.drawStr(62,10,"Mackerel"); - u8g.setFont(u8g_font_5x8); - u8g.drawStr(62,19,"V1.0.0 RC2-mm"); - u8g.setFont(u8g_font_6x10_marlin); - u8g.drawStr(62,28,"by ErikZalm"); - u8g.drawStr(62,41,"DOGM128 LCD"); - u8g.setFont(u8g_font_5x8); - u8g.drawStr(62,48,"enhancements"); - u8g.setFont(u8g_font_5x8); - u8g.drawStr(62,55,"by STB, MM"); - u8g.drawStr(62,61,"uses u"); - u8g.drawStr90(92,57,"8"); - u8g.drawStr(100,61,"glib"); - } while( u8g.nextPage() ); + do + { + u8g.setFont(u8g_font_5x8); + u8g.drawStr(5, 20, SPLASH1); + u8g.setFont(u8g_font_5x8); + u8g.drawStr(5, 30, SPLASH2); + u8g.setFont(u8g_font_5x8); + u8g.drawStr(5, 40, SPLASH3); + } while (u8g.nextPage()); } static void lcd_implementation_clear() { -// NO NEED TO IMPLEMENT LIKE SO. Picture loop automatically clears the display. -// -// Check this article: http://arduino.cc/forum/index.php?topic=91395.25;wap2 -// -// u8g.firstPage(); -// do { -// u8g.setColorIndex(0); -// u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight()); -// u8g.setColorIndex(1); -// } while( u8g.nextPage() ); + // NO NEED TO IMPLEMENT LIKE SO. Picture loop automatically clears the display. + // + // Check this article: http://arduino.cc/forum/index.php?topic=91395.25;wap2 + // + // u8g.firstPage(); + // do { + // u8g.setColorIndex(0); + // u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight()); + // u8g.setColorIndex(1); + // } while( u8g.nextPage() ); } /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ -static void lcd_printPGM(const char* str) +static void lcd_printPGM(const char *str) { - char c; - while((c = pgm_read_byte(str++)) != '\0') - { - u8g.print(c); - } + char c; + while ((c = pgm_read_byte(str++)) != '\0') + { + u8g.print(c); + } } - static void lcd_implementation_status_screen() { - - static unsigned char fan_rot = 0; - - u8g.setColorIndex(1); // black on white - - // Symbols menu graphics, animated fan - if ((blink % 2) && winderSpeed ) u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen0_bmp); - else u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen1_bmp); - - #ifdef SDSUPPORT - //SD Card Symbol - u8g.drawBox(42,42,8,7); - u8g.drawBox(50,44,2,5); - u8g.drawFrame(42,49,10,4); - u8g.drawPixel(50,43); - // Progress bar - u8g.drawFrame(54,49,73,4); - - // SD Card Progress bar and clock - u8g.setFont(FONT_STATUSMENU); - - if (IS_SD_PRINTING) - { - // Progress bar - u8g.drawBox(55,50, (unsigned int)( (71 * card.percentDone())/100) ,2); - } - else { - // do nothing - } - - u8g.setPrintPos(80,47); - if(starttime != 0) - { - uint16_t time = millis()/60000 - starttime/60000; - - u8g.print(itostr2(time/60)); - u8g.print(':'); - u8g.print(itostr2(time%60)); - }else{ - lcd_printPGM(PSTR("--:--")); - } - #endif - - // Extruder 1 - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(6,6); - u8g.print(itostr3(int(degTargetHotend(0) + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - u8g.setPrintPos(6,27); - u8g.print(itostr3(int(degHotend(0) + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (!isHeatingHotend(0)) u8g.drawBox(13,17,2,2); + int tHotend = int(degHotend(0) + 0.5); + int tTarget = int(degTargetHotend(0) + 0.5); + uint16_t time; + + const int leftColumnStart = 12; + const int rightColumnStart = 70; + + static unsigned char fan_rot = 0; + + u8g.setColorIndex(1); // black on white + + u8g.drawBitmapP(1, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT, status_screen0_bmp); + + //Extruder + //=nozzle temperature + u8g.setFont(FONT_STATUSMENU); + u8g.setPrintPos(leftColumnStart, 10); + u8g.print(itostr3(tHotend)); + u8g.print('/'); + u8g.print(itostr3left(tTarget)); + lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); + + //=RPM + u8g.setPrintPos(rightColumnStart, 10); + if ((extrude_status & ES_SWITCH_SET) && (extrude_status & ES_HOT_SET)) //check if extruder motor switch is on + { + u8g.print(ftostr22(extruder_rpm)); //convert to rpm + lcd_printPGM(PSTR(" rpm")); + } + else if (extrude_status & ES_HOT_SET) + { + lcd_printPGM(PSTR("OFF")); + } else - { - u8g.setColorIndex(0); // white on black - u8g.drawBox(13,17,2,2); - u8g.setColorIndex(1); // black on white - } - - // Extruder 2 - u8g.setFont(FONT_STATUSMENU); - #if EXTRUDERS > 1 - u8g.setPrintPos(31,6); - u8g.print(itostr3(int(degTargetHotend(1) + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - u8g.setPrintPos(31,27); - u8g.print(itostr3(int(degHotend(1) + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (!isHeatingHotend(1)) u8g.drawBox(38,17,2,2); - else - { - u8g.setColorIndex(0); // white on black - u8g.drawBox(38,17,2,2); - u8g.setColorIndex(1); // black on white - } - #else - u8g.setPrintPos(31,27); - u8g.print("---"); - #endif - - // Extruder 3 - u8g.setFont(FONT_STATUSMENU); - # if EXTRUDERS > 2 - u8g.setPrintPos(55,6); - u8g.print(itostr3(int(degTargetHotend(2) + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - u8g.setPrintPos(55,27); - u8g.print(itostr3(int(degHotend(2) + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (!isHeatingHotend(2)) u8g.drawBox(62,17,2,2); + { + lcd_printPGM(PSTR("COLD")); + } + + //Puller + //=Feed rate + u8g.setFont(u8g_font_6x10_marlin); + u8g.setPrintPos(leftColumnStart+2, 25); + u8g.print(LCD_STR_FEEDRATE[0]); + u8g.setFont(FONT_STATUSMENU); + u8g.setPrintPos(leftColumnStart+9, 25); + u8g.print(ftostr22(puller_feedrate)); //give the feed rate in mm/sec + + //=RPM + u8g.setPrintPos(rightColumnStart, 25); + u8g.print(ftostr22(puller_feedrate * (60.0 / PULLER_WHEEL_CIRC))); + lcd_printPGM(PSTR(" rpm")); + + //Filament + //=Sensor + u8g.setPrintPos(leftColumnStart, 37); +#ifdef FILAMENT_SENSOR + u8g.print('d'); + u8g.print(ftostr12(current_filwidth)); +#endif +#ifdef BLOB_SENSOR + lcd_printPGM(PSTR(" b")); + u8g.print(ftostr12(current_blobwidth)); +#else +#ifdef FILAMENT_SENSOR + if (alt_cnt < 5) + { + lcd_printPGM(PSTR(" Av")); + u8g.print(ftostr12(avg_measured_filament_width)); + }; + if (alt_cnt >= 5 && alt_cnt < 10) + { + lcd_printPGM(PSTR(" Mx")); + u8g.print(ftostr12(max_measured_filament_width)); + }; + if (alt_cnt >= 10 && alt_cnt < 15) + { + lcd_printPGM(PSTR(" Mn")); + u8g.print(ftostr12(min_measured_filament_width)); + }; + alt_cnt = alt_cnt + 1; + if (alt_cnt == 15) + alt_cnt = 0; +#else + lcd_printPGM(PSTR("-")); +#endif //FILAMENT_SENSOR +#endif //BLOB_SENSOR + lcd_printPGM(PSTR(" mm")); + + u8g.setColorIndex(1); // black on white + + u8g.drawBox(0, 42, 128, DOG_CHAR_HEIGHT+1); + u8g.setColorIndex(0); // following text must be white on black + + //Time + //=Elapsed time + u8g.setFont(u8g_font_6x10_marlin); + u8g.setPrintPos(3, 52); + u8g.print(LCD_STR_CLOCK[0]); + u8g.setFont(FONT_STATUSMENU); + u8g.setPrintPos(leftColumnStart, 51); + time = duration / 60000; + u8g.print(itostr2(time / 60)); + u8g.print(':'); + u8g.print(itostr2(time % 60)); + + //=ExpectedTime + //I excluded this to make the screen les crowded + + //Filament length + //=Lenght icon + const int iconX = rightColumnStart-12; + const int iconY = 48; + + u8g.drawPixel(iconX,iconY); + u8g.drawPixel(iconX,iconY+2); + u8g.drawPixel(iconX+9,iconY); + u8g.drawPixel(iconX+9,iconY+2); + u8g.drawPixel(iconX+1,iconY+1); + u8g.drawPixel(iconX+2,iconY+1); + u8g.drawPixel(iconX+3,iconY+1); + u8g.drawPixel(iconX+4,iconY+1); + u8g.drawPixel(iconX+5,iconY+1); + u8g.drawPixel(iconX+6,iconY+1); + u8g.drawPixel(iconX+7,iconY+1); + u8g.drawPixel(iconX+8,iconY+1); + //=Lenght icon end + + u8g.setPrintPos(rightColumnStart, 51); + u8g.print(ftostr6(extrude_length)); + lcd_printPGM(PSTR(" mm")); + + u8g.setColorIndex(1); + + // Status line + u8g.setFont(FONT_STATUSMENU); + u8g.setPrintPos(0, 63); + u8g.print(lcd_status_message); +} + +static void lcd_implementation_drawmenu_generic(uint8_t row, const char *pstr, char pre_char, char post_char) +{ + char c; + + uint8_t n = LCD_WIDTH - 1 - 2; + + if ((pre_char == '>') || (pre_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 + } else - { - u8g.setColorIndex(0); // white on black - u8g.drawBox(62,17,2,2); - u8g.setColorIndex(1); // black on white - } - #else - u8g.setPrintPos(55,27); - u8g.print("---"); - #endif - - // Heatbed - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(81,6); - u8g.print(itostr3(int(degTargetBed() + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - u8g.setPrintPos(81,27); - u8g.print(itostr3(int(degBed() + 0.5))); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); - if (!isHeatingBed()) u8g.drawBox(88,18,2,2); + u8g.setColorIndex(1); // unmarked text is black on white + + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + if (pre_char != '>') + u8g.print(pre_char); else - { - u8g.setColorIndex(0); // white on black - u8g.drawBox(88,18,2,2); - u8g.setColorIndex(1); // black on white - } - - // Fan - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(104,27); - #if defined(FAN_PIN) && FAN_PIN > -1 - u8g.print(itostr3(int((fanSpeed*100)/256 + 1))); - u8g.print("%"); - #else - u8g.print("---"); - #endif - - - // X, Y, Z-Coordinates - u8g.setFont(FONT_STATUSMENU); - u8g.drawBox(0,29,128,10); - u8g.setColorIndex(0); // white on black - u8g.setPrintPos(2,37); - u8g.print("X"); - u8g.drawPixel(8,33); - u8g.drawPixel(8,35); - u8g.setPrintPos(10,37); - u8g.print(ftostr31ns(current_position[X_AXIS])); - u8g.setPrintPos(43,37); - lcd_printPGM(PSTR("Y")); - u8g.drawPixel(49,33); - u8g.drawPixel(49,35); - u8g.setPrintPos(51,37); - u8g.print(ftostr31ns(current_position[Y_AXIS])); - u8g.setPrintPos(83,37); - u8g.print("Z"); - u8g.drawPixel(89,33); - u8g.drawPixel(89,35); - u8g.setPrintPos(91,37); - u8g.print(ftostr31(current_position[Z_AXIS])); - u8g.setColorIndex(1); // black on white - - // Feedrate - u8g.setFont(u8g_font_6x10_marlin); - u8g.setPrintPos(3,49); - u8g.print(LCD_STR_FEEDRATE[0]); - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(12,48); - u8g.print(itostr3(feedmultiply)); - u8g.print('%'); - - // Status line - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(0,61); - u8g.print(lcd_status_message); + u8g.print(' '); // Row selector is obsolete + + while ((c = pgm_read_byte(pstr)) != '\0') + { + u8g.print(c); + pstr++; + n--; + } + while (n--) + { + u8g.print(' '); + } + u8g.print(post_char); + u8g.print(' '); + u8g.setColorIndex(1); // restore settings to black on white } -static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) +static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char *pstr, char pre_char, char *data) { - char c; - - uint8_t n = LCD_WIDTH - 1 - 2; - - if ((pre_char == '>') || (pre_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 - } else u8g.setColorIndex(1); // unmarked text is black on white - - u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); - if (pre_char != '>') u8g.print(pre_char); else u8g.print(' '); // Row selector is obsolete - - - while( (c = pgm_read_byte(pstr)) != '\0' ) - { + static unsigned int fkt_cnt = 0; + char c; + uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data); + + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.print(pre_char); + + while ((c = pgm_read_byte(pstr)) != '\0') + { u8g.print(c); - pstr++; - n--; - } - while(n--){ - u8g.print(' '); - } - - u8g.print(post_char); + + pstr++; + n--; + } + + u8g.print(':'); + + while (n--) + { u8g.print(' '); - u8g.setColorIndex(1); // restore settings to black on white + } + + u8g.print(data); } -static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data) +static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char *pstr, char pre_char, const char *data) { - static unsigned int fkt_cnt = 0; char c; - uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data); - - u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); - u8g.print(pre_char); - - while( (c = pgm_read_byte(pstr)) != '\0' ) - { - u8g.print(c); - - pstr++; - n--; - } - - u8g.print(':'); - - while(n--){ - u8g.print(' '); - } - - u8g.print(data); -} + uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data); -static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data) -{ - char c; - uint8_t n= LCD_WIDTH - 1 - 2 - strlen_P(data); + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.print(pre_char); - u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); - u8g.print(pre_char); - - while( (c = pgm_read_byte(pstr)) != '\0' ) - { - u8g.print(c); - - pstr++; - n--; - } - - u8g.print(':'); - - while(n--){ - u8g.print(' '); - } - - lcd_printPGM(data); + while ((c = pgm_read_byte(pstr)) != '\0') + { + u8g.print(c); + + pstr++; + n--; + } + + u8g.print(':'); + + while (n--) + { + u8g.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))) @@ -454,8 +409,8 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons #define lcd_implementation_drawmenu_setting_edit_float6(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr6(*(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_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)) //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))) @@ -478,130 +433,133 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons #define lcd_implementation_drawmenu_setting_edit_callback_float6(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr6(*(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_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) +void lcd_implementation_drawedit(const char *pstr, char *value) { - u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW ); - u8g.setFont(u8g_font_9x18); - lcd_printPGM(pstr); - u8g.print(':'); - u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW ); - u8g.print(value); + u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW); + u8g.setFont(u8g_font_9x18); + lcd_printPGM(pstr); + u8g.print(':'); + u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW); + u8g.print(value); } -static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) +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; - - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-1] = '\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 - u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); - u8g.print(' '); // Indent by 1 char - - while((c = *filename) != '\0') - { + char c; + uint8_t n = LCD_WIDTH - 1; + + if (longFilename[0] != '\0') + { + filename = longFilename; + longFilename[LCD_WIDTH - 1] = '\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 + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.print(' '); // Indent by 1 char + + while ((c = *filename) != '\0') + { u8g.print(c); - filename++; - n--; - } - while(n--){ - u8g.print(' '); - } - u8g.setColorIndex(1); // black on white + filename++; + n--; + } + while (n--) + { + u8g.print(' '); + } + u8g.setColorIndex(1); // black on white } -static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename) +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; + char c; + uint8_t n = LCD_WIDTH - 1; - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-1] = '\0'; - } + if (longFilename[0] != '\0') + { + filename = longFilename; + longFilename[LCD_WIDTH - 1] = '\0'; + } - u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); - u8g.print(' '); - -while((c = *filename) != '\0') - { - u8g.print(c); - - filename++; - n--; - } - while(n--){ - u8g.print(' '); - } + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.print(' '); + + while ((c = *filename) != '\0') + { + u8g.print(c); + filename++; + n--; + } + while (n--) + { + u8g.print(' '); + } } -static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) +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; - - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-2] = '\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 - u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); - u8g.print(' '); // Indent by 1 char - u8g.print(LCD_STR_FOLDER[0]); - - while((c = *filename) != '\0') - { - u8g.print(c); - - filename++; - n--; - } - while(n--){ - u8g.print(' '); - } - u8g.setColorIndex(1); // black on white + char c; + uint8_t n = LCD_WIDTH - 2; + + if (longFilename[0] != '\0') + { + filename = longFilename; + longFilename[LCD_WIDTH - 2] = '\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 + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.print(' '); // Indent by 1 char + u8g.print(LCD_STR_FOLDER[0]); + + while ((c = *filename) != '\0') + { + u8g.print(c); + + filename++; + n--; + } + while (n--) + { + u8g.print(' '); + } + u8g.setColorIndex(1); // black on white } -static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename) +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; + char c; + uint8_t n = LCD_WIDTH - 2; + + if (longFilename[0] != '\0') + { + filename = longFilename; + longFilename[LCD_WIDTH - 2] = '\0'; + } + + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + u8g.print(' '); + u8g.print(LCD_STR_FOLDER[0]); - if (longFilename[0] != '\0') - { - filename = longFilename; - longFilename[LCD_WIDTH-2] = '\0'; - } + while ((c = *filename) != '\0') + { + u8g.print(c); - u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); + filename++; + n--; + } + while (n--) + { u8g.print(' '); - u8g.print(LCD_STR_FOLDER[0]); - - while((c = *filename) != '\0') - { - u8g.print(c); - - filename++; - n--; - } - while(n--){ - u8g.print(' '); - } + } } #define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) @@ -617,17 +575,14 @@ static void lcd_implementation_quick_feedback() { #if BEEPER > -1 - SET_OUTPUT(BEEPER); - for(int8_t i=0;i<10;i++) - { - WRITE(BEEPER,HIGH); + SET_OUTPUT(BEEPER); + for (int8_t i = 0; i < 10; i++) + { + WRITE(BEEPER, HIGH); delay(3); - WRITE(BEEPER,LOW); + WRITE(BEEPER, LOW); delay(3); - } + } #endif } -#endif//ULTRA_LCD_IMPLEMENTATION_DOGM_H - - - +#endif //ULTRA_LCD_IMPLEMENTATION_DOGM_H diff --git a/Mackerel/ultralcd_implementation_hitachi_HD44780.h b/Mackerel/ultralcd_implementation_hitachi_HD44780.h index 2e6937f..86d2c02 100644 --- a/Mackerel/ultralcd_implementation_hitachi_HD44780.h +++ b/Mackerel/ultralcd_implementation_hitachi_HD44780.h @@ -388,9 +388,6 @@ static void lcd_implementation_status_screen() int tTarget=int(degTargetHotend(0) + 0.5); uint16_t time; - - - #if LCD_WIDTH < 20 lcd.setCursor(0, 0); lcd.print(itostr3(tHotend)); @@ -433,17 +430,6 @@ static void lcd_implementation_status_screen() else lcd_printPGM(PSTR("COLD")); - - - - - - - - - - - # if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 //If we have an 2nd extruder or heated bed, show that in the top right corner lcd.setCursor(10, 0); From 960ea445a6e57705361826ea5d3fb6e75e9a56fd Mon Sep 17 00:00:00 2001 From: Mylan719 Date: Sun, 29 May 2022 18:13:40 +0200 Subject: [PATCH 3/7] Changed the walue edit font for smaller - many of longer descriptions did not fit. --- Mackerel/dogm_lcd_implementation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mackerel/dogm_lcd_implementation.h b/Mackerel/dogm_lcd_implementation.h index fa5f04f..77f6b4e 100644 --- a/Mackerel/dogm_lcd_implementation.h +++ b/Mackerel/dogm_lcd_implementation.h @@ -439,7 +439,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons void lcd_implementation_drawedit(const char *pstr, char *value) { u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW); - u8g.setFont(u8g_font_9x18); + u8g.setFont(u8g_font_6x10_marlin); lcd_printPGM(pstr); u8g.print(':'); u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW); From 71c916e29b8cad2eb7dfe83b73ffc1a1e45ebb7c Mon Sep 17 00:00:00 2001 From: Mylan719 Date: Sun, 29 May 2022 19:20:46 +0200 Subject: [PATCH 4/7] Refactored status screen code to make it nicer --- Mackerel/dogm_lcd_implementation.h | 143 +++++++++++++++++------------ 1 file changed, 83 insertions(+), 60 deletions(-) diff --git a/Mackerel/dogm_lcd_implementation.h b/Mackerel/dogm_lcd_implementation.h index 77f6b4e..7efc4e0 100644 --- a/Mackerel/dogm_lcd_implementation.h +++ b/Mackerel/dogm_lcd_implementation.h @@ -86,7 +86,6 @@ U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 static void lcd_implementation_greet() { - } static void lcd_implementation_init() @@ -158,32 +157,22 @@ static void lcd_printPGM(const char *str) } } -static void lcd_implementation_status_screen() +static void lcd_implementation_status_screen_nozzle_temperature(int row, int column) { int tHotend = int(degHotend(0) + 0.5); int tTarget = int(degTargetHotend(0) + 0.5); - uint16_t time; - - const int leftColumnStart = 12; - const int rightColumnStart = 70; - static unsigned char fan_rot = 0; - - u8g.setColorIndex(1); // black on white - - u8g.drawBitmapP(1, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT, status_screen0_bmp); - - //Extruder - //=nozzle temperature u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(leftColumnStart, 10); + u8g.setPrintPos(row, column); u8g.print(itostr3(tHotend)); u8g.print('/'); u8g.print(itostr3left(tTarget)); lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); +} - //=RPM - u8g.setPrintPos(rightColumnStart, 10); +static void lcd_implementation_status_screen_extruder_rpm(int row, int column) +{ + u8g.setPrintPos(row, column); if ((extrude_status & ES_SWITCH_SET) && (extrude_status & ES_HOT_SET)) //check if extruder motor switch is on { u8g.print(ftostr22(extruder_rpm)); //convert to rpm @@ -197,27 +186,31 @@ static void lcd_implementation_status_screen() { lcd_printPGM(PSTR("COLD")); } +} - //Puller - //=Feed rate +static void lcd_implementation_status_screen_puller_feedrate(int row, int column) +{ u8g.setFont(u8g_font_6x10_marlin); - u8g.setPrintPos(leftColumnStart+2, 25); - u8g.print(LCD_STR_FEEDRATE[0]); - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(leftColumnStart+9, 25); + u8g.setPrintPos(row + 2, column); + u8g.print(LCD_STR_FEEDRATE[0]); + u8g.setFont(FONT_STATUSMENU); + u8g.setPrintPos(row + 9, column); u8g.print(ftostr22(puller_feedrate)); //give the feed rate in mm/sec +} - //=RPM - u8g.setPrintPos(rightColumnStart, 25); +static void lcd_implementation_status_screen_puller_rpm(int row, int column) +{ + u8g.setPrintPos(row, column); u8g.print(ftostr22(puller_feedrate * (60.0 / PULLER_WHEEL_CIRC))); lcd_printPGM(PSTR(" rpm")); +} - //Filament - //=Sensor - u8g.setPrintPos(leftColumnStart, 37); +static void lcd_implementation_status_screen_sensor_data(int row, int column) +{ + u8g.setPrintPos(row, column); #ifdef FILAMENT_SENSOR u8g.print('d'); - u8g.print(ftostr12(current_filwidth)); + u8g.print(ftostr12(current_filwidth)); #endif #ifdef BLOB_SENSOR lcd_printPGM(PSTR(" b")); @@ -226,17 +219,17 @@ static void lcd_implementation_status_screen() #ifdef FILAMENT_SENSOR if (alt_cnt < 5) { - lcd_printPGM(PSTR(" Av")); + lcd_printPGM(PSTR(" Av: ")); u8g.print(ftostr12(avg_measured_filament_width)); }; if (alt_cnt >= 5 && alt_cnt < 10) { - lcd_printPGM(PSTR(" Mx")); + lcd_printPGM(PSTR(" Mx: ")); u8g.print(ftostr12(max_measured_filament_width)); }; if (alt_cnt >= 10 && alt_cnt < 15) { - lcd_printPGM(PSTR(" Mn")); + lcd_printPGM(PSTR(" Mn: ")); u8g.print(ftostr12(min_measured_filament_width)); }; alt_cnt = alt_cnt + 1; @@ -247,51 +240,81 @@ static void lcd_implementation_status_screen() #endif //FILAMENT_SENSOR #endif //BLOB_SENSOR lcd_printPGM(PSTR(" mm")); +} - u8g.setColorIndex(1); // black on white - - u8g.drawBox(0, 42, 128, DOG_CHAR_HEIGHT+1); - u8g.setColorIndex(0); // following text must be white on black +static void lcd_implementation_status_screen_filament_status_bar(int leftColumnStart, int rightColumnStart, int row) +{ + uint16_t time; + u8g.setColorIndex(1); // black on white + u8g.drawBox(0, 42, 128, DOG_CHAR_HEIGHT + 1); + //Time //=Elapsed time + u8g.setColorIndex(0); // following text must be white on black u8g.setFont(u8g_font_6x10_marlin); - u8g.setPrintPos(3, 52); - u8g.print(LCD_STR_CLOCK[0]); - u8g.setFont(FONT_STATUSMENU); - u8g.setPrintPos(leftColumnStart, 51); + u8g.setPrintPos(leftColumnStart-2 * DOG_CHAR_WIDTH + 3, row + 1); + u8g.print(LCD_STR_CLOCK[0]); + u8g.setFont(FONT_STATUSMENU); + u8g.setPrintPos(leftColumnStart, row); time = duration / 60000; u8g.print(itostr2(time / 60)); u8g.print(':'); u8g.print(itostr2(time % 60)); - //=ExpectedTime - //I excluded this to make the screen les crowded - //Filament length //=Lenght icon - const int iconX = rightColumnStart-12; - const int iconY = 48; - - u8g.drawPixel(iconX,iconY); - u8g.drawPixel(iconX,iconY+2); - u8g.drawPixel(iconX+9,iconY); - u8g.drawPixel(iconX+9,iconY+2); - u8g.drawPixel(iconX+1,iconY+1); - u8g.drawPixel(iconX+2,iconY+1); - u8g.drawPixel(iconX+3,iconY+1); - u8g.drawPixel(iconX+4,iconY+1); - u8g.drawPixel(iconX+5,iconY+1); - u8g.drawPixel(iconX+6,iconY+1); - u8g.drawPixel(iconX+7,iconY+1); - u8g.drawPixel(iconX+8,iconY+1); + const int iconX = rightColumnStart - 12; + const int iconY = row-3; + + u8g.drawPixel(iconX, iconY); + u8g.drawPixel(iconX, iconY + 2); + u8g.drawPixel(iconX + 9, iconY); + u8g.drawPixel(iconX + 9, iconY + 2); + u8g.drawPixel(iconX + 1, iconY + 1); + u8g.drawPixel(iconX + 2, iconY + 1); + u8g.drawPixel(iconX + 3, iconY + 1); + u8g.drawPixel(iconX + 4, iconY + 1); + u8g.drawPixel(iconX + 5, iconY + 1); + u8g.drawPixel(iconX + 6, iconY + 1); + u8g.drawPixel(iconX + 7, iconY + 1); + u8g.drawPixel(iconX + 8, iconY + 1); //=Lenght icon end - u8g.setPrintPos(rightColumnStart, 51); + u8g.setPrintPos(rightColumnStart, row); u8g.print(ftostr6(extrude_length)); lcd_printPGM(PSTR(" mm")); - u8g.setColorIndex(1); + u8g.setColorIndex(1); +} + +static void lcd_implementation_status_screen() +{ + const int leftColumnStart = 12; + const int rightColumnStart = 70; + + u8g.setColorIndex(1); // black on white + + u8g.drawBitmapP(1, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT, status_screen0_bmp); + + //Extruder + //=nozzle temperature + lcd_implementation_status_screen_nozzle_temperature(leftColumnStart, 10); + + //=RPM + lcd_implementation_status_screen_extruder_rpm(rightColumnStart, 10); + + //Puller + lcd_implementation_status_screen_puller_feedrate(leftColumnStart, 25); + + lcd_implementation_status_screen_puller_rpm(rightColumnStart, 25); + + //Filament + //=Sensor + lcd_implementation_status_screen_sensor_data(leftColumnStart, 37); + + //Filament extrusion status + lcd_implementation_status_screen_filament_status_bar(leftColumnStart, rightColumnStart, 51); // Status line u8g.setFont(FONT_STATUSMENU); From 40342588a47f366e76249d52b8e0c5bfccf6094d Mon Sep 17 00:00:00 2001 From: Mylan719 Date: Sat, 11 Jun 2022 15:52:38 +0200 Subject: [PATCH 5/7] Unified the look of setting menu with other menus. --- Mackerel/dogm_lcd_implementation.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Mackerel/dogm_lcd_implementation.h b/Mackerel/dogm_lcd_implementation.h index 7efc4e0..ddbb0f8 100644 --- a/Mackerel/dogm_lcd_implementation.h +++ b/Mackerel/dogm_lcd_implementation.h @@ -365,8 +365,20 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char c; uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data); + if ((pre_char == '>') || (pre_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 + } + else + u8g.setColorIndex(1); // unmarked text is black on white + u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); - u8g.print(pre_char); + if (pre_char != '>') + u8g.print(pre_char); + else + u8g.print(' '); // Row selector is obsolete while ((c = pgm_read_byte(pstr)) != '\0') { From b1c6cf19eaa2b01a2c6d34acb804035ae4f2e483 Mon Sep 17 00:00:00 2001 From: Mylan719 Date: Sat, 11 Jun 2022 16:56:12 +0200 Subject: [PATCH 6/7] Fixed strange behavior of encoder - when using the full graphics dispaly --- Mackerel/ultralcd.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Mackerel/ultralcd.cpp b/Mackerel/ultralcd.cpp index 3375082..93bd017 100644 --- a/Mackerel/ultralcd.cpp +++ b/Mackerel/ultralcd.cpp @@ -100,16 +100,25 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l #define ENCODER_FEEDRATE_DEADZONE 10 -#if !defined(LCD_I2C_VIKI) + + +#if defined(LCD_I2C_VIKI) #ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM 5 + #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation #endif #ifndef ENCODER_PULSES_PER_STEP #define ENCODER_PULSES_PER_STEP 1 #endif +#elif defined(DOGLCD) + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 1 + #endif + #ifndef ENCODER_PULSES_PER_STEP + #define ENCODER_PULSES_PER_STEP 4 + #endif #else #ifndef ENCODER_STEPS_PER_MENU_ITEM - #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation + #define ENCODER_STEPS_PER_MENU_ITEM 5 #endif #ifndef ENCODER_PULSES_PER_STEP #define ENCODER_PULSES_PER_STEP 1 From 0401b0e699dcda2de424d0a10283926e2ed3d734 Mon Sep 17 00:00:00 2001 From: Mylan719 Date: Sat, 11 Jun 2022 17:40:53 +0200 Subject: [PATCH 7/7] Renamed "Winder RRPM Factor" to "Winder max RPM" - since it is clearer and shorter. - shortened "ESteps/rev/100" to "Esteps/rev" the "/100" part did not fit on the display --- Mackerel/language.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mackerel/language.h b/Mackerel/language.h index 3a1ee32..fc79558 100644 --- a/Mackerel/language.h +++ b/Mackerel/language.h @@ -118,7 +118,7 @@ #define MSG_NOZZLE2 "Nozzle3" #define MSG_BED "Bed" #define MSG_WINDER_SPEED "Winder RPM" - #define MSG_WINDER_RPM_FACTOR "Winder RPM Factor" + #define MSG_WINDER_RPM_FACTOR "Winder max RPM" #define MSG_FLOW "Flow" #define MSG_FLOW0 "Flow 0" #define MSG_FLOW1 "Flow 1" @@ -151,7 +151,7 @@ #define MSG_XSTEPS "Xsteps/mm" #define MSG_YSTEPS "Ysteps/mm" #define MSG_ZSTEPS "Zsteps/mm" - #define MSG_ESTEPS "Esteps/rev/100" + #define MSG_ESTEPS "Esteps/rev" #define MSG_PSTEPS "Psteps/mm" #define MSG_RECTRACT "Rectract" #define MSG_TEMPERATURE "Temperature"