Browse Source

Better cold extrusion prevention in LCD menu (#12189)

Scott Lahteine 6 years ago
parent
commit
3a46212dd8
No account linked to committer's email address
2 changed files with 16 additions and 6 deletions
  1. 3
    0
      Marlin/src/lcd/language/language_en.h
  2. 13
    6
      Marlin/src/lcd/ultralcd.cpp

+ 3
- 0
Marlin/src/lcd/language/language_en.h View File

480
 #ifndef MSG_MOVE_E
480
 #ifndef MSG_MOVE_E
481
   #define MSG_MOVE_E                          _UxGT("Extruder")
481
   #define MSG_MOVE_E                          _UxGT("Extruder")
482
 #endif
482
 #endif
483
+#ifndef MSG_HOTEND_TOO_COLD
484
+  #define MSG_HOTEND_TOO_COLD                 _UxGT("Hotend too cold")
485
+#endif
483
 #ifndef MSG_MOVE_01MM
486
 #ifndef MSG_MOVE_01MM
484
   #define MSG_MOVE_01MM                       _UxGT("Move 0.1mm")
487
   #define MSG_MOVE_01MM                       _UxGT("Move 0.1mm")
485
 #endif
488
 #endif

+ 13
- 6
Marlin/src/lcd/ultralcd.cpp View File

341
 
341
 
342
   // Used to print static text with no visible cursor.
342
   // Used to print static text with no visible cursor.
343
   // Parameters: label [, bool center [, bool invert [, char *value] ] ]
343
   // Parameters: label [, bool center [, bool invert [, char *value] ] ]
344
-  #define STATIC_ITEM_P(LABEL, ...) \
344
+  #define STATIC_ITEM_P(LABEL, ...) do{ \
345
     if (_menuLineNr == _thisItemNr) { \
345
     if (_menuLineNr == _thisItemNr) { \
346
       if (_skipStatic && encoderLine <= _thisItemNr) { \
346
       if (_skipStatic && encoderLine <= _thisItemNr) { \
347
         encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
347
         encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; \
350
       if (lcdDrawUpdate) \
350
       if (lcdDrawUpdate) \
351
         lcd_implementation_drawmenu_static(_lcdLineNr, LABEL, ## __VA_ARGS__); \
351
         lcd_implementation_drawmenu_static(_lcdLineNr, LABEL, ## __VA_ARGS__); \
352
     } \
352
     } \
353
-    ++_thisItemNr
353
+    ++_thisItemNr; } while(0)
354
 
354
 
355
   #define STATIC_ITEM(LABEL, ...) STATIC_ITEM_P(PSTR(LABEL), ## __VA_ARGS__)
355
   #define STATIC_ITEM(LABEL, ...) STATIC_ITEM_P(PSTR(LABEL), ## __VA_ARGS__)
356
 
356
 
3225
           break;
3225
           break;
3226
       }
3226
       }
3227
     }
3227
     }
3228
-    MENU_BACK(MSG_MOVE_AXIS);
3229
-    MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm);
3230
-    MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm);
3231
-    MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm);
3228
+    #if ENABLED(PREVENT_COLD_EXTRUSION)
3229
+      if (thermalManager.tooColdToExtrude(active_extruder))
3230
+        MENU_BACK(MSG_HOTEND_TOO_COLD);
3231
+      else
3232
+    #endif
3233
+    {
3234
+      MENU_BACK(MSG_MOVE_AXIS);
3235
+      MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm);
3236
+      MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm);
3237
+      MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm);
3238
+    }
3232
     END_MENU();
3239
     END_MENU();
3233
   }
3240
   }
3234
   void lcd_move_get_x_amount()        { _lcd_move_distance_menu(X_AXIS, lcd_move_x); }
3241
   void lcd_move_get_x_amount()        { _lcd_move_distance_menu(X_AXIS, lcd_move_x); }

Loading…
Cancel
Save