Explorar o código

Fix rendering temp. + toolchange on MMU error screen

D.R.racer %!s(int64=2) %!d(string=hai) anos
pai
achega
f94c2cba46
Modificáronse 3 ficheiros con 21 adicións e 26 borrados
  1. 8 16
      Firmware/mmu2_reporting.cpp
  2. 11 10
      Firmware/ultralcd.cpp
  3. 2 0
      Firmware/ultralcd.h

+ 8 - 16
Firmware/mmu2_reporting.cpp

@@ -27,26 +27,18 @@ void EndReport(CommandInProgress cip, uint16_t ec) {
  * @brief Renders any characters that will be updated live on the MMU error screen.
  *Currently, this is FINDA and Filament Sensor status and Extruder temperature.
  */
-extern void ReportErrorHookDynamicRender(void)
-{
-    lcd_set_cursor(3, 2);
-    lcd_printf_P(PSTR("%d"), mmu2.FindaDetectsFilament());
-
-    lcd_set_cursor(8, 2);
-    lcd_printf_P(PSTR("%d"), fsensor.getFilamentPresent());
-
-    lcd_set_cursor(11, 2);
-    lcd_print("?>?"); // This is temporary until below TODO is resolved
+extern void ReportErrorHookDynamicRender(void){
+    // beware - this optimization abuses the fact, that FindaDetectsFilament returns 0 or 1 and '0' is followed by '1' in the ASCII table
+    lcd_putc_at(3, 2, mmu2.FindaDetectsFilament() + '0');
+    lcd_putc_at(8, 2, fsensor.getFilamentPresent() + '0');
 
-    // TODO, see lcdui_print_extruder(void)
-    //if (MMU2::mmu2.get_current_tool() == MMU2::FILAMENT_UNKNOWN)
-    //    lcd_printf_P(_N(" ?>%u"), tmp_extruder + 1);
-    //else
-    //    lcd_printf_P(_N(" %u>%u"), MMU2::mmu2.get_current_tool() + 1, tmp_extruder + 1);
+    // print active/changing filament slot
+    lcd_set_cursor(10, 2);
+    lcdui_print_extruder();
 
     // Print active extruder temperature
     lcd_set_cursor(16, 2);
-    lcd_printf_P(PSTR("%d"), (int)(degHotend(0) + 0.5));
+    lcd_printf_P(PSTR("%3d"), (int)(degHotend(0) + 0.5));
 }
 
 /**

+ 11 - 10
Firmware/ultralcd.cpp

@@ -463,7 +463,7 @@ void lcdui_print_percent_done(void)
 //              [nr1.] ranges from 1 to 5.
 //              [nr2.] ranges from 1 to 5.
 //              Filament [nr1.] was loaded, but [nr2.] is currently being loaded via tool change
-void lcdui_print_extruder(void) {
+uint8_t lcdui_print_extruder(void) {
     uint8_t chars = 0;
     if (MMU2::mmu2.get_current_tool() == MMU2::mmu2.get_tool_change_tool()) {
         if (MMU2::mmu2.get_current_tool() == (uint8_t)MMU2::FILAMENT_UNKNOWN) {
@@ -478,7 +478,7 @@ void lcdui_print_extruder(void) {
             chars = lcd_printf_P(_N(" %u>%u"), MMU2::mmu2.get_current_tool() + 1, MMU2::mmu2.get_tool_change_tool() + 1);
         }
     }
-    lcd_space(5 - chars);
+    return chars;
 }
 
 // Print farm number (5 chars total)
@@ -737,14 +737,15 @@ void lcdui_print_status_screen(void)
 	//Print SD status (7 chars)
 	lcdui_print_percent_done();
 
-	if (MMU2::mmu2.Enabled())
-		//Print extruder status (5 chars)
-		lcdui_print_extruder();
-	else if (farm_mode)
-		//Print farm number (5 chars)
-		lcdui_print_farm();
-	else
-		lcd_space(5); //5 spaces
+    if (MMU2::mmu2.Enabled()) {
+        // Print extruder status (5 chars)
+        lcd_space(5 - lcdui_print_extruder());
+    } else if (farm_mode) {
+        // Print farm number (5 chars)
+        lcdui_print_farm();
+    } else {
+        lcd_space(5); // 5 spaces
+    }
 
 #ifdef CMD_DIAGNOSTICS
     //Print cmd queue diagnostics (8chars)

+ 2 - 0
Firmware/ultralcd.h

@@ -242,6 +242,8 @@ void lcd_wizard(WizState state);
 extern void lcd_experimental_toggle();
 extern void lcd_experimental_menu();
 
+uint8_t lcdui_print_extruder(void);
+
 #ifdef PINDA_TEMP_COMP
 extern void lcd_pinda_temp_compensation_toggle();
 #endif //PINDA_TEMP_COMP