From eb6e3886f458c116bd1be364d29f30a2e003d8b0 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Tue, 7 Apr 2015 20:38:43 -0700
Subject: [PATCH 1/3] Set version to "1.0.3 dev"

---
 Marlin/Configuration.h                                          | 2 +-
 Marlin/configurator/config/Configuration.h                      | 2 +-
 Marlin/example_configurations/Felix/Configuration.h             | 2 +-
 Marlin/example_configurations/Felix/Configuration_DUAL.h        | 2 +-
 Marlin/example_configurations/Hephestos/Configuration.h         | 2 +-
 Marlin/example_configurations/K8200/Configuration.h             | 2 +-
 Marlin/example_configurations/SCARA/Configuration.h             | 2 +-
 Marlin/example_configurations/WITBOX/Configuration.h            | 2 +-
 Marlin/example_configurations/delta/generic/Configuration.h     | 2 +-
 Marlin/example_configurations/delta/kossel_mini/Configuration.h | 2 +-
 Marlin/example_configurations/makibox/Configuration.h           | 2 +-
 Marlin/example_configurations/tvrrug/Round2/Configuration.h     | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 33a419b6b7..35062d1af1 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -40,7 +40,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h
index 52d0d4b851..0b20b65701 100644
--- a/Marlin/configurator/config/Configuration.h
+++ b/Marlin/configurator/config/Configuration.h
@@ -40,7 +40,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h
index 7778488521..d64c6e4e9e 100644
--- a/Marlin/example_configurations/Felix/Configuration.h
+++ b/Marlin/example_configurations/Felix/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h
index 0e99709418..a689fdef6b 100644
--- a/Marlin/example_configurations/Felix/Configuration_DUAL.h
+++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h
index bc644f8c68..3a7dd2a9f1 100644
--- a/Marlin/example_configurations/Hephestos/Configuration.h
+++ b/Marlin/example_configurations/Hephestos/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(bq Hephestos)" // Who made the changes.
diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h
index 9d741d430a..48e7d72f57 100644
--- a/Marlin/example_configurations/K8200/Configuration.h
+++ b/Marlin/example_configurations/K8200/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(K8200, CONSULitAS)" // Who made the changes.
diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h
index 8bdb407ddc..00f7c662b4 100644
--- a/Marlin/example_configurations/SCARA/Configuration.h
+++ b/Marlin/example_configurations/SCARA/Configuration.h
@@ -56,7 +56,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h
index d308fbd028..0e1eb87163 100644
--- a/Marlin/example_configurations/WITBOX/Configuration.h
+++ b/Marlin/example_configurations/WITBOX/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(bq Witbox)" // Who made the changes.
diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h
index 8bb4b3a8f8..f2622d326d 100644
--- a/Marlin/example_configurations/delta/generic/Configuration.h
+++ b/Marlin/example_configurations/delta/generic/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h
index d594cde726..2ac8e6f57b 100644
--- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h
+++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h
index 6c4bdc2325..7e64a931c7 100644
--- a/Marlin/example_configurations/makibox/Configuration.h
+++ b/Marlin/example_configurations/makibox/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h
index 81f4dab5d2..d3dcf11e32 100644
--- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h
+++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h
@@ -38,7 +38,7 @@ Here are some standard links for getting your machine calibrated:
 // User-specified version info of this build to display in [Pronterface, etc] terminal window during
 // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
 // build by the user have been successfully uploaded into firmware.
-#define STRING_VERSION "1.0.2"
+#define STRING_VERSION "1.0.3 dev"
 #define STRING_URL "reprap.org"
 #define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
 #define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.

From 43773ff735efa6e83b5d0a437de032210b4b5761 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Tue, 7 Apr 2015 21:11:03 -0700
Subject: [PATCH 2/3] Formatting and lcd contrast masking

---
 Marlin/dogm_lcd_implementation.h | 29 ++++++------
 Marlin/ultralcd.cpp              | 80 ++++++++++++++++----------------
 2 files changed, 55 insertions(+), 54 deletions(-)

diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h
index f940a89755..627bbc8c57 100644
--- a/Marlin/dogm_lcd_implementation.h
+++ b/Marlin/dogm_lcd_implementation.h
@@ -198,16 +198,16 @@ static void lcd_implementation_init()
   u8g.setContrast(lcd_contrast);	
 	// FIXME: remove this workaround
   // Uncomment this if you have the first generation (V1.10) of STBs board
-	// pinMode(17, OUTPUT);	// Enable LCD backlight
-	// digitalWrite(17, HIGH);
-  
-#ifdef LCD_SCREEN_ROT_90
-	u8g.setRot90();   // Rotate screen by 90°
-#elif defined(LCD_SCREEN_ROT_180)
-	u8g.setRot180();	// Rotate screen by 180°
-#elif defined(LCD_SCREEN_ROT_270)
-	u8g.setRot270();	// Rotate screen by 270°
-#endif
+  // pinMode(17, OUTPUT);	// Enable LCD backlight
+  // digitalWrite(17, HIGH);
+
+  #ifdef LCD_SCREEN_ROT_90
+    u8g.setRot90();   // Rotate screen by 90°
+  #elif defined(LCD_SCREEN_ROT_180)
+    u8g.setRot180();	// Rotate screen by 180°
+  #elif defined(LCD_SCREEN_ROT_270)
+    u8g.setRot270();	// Rotate screen by 270°
+  #endif
 	
   // Show splashscreen
   int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
@@ -220,7 +220,7 @@ static void lcd_implementation_init()
   int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2;
 
 	u8g.firstPage();
-	do {
+  do {
     if (show_splashscreen) {
       u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
       lcd_setFont(FONT_MENU);
@@ -232,7 +232,7 @@ static void lcd_implementation_init()
         u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2);
       #endif
     }
-	} while (u8g.nextPage());
+  } while (u8g.nextPage());
   show_splashscreen = false;
 }
 
@@ -295,20 +295,19 @@ static void lcd_implementation_status_screen() {
       lcd_printPGM(PSTR("--:--"));
     }
   #endif
- 
+
   // Extruders
   for (int i=0; i<EXTRUDERS; i++) _draw_heater_status(6 + i * 25, i);
 
   // Heatbed
   if (EXTRUDERS < 4) _draw_heater_status(81, -1);
- 
+
   // Fan
   lcd_setFont(FONT_STATUSMENU);
   u8g.setPrintPos(104,27);
   #if HAS_FAN
     int per = ((fanSpeed + 1) * 100) / 256;
     if (per) {
-
       lcd_print(itostr3(per));
       lcd_print('%');
     }
diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp
index fc271f4e06..8b28ffa067 100644
--- a/Marlin/ultralcd.cpp
+++ b/Marlin/ultralcd.cpp
@@ -422,7 +422,7 @@ static void lcd_main_menu() {
   END_MENU();
 }
 
-#if defined( SDSUPPORT ) && defined( MENU_ADDAUTOSTART )
+#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART)
   static void lcd_autostart_sd() {
     card.autostart_index = 0;
     card.setroot();
@@ -431,7 +431,7 @@ static void lcd_main_menu() {
 #endif
 
 void lcd_set_home_offsets() {
-  for(int8_t i=0; i < NUM_AXIS; i++) {
+  for (int8_t i=0; i < NUM_AXIS; i++) {
     if (i != E_AXIS) {
       home_offset[i] -= current_position[i];
       current_position[i] = 0.0;
@@ -965,48 +965,49 @@ static void lcd_control_volumetric_menu() {
 
 #ifdef DOGLCD
 
-static void lcd_set_contrast() {
-  if (encoderPosition != 0) {
-    lcd_contrast -= encoderPosition;
-    if (lcd_contrast < 0) lcd_contrast = 0;
-    else if (lcd_contrast > 63) lcd_contrast = 63;
-    encoderPosition = 0;
-    lcdDrawUpdate = 1;
-    u8g.setContrast(lcd_contrast);
+  static void lcd_set_contrast() {
+    if (encoderPosition != 0) {
+      lcd_contrast -= encoderPosition;
+      lcd_contrast &= 0x3F;
+      encoderPosition = 0;
+      lcdDrawUpdate = 1;
+      u8g.setContrast(lcd_contrast);
+    }
+    if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
+    if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
   }
-  if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
-  if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
-}
 
-#endif //DOGLCD
+#endif // DOGLCD
 
 #ifdef FWRETRACT
 
-static void lcd_control_retract_menu() {
-  START_MENU();
-  MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
-  MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
-  MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
-  #if EXTRUDERS > 1
-    MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100);
-  #endif
-  MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
-  MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
-  MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
-  #if EXTRUDERS > 1
-    MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100);
-  #endif
-  MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
-  END_MENU();
-}
+  static void lcd_control_retract_menu() {
+    START_MENU();
+    MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
+    MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
+    MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
+    #if EXTRUDERS > 1
+      MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100);
+    #endif
+    MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
+    MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
+    MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
+    #if EXTRUDERS > 1
+      MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100);
+    #endif
+    MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
+    END_MENU();
+  }
 
-#endif //FWRETRACT
+#endif // FWRETRACT
 
 #if SDCARDDETECT == -1
+
   static void lcd_sd_refresh() {
     card.initsd();
     currentMenuViewOffset = 0;
   }
+
 #endif
 
 static void lcd_sd_updir() {
@@ -1029,13 +1030,14 @@ void lcd_sdcard_menu() {
     MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
   }
 
-  for(uint16_t i = 0; i < fileCnt; i++) {
+  for (uint16_t i = 0; i < fileCnt; i++) {
     if (_menuItemNr == _lineNr) {
-      #ifndef SDCARD_RATHERRECENTFIRST
-        card.getfilename(i);
-      #else
-        card.getfilename(fileCnt-1-i);
-      #endif
+      card.getfilename(
+        #ifdef SDCARD_RATHERRECENTFIRST
+          fileCnt-1 -
+        #endif
+        i
+      );
       if (card.filenameIsDir)
         MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
       else
@@ -1456,7 +1458,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
 
 #ifdef DOGLCD
   void lcd_setcontrast(uint8_t value) {
-    lcd_contrast = value & 63;
+    lcd_contrast = value & 0x3F;
     u8g.setContrast(lcd_contrast);
   }
 #endif

From 756bb5e268208af6ac7b7bd8a1ca818f55850649 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Tue, 7 Apr 2015 22:04:10 -0700
Subject: [PATCH 3/3] Cleanup formatting in hitachi & dogm lcd

---
 Marlin/dogm_lcd_implementation.h              |  28 +--
 .../ultralcd_implementation_hitachi_HD44780.h | 226 ++++++++++--------
 2 files changed, 134 insertions(+), 120 deletions(-)

diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h
index 627bbc8c57..2a6d229b7f 100644
--- a/Marlin/dogm_lcd_implementation.h
+++ b/Marlin/dogm_lcd_implementation.h
@@ -37,8 +37,8 @@
 
 // save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT
 // we don't have a big font for Cyrillic, Kana
-#if defined( MAPPER_C2C3 ) || defined( MAPPER_NON )
-//  #define USE_BIG_EDIT_FONT
+#if defined(MAPPER_C2C3) || defined(MAPPER_NON)
+  //#define USE_BIG_EDIT_FONT
 #endif
 
 // If you have spare 2300Byte of progmem and want to use a 
@@ -126,17 +126,17 @@
 
 // LCD selection
 #ifdef U8GLIB_ST7920
-//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
-U8GLIB_ST7920_128X64_RRD u8g(0);
+  //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
+  U8GLIB_ST7920_128X64_RRD u8g(0);
 #elif defined(MAKRPANEL)
-// The MaKrPanel display, ST7565 controller as well
-U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
+  // The MaKrPanel display, ST7565 controller as well
+  U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
 #elif defined(VIKI2) || defined(miniVIKI)
-// Mini Viki and Viki 2.0 LCD, ST7565 controller as well
-U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
+  // Mini Viki and Viki 2.0 LCD, ST7565 controller as well
+  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
+  // for regular DOGM128 display with HW-SPI
+  U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);  // HW-SPI Com: CS, A0
 #endif
 
 #include "utf_mapper.h"
@@ -188,8 +188,8 @@ char lcd_printPGM(const char* str) {
 
 static bool show_splashscreen = true;
 
-static void lcd_implementation_init()
-{
+static void lcd_implementation_init() {
+
   #ifdef LCD_PIN_BL // Enable LCD backlight
     pinMode(LCD_PIN_BL, OUTPUT);
 	  digitalWrite(LCD_PIN_BL, HIGH);
@@ -359,9 +359,9 @@ static void lcd_implementation_status_screen() {
   // Status line
   lcd_setFont(FONT_STATUSMENU);
   #ifdef USE_SMALL_INFOFONT
-  u8g.setPrintPos(0,62);
+    u8g.setPrintPos(0,62);
   #else
-  u8g.setPrintPos(0,63);
+    u8g.setPrintPos(0,63);
   #endif
   #ifndef FILAMENT_LCD_DISPLAY
     lcd_print(lcd_status_message);
diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h
index 4819e3e00b..5698fd94b9 100644
--- a/Marlin/ultralcd_implementation_hitachi_HD44780.h
+++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h
@@ -443,7 +443,7 @@ Possible status screens:
 
 20x4   |01234567890123456789|
        |T000/000D B000/000D |
-       |X+000.0 Y+000.0 Z+000.0|
+       |X000  Y000   Z000.00|
        |F100%  SD100% T--:--|
        |Status line.........|
 
@@ -453,141 +453,154 @@ Possible status screens:
        |F100%  SD100% T--:--|
        |Status line.........|
 */
-static void lcd_implementation_status_screen()
-{
-    int tHotend=int(degHotend(0) + 0.5);
-    int tTarget=int(degTargetHotend(0) + 0.5);
+static void lcd_implementation_status_screen() {
+  int tHotend = int(degHotend(0) + 0.5);
+  int tTarget = int(degTargetHotend(0) + 0.5);
+
+  #if LCD_WIDTH < 20
 
-#if LCD_WIDTH < 20
     lcd.setCursor(0, 0);
     lcd.print(itostr3(tHotend));
     lcd.print('/');
     lcd.print(itostr3left(tTarget));
 
-# 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(8, 0);
-#  if EXTRUDERS > 1
-    tHotend = int(degHotend(1) + 0.5);
-    tTarget = int(degTargetHotend(1) + 0.5);
-    lcd.print(LCD_STR_THERMOMETER[0]);
-#  else//Heated bed
-    tHotend=int(degBed() + 0.5);
-    tTarget=int(degTargetBed() + 0.5);
-    lcd.print(LCD_STR_BEDTEMP[0]);
-#  endif
-    lcd.print(itostr3(tHotend));
-    lcd.print('/');
-    lcd.print(itostr3left(tTarget));
-# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
+    #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(8, 0);
+      #if EXTRUDERS > 1
+        tHotend = int(degHotend(1) + 0.5);
+        tTarget = int(degTargetHotend(1) + 0.5);
+        lcd.print(LCD_STR_THERMOMETER[0]);
+      #else // Heated bed
+        tHotend = int(degBed() + 0.5);
+        tTarget = int(degTargetBed() + 0.5);
+        lcd.print(LCD_STR_BEDTEMP[0]);
+      #endif
+      lcd.print(itostr3(tHotend));
+      lcd.print('/');
+      lcd.print(itostr3left(tTarget));
+
+    #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
+
+  #else // LCD_WIDTH > 19
 
-#else//LCD_WIDTH > 19
     lcd.setCursor(0, 0);
     lcd.print(LCD_STR_THERMOMETER[0]);
     lcd.print(itostr3(tHotend));
     lcd.print('/');
     lcd.print(itostr3left(tTarget));
     lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
-    if (tTarget < 10)
-        lcd.print(' ');
+    if (tTarget < 10) lcd.print(' ');
 
-# 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);
-#  if EXTRUDERS > 1
-    tHotend = int(degHotend(1) + 0.5);
-    tTarget = int(degTargetHotend(1) + 0.5);
-    lcd.print(LCD_STR_THERMOMETER[0]);
-#  else//Heated bed
-    tHotend=int(degBed() + 0.5);
-    tTarget=int(degTargetBed() + 0.5);
-    lcd.print(LCD_STR_BEDTEMP[0]);
-#  endif
-    lcd.print(itostr3(tHotend));
-    lcd.print('/');
-    lcd.print(itostr3left(tTarget));
-    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
-    if (tTarget < 10)
-        lcd.print(' ');
-# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
-#endif//LCD_WIDTH > 19
+    #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);
+      #if EXTRUDERS > 1
+        tHotend = int(degHotend(1) + 0.5);
+        tTarget = int(degTargetHotend(1) + 0.5);
+        lcd.print(LCD_STR_THERMOMETER[0]);
+      #else // Heated bed
+        tHotend = int(degBed() + 0.5);
+        tTarget = int(degTargetBed() + 0.5);
+        lcd.print(LCD_STR_BEDTEMP[0]);
+      #endif
+      lcd.print(itostr3(tHotend));
+      lcd.print('/');
+      lcd.print(itostr3left(tTarget));
+      lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
+      if (tTarget < 10) lcd.print(' ');
 
-#if LCD_HEIGHT > 2
-//Lines 2 for 4 line LCD
-# if LCD_WIDTH < 20
-#  ifdef SDSUPPORT
-    lcd.setCursor(0, 2);
-    lcd_printPGM(PSTR("SD"));
-    if (IS_SD_PRINTING)
-        lcd.print(itostr3(card.percentDone()));
-    else
-        lcd_printPGM(PSTR("---"));
-    lcd.print('%');
-#  endif//SDSUPPORT
-# else//LCD_WIDTH > 19
-#  if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
-    //If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
-    tHotend=int(degBed() + 0.5);
-    tTarget=int(degTargetBed() + 0.5);
+    #endif  // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
+
+  #endif // LCD_WIDTH > 19
+
+  #if LCD_HEIGHT > 2
+    // Lines 2 for 4 line LCD
+    #if LCD_WIDTH < 20
+      #ifdef SDSUPPORT
+        lcd.setCursor(0, 2);
+        lcd_printPGM(PSTR("SD"));
+        if (IS_SD_PRINTING)
+          lcd.print(itostr3(card.percentDone()));
+        else
+          lcd_printPGM(PSTR("---"));
+          lcd.print('%');
+      #endif // SDSUPPORT
+
+    #else // LCD_WIDTH > 19
+
+      #if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
+        // If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
+        tHotend = int(degBed() + 0.5);
+        tTarget = int(degTargetBed() + 0.5);
+
+        lcd.setCursor(0, 1);
+        lcd.print(LCD_STR_BEDTEMP[0]);
+        lcd.print(itostr3(tHotend));
+        lcd.print('/');
+        lcd.print(itostr3left(tTarget));
+        lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
+        if (tTarget < 10) lcd.print(' ');
+      #else
+        lcd.setCursor(0,1);
+        lcd.print('X');
+        lcd.print(ftostr3(current_position[X_AXIS]));
+        lcd_printPGM(PSTR("  Y"));
+        lcd.print(ftostr3(current_position[Y_AXIS]));
+      #endif // EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
+
+    #endif // LCD_WIDTH > 19
 
-    lcd.setCursor(0, 1);
-    lcd.print(LCD_STR_BEDTEMP[0]);
-    lcd.print(itostr3(tHotend));
-    lcd.print('/');
-    lcd.print(itostr3left(tTarget));
-    lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
-    if (tTarget < 10)
-        lcd.print(' ');
-#  else
-    lcd.setCursor(0,1);
-    lcd.print('X');
-    lcd.print(ftostr3(current_position[X_AXIS]));
-    lcd_printPGM(PSTR(" Y"));
-    lcd.print(ftostr3(current_position[Y_AXIS]));
-#  endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
-# endif//LCD_WIDTH > 19
     lcd.setCursor(LCD_WIDTH - 8, 1);
     lcd.print('Z');
     lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
-#endif//LCD_HEIGHT > 2
 
-#if LCD_HEIGHT > 3
+  #endif // LCD_HEIGHT > 2
+
+  #if LCD_HEIGHT > 3
+
     lcd.setCursor(0, 2);
     lcd.print(LCD_STR_FEEDRATE[0]);
     lcd.print(itostr3(feedmultiply));
     lcd.print('%');
-# if LCD_WIDTH > 19
-#  ifdef SDSUPPORT
-    lcd.setCursor(7, 2);
-    lcd_printPGM(PSTR("SD"));
-    if (IS_SD_PRINTING)
+
+    #if LCD_WIDTH > 19 && defined(SDSUPPORT)
+
+      lcd.setCursor(7, 2);
+      lcd_printPGM(PSTR("SD"));
+      if (IS_SD_PRINTING)
         lcd.print(itostr3(card.percentDone()));
-    else
+      else
         lcd_printPGM(PSTR("---"));
-    lcd.print('%');
-#  endif//SDSUPPORT
-# endif//LCD_WIDTH > 19
+      lcd.print('%');
+
+    #endif // LCD_WIDTH > 19 && SDSUPPORT
+
     lcd.setCursor(LCD_WIDTH - 6, 2);
     lcd.print(LCD_STR_CLOCK[0]);
-    if(starttime != 0)
-    {
-        uint16_t time = millis()/60000 - starttime/60000;
-        lcd.print(itostr2(time/60));
-        lcd.print(':');
-        lcd.print(itostr2(time%60));
-    }else{
-        lcd_printPGM(PSTR("--:--"));
+    if (starttime != 0) {
+      uint16_t time = millis()/60000 - starttime/60000;
+      lcd.print(itostr2(time/60));
+      lcd.print(':');
+      lcd.print(itostr2(time%60));
+    }
+    else {
+      lcd_printPGM(PSTR("--:--"));
     }
-#endif
 
-  // Status message line at the bottom
+  #endif // LCD_HEIGHT > 3
+
+  /**
+   * Display Progress Bar, Filament display, and/or Status Message on the last line
+   */
+
   lcd.setCursor(0, LCD_HEIGHT - 1);
 
   #ifdef LCD_PROGRESS_BAR
 
     if (card.isFileOpen()) {
-      uint16_t mil = millis(), diff = mil - progressBarTick;
-      if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
+      if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
         // draw the progress bar
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
@@ -605,11 +618,11 @@ static void lcd_implementation_status_screen()
       }
     } //card.isFileOpen
 
-  #endif //LCD_PROGRESS_BAR
+  #elif defined(FILAMENT_LCD_DISPLAY)
 
-  //Display both Status message line and Filament display on the last line
-  #ifdef FILAMENT_LCD_DISPLAY
-    if (message_millis + 5000 <= millis()) {  //display any status for the first 5 sec after screen is initiated
+    // Show Filament Diameter and Volumetric Multiplier %
+    // After allowing lcd_status_message to show for 5 seconds
+    if (millis() >= message_millis + 5000) {
       lcd_printPGM(PSTR("Dia "));
       lcd.print(ftostr12ns(filament_width_meas));
       lcd_printPGM(PSTR(" V"));
@@ -617,7 +630,8 @@ static void lcd_implementation_status_screen()
   	  lcd.print('%');
   	  return;
     }
-  #endif //FILAMENT_LCD_DISPLAY
+
+  #endif // FILAMENT_LCD_DISPLAY
 
   lcd_print(lcd_status_message);
 }