Browse Source

Merge pull request #8913 from thinkyhead/bf2_multitool_M600

[2.0.x] Multi extruder support for M600 / LCD
Scott Lahteine 7 years ago
parent
commit
f8156d2d2c
No account linked to committer's email address
2 changed files with 150 additions and 47 deletions
  1. 28
    12
      Marlin/src/gcode/feature/pause/M600.cpp
  2. 122
    35
      Marlin/src/lcd/ultralcd.cpp

+ 28
- 12
Marlin/src/gcode/feature/pause/M600.cpp View File

24
 
24
 
25
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
25
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
26
 
26
 
27
-#include "../../../feature/pause.h"
28
-
29
 #include "../../gcode.h"
27
 #include "../../gcode.h"
28
+#include "../../../feature/pause.h"
30
 #include "../../../module/motion.h"
29
 #include "../../../module/motion.h"
31
-#include "../../parser.h"
32
-
33
 #include "../../../module/printcounter.h"
30
 #include "../../../module/printcounter.h"
34
 
31
 
32
+#if EXTRUDERS > 1
33
+  #include "../../../module/tool_change.h"
34
+#endif
35
+
35
 /**
36
 /**
36
  * M600: Pause for filament change
37
  * M600: Pause for filament change
37
  *
38
  *
42
  *  U[distance] - Retract distance for removal (negative value) (manual reload)
43
  *  U[distance] - Retract distance for removal (negative value) (manual reload)
43
  *  L[distance] - Extrude distance for insertion (positive value) (manual reload)
44
  *  L[distance] - Extrude distance for insertion (positive value) (manual reload)
44
  *  B[count]    - Number of times to beep, -1 for indefinite (if equipped with a buzzer)
45
  *  B[count]    - Number of times to beep, -1 for indefinite (if equipped with a buzzer)
46
+ *  T[toolhead] - Select extruder for filament change
45
  *
47
  *
46
  *  Default values are used for omitted arguments.
48
  *  Default values are used for omitted arguments.
47
  *
49
  *
54
     if (axis_unhomed_error()) home_all_axes();
56
     if (axis_unhomed_error()) home_all_axes();
55
   #endif
57
   #endif
56
 
58
 
59
+  #if EXTRUDERS > 1
60
+    // Change toolhead if specified
61
+    uint8_t active_extruder_before_filament_change = -1;
62
+    if (parser.seen('T')) {
63
+      const uint8_t extruder = parser.value_byte();
64
+      if (active_extruder != extruder) {
65
+        active_extruder_before_filament_change = active_extruder;
66
+        tool_change(extruder, 0, true);
67
+      }
68
+    }
69
+  #endif
70
+
57
   // Initial retract before move to filament change position
71
   // Initial retract before move to filament change position
58
   const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
72
   const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
59
     #ifdef PAUSE_PARK_RETRACT_LENGTH
73
     #ifdef PAUSE_PARK_RETRACT_LENGTH
61
     #endif
75
     #endif
62
   ;
76
   ;
63
 
77
 
64
-  // Lift Z axis
65
-  if (parser.seenval('Z'))
66
-    park_point.z = parser.linearval('Z');
67
-
68
   // Move XY axes to filament change position or given position
78
   // Move XY axes to filament change position or given position
69
-  if (parser.seenval('X'))
70
-    park_point.x = parser.linearval('X');
79
+  if (parser.seenval('X')) park_point.x = parser.linearval('X');
80
+  if (parser.seenval('Y')) park_point.y = parser.linearval('Y');
71
 
81
 
72
-  if (parser.seenval('Y'))
73
-    park_point.y = parser.linearval('Y');
82
+  // Lift Z axis
83
+  if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
74
 
84
 
75
   #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE)
85
   #if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE)
76
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
86
     park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
106
     resume_print(load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, beep_count);
116
     resume_print(load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, beep_count);
107
   }
117
   }
108
 
118
 
119
+  #if EXTRUDERS > 1
120
+    // Restore toolhead if it was changed
121
+    if (active_extruder_before_filament_change >= 0)
122
+      tool_change(active_extruder_before_filament_change, 0, true);
123
+  #endif
124
+
109
   // Resume the print job timer if it was running
125
   // Resume the print job timer if it was running
110
   if (job_running) print_job_timer.start();
126
   if (job_running) print_job_timer.start();
111
 }
127
 }

+ 122
- 35
Marlin/src/lcd/ultralcd.cpp View File

295
    */
295
    */
296
   #define _MENU_ITEM_PART_1(TYPE, ...) \
296
   #define _MENU_ITEM_PART_1(TYPE, ...) \
297
     if (_menuLineNr == _thisItemNr) { \
297
     if (_menuLineNr == _thisItemNr) { \
298
-      if (lcd_clicked && encoderLine == _thisItemNr) {
298
+      if (encoderLine == _thisItemNr && lcd_clicked) { \
299
+        lcd_clicked = false
299
 
300
 
300
   #define _MENU_ITEM_PART_2(TYPE, LABEL, ...) \
301
   #define _MENU_ITEM_PART_2(TYPE, LABEL, ...) \
301
         menu_action_ ## TYPE(__VA_ARGS__); \
302
         menu_action_ ## TYPE(__VA_ARGS__); \
499
     float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits
500
     float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits
500
   #endif
501
   #endif
501
 
502
 
503
+  inline bool use_click() {
504
+    const bool click = lcd_clicked;
505
+    lcd_clicked = false;
506
+    return click;
507
+  }
508
+
502
   /**
509
   /**
503
    * General function to go directly to a screen
510
    * General function to go directly to a screen
504
    */
511
    */
678
 
685
 
679
   #if ENABLED(ULTIPANEL)
686
   #if ENABLED(ULTIPANEL)
680
 
687
 
681
-    if (lcd_clicked) {
688
+    if (use_click()) {
682
       #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
689
       #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
683
         previous_lcd_status_ms = millis();  // get status message to show up for a while
690
         previous_lcd_status_ms = millis();  // get status message to show up for a while
684
       #endif
691
       #endif
861
 
868
 
862
     static void progress_bar_test() {
869
     static void progress_bar_test() {
863
       static int8_t bar_percent = 0;
870
       static int8_t bar_percent = 0;
864
-      if (lcd_clicked) {
871
+      if (use_click()) {
865
         lcd_goto_previous_menu();
872
         lcd_goto_previous_menu();
866
         lcd_set_custom_characters(CHARSET_MENU);
873
         lcd_set_custom_characters(CHARSET_MENU);
867
         return;
874
         return;
1088
   #if ENABLED(BABYSTEPPING)
1095
   #if ENABLED(BABYSTEPPING)
1089
 
1096
 
1090
     void _lcd_babystep(const AxisEnum axis, const char* msg) {
1097
     void _lcd_babystep(const AxisEnum axis, const char* msg) {
1091
-      if (lcd_clicked) { return lcd_goto_previous_menu_no_defer(); }
1098
+      if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
1092
       ENCODER_DIRECTION_NORMAL();
1099
       ENCODER_DIRECTION_NORMAL();
1093
       if (encoderPosition) {
1100
       if (encoderPosition) {
1094
         const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
1101
         const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
1111
     #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
1118
     #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
1112
 
1119
 
1113
       void lcd_babystep_zoffset() {
1120
       void lcd_babystep_zoffset() {
1114
-        if (lcd_clicked) { return lcd_goto_previous_menu_no_defer(); }
1121
+        if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
1115
         defer_return_to_status = true;
1122
         defer_return_to_status = true;
1116
         ENCODER_DIRECTION_NORMAL();
1123
         ENCODER_DIRECTION_NORMAL();
1117
         if (encoderPosition) {
1124
         if (encoderPosition) {
1239
 
1246
 
1240
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
1247
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
1241
 
1248
 
1242
-    void lcd_enqueue_filament_change() {
1249
+    void lcd_enqueue_filament_change(
1250
+      #if EXTRUDERS > 1
1251
+        const uint8_t extruder
1252
+      #endif
1253
+    ) {
1243
 
1254
 
1244
       #if ENABLED(PREVENT_COLD_EXTRUSION)
1255
       #if ENABLED(PREVENT_COLD_EXTRUSION)
1245
-        if (!DEBUGGING(DRYRUN) && !thermalManager.allow_cold_extrude &&
1246
-            thermalManager.degTargetHotend(active_extruder) < thermalManager.extrude_min_temp) {
1256
+        if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder)) {
1247
           lcd_save_previous_screen();
1257
           lcd_save_previous_screen();
1248
           lcd_goto_screen(lcd_advanced_pause_toocold_menu);
1258
           lcd_goto_screen(lcd_advanced_pause_toocold_menu);
1249
           return;
1259
           return;
1251
       #endif
1261
       #endif
1252
 
1262
 
1253
       lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
1263
       lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT);
1254
-      enqueue_and_echo_commands_P(PSTR("M600 B0"));
1264
+
1265
+      #if EXTRUDERS <= 1
1266
+        enqueue_and_echo_commands_P(PSTR("M600 B0"));
1267
+      #else
1268
+        char *command_M600;
1269
+        switch (extruder) {
1270
+          case 0: command_M600 = PSTR("M600 B0 T0"); break;
1271
+          case 1: command_M600 = PSTR("M600 B0 T1"); break;
1272
+          #if EXTRUDERS > 2
1273
+            case 2: command_M600 = PSTR("M600 B0 T2"); break;
1274
+            #if EXTRUDERS > 3
1275
+              case 3: command_M600 = PSTR("M600 B0 T3"); break;
1276
+              #if EXTRUDERS > 4
1277
+                case 4: command_M600 = PSTR("M600 B0 T4"); break;
1278
+              #endif // EXTRUDERS > 4
1279
+            #endif // EXTRUDERS > 3
1280
+          #endif // EXTRUDERS > 2
1281
+        }
1282
+        enqueue_and_echo_commands_P(command_M600);
1283
+      #endif // EXTRUDERS > 1
1255
     }
1284
     }
1256
 
1285
 
1286
+    #if EXTRUDERS > 1
1287
+      void lcd_enqueue_filament_change_e0() { lcd_enqueue_filament_change(0); }
1288
+      void lcd_enqueue_filament_change_e1() { lcd_enqueue_filament_change(1); }
1289
+      #if EXTRUDERS > 2
1290
+        void lcd_enqueue_filament_change_e2() { lcd_enqueue_filament_change(2); }
1291
+        #if EXTRUDERS > 3
1292
+          void lcd_enqueue_filament_change_e3() { lcd_enqueue_filament_change(3); }
1293
+          #if EXTRUDERS > 4
1294
+            void lcd_enqueue_filament_change_e4() { lcd_enqueue_filament_change(4); }
1295
+          #endif // EXTRUDERS > 4
1296
+        #endif // EXTRUDERS > 3
1297
+      #endif // EXTRUDERS > 2
1298
+    #endif // EXTRUDERS > 1
1299
+
1257
   #endif // ADVANCED_PAUSE_FEATURE
1300
   #endif // ADVANCED_PAUSE_FEATURE
1258
 
1301
 
1259
   // First Fan Speed title in "Tune" and "Control>Temperature" menus
1302
   // First Fan Speed title in "Tune" and "Control>Temperature" menus
1397
     // Change filament
1440
     // Change filament
1398
     //
1441
     //
1399
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
1442
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
1400
-      if (!thermalManager.tooColdToExtrude(active_extruder))
1401
-        MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
1443
+      #if EXTRUDERS > 1
1444
+        if (!thermalManager.tooColdToExtrude(0))
1445
+          MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E1, lcd_enqueue_filament_change_e0);
1446
+        if (!thermalManager.tooColdToExtrude(1))
1447
+          MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E2, lcd_enqueue_filament_change_e1);
1448
+        #if EXTRUDERS > 2
1449
+          if (!thermalManager.tooColdToExtrude(2))
1450
+            MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E3, lcd_enqueue_filament_change_e2);
1451
+          #if EXTRUDERS > 3
1452
+            if (!thermalManager.tooColdToExtrude(3))
1453
+              MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E4, lcd_enqueue_filament_change_e3);
1454
+            #if EXTRUDERS > 4
1455
+              if (!thermalManager.tooColdToExtrude(4))
1456
+                MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E5, lcd_enqueue_filament_change_e4);
1457
+            #endif // EXTRUDERS > 4
1458
+          #endif // EXTRUDERS > 3
1459
+        #endif // EXTRUDERS > 2
1460
+      #else
1461
+        if (!thermalManager.tooColdToExtrude(active_extruder))
1462
+          MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
1463
+      #endif
1402
     #endif
1464
     #endif
1403
 
1465
 
1404
     END_MENU();
1466
     END_MENU();
1793
     void _lcd_level_bed_get_z() {
1855
     void _lcd_level_bed_get_z() {
1794
       ENCODER_DIRECTION_NORMAL();
1856
       ENCODER_DIRECTION_NORMAL();
1795
 
1857
 
1796
-      if (lcd_clicked) {
1858
+      if (use_click()) {
1797
 
1859
 
1798
         //
1860
         //
1799
         // Save the current Z position and move
1861
         // Save the current Z position and move
1873
      */
1935
      */
1874
     void _lcd_level_bed_homing_done() {
1936
     void _lcd_level_bed_homing_done() {
1875
       if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
1937
       if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING));
1876
-      if (lcd_clicked) {
1938
+      if (use_click()) {
1877
         manual_probe_index = 0;
1939
         manual_probe_index = 0;
1878
         _lcd_level_goto_next_point();
1940
         _lcd_level_goto_next_point();
1879
       }
1941
       }
2364
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
2426
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
2365
         return lcd_goto_screen(_lcd_ubl_map_homing);
2427
         return lcd_goto_screen(_lcd_ubl_map_homing);
2366
 
2428
 
2367
-      if (lcd_clicked) return _lcd_ubl_map_lcd_edit_cmd();
2429
+      if (use_click()) return _lcd_ubl_map_lcd_edit_cmd();
2368
       ENCODER_DIRECTION_NORMAL();
2430
       ENCODER_DIRECTION_NORMAL();
2369
 
2431
 
2370
       if (encoderPosition) {
2432
       if (encoderPosition) {
2588
     // Change filament
2650
     // Change filament
2589
     //
2651
     //
2590
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
2652
     #if ENABLED(ADVANCED_PAUSE_FEATURE)
2591
-      if (!thermalManager.tooColdToExtrude(active_extruder) && !IS_SD_FILE_OPEN)
2592
-        MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
2593
-    #endif
2653
+      if (!IS_SD_FILE_OPEN) {
2654
+        #if EXTRUDERS > 1
2655
+          if (!thermalManager.tooColdToExtrude(0))
2656
+            MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E1, lcd_enqueue_filament_change_e0);
2657
+          if (!thermalManager.tooColdToExtrude(1))
2658
+            MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E2, lcd_enqueue_filament_change_e1);
2659
+          #if EXTRUDERS > 2
2660
+            if (!thermalManager.tooColdToExtrude(2))
2661
+              MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E3, lcd_enqueue_filament_change_e2);
2662
+            #if EXTRUDERS > 3
2663
+              if (!thermalManager.tooColdToExtrude(3))
2664
+                MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E4, lcd_enqueue_filament_change_e3);
2665
+              #if EXTRUDERS > 4
2666
+                if (!thermalManager.tooColdToExtrude(4))
2667
+                  MENU_ITEM(function, MSG_FILAMENTCHANGE " " MSG_E5, lcd_enqueue_filament_change_e4);
2668
+              #endif // EXTRUDERS > 4
2669
+            #endif // EXTRUDERS > 3
2670
+          #endif // EXTRUDERS > 2
2671
+        #else
2672
+          if (!thermalManager.tooColdToExtrude(active_extruder))
2673
+            MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_enqueue_filament_change);
2674
+        #endif
2675
+      }
2676
+    #endif // ADVANCED_PAUSE_FEATURE
2594
 
2677
 
2595
     #if TEMP_SENSOR_0 != 0
2678
     #if TEMP_SENSOR_0 != 0
2596
 
2679
 
2833
    */
2916
    */
2834
 
2917
 
2835
   void _lcd_move_xyz(const char* name, AxisEnum axis) {
2918
   void _lcd_move_xyz(const char* name, AxisEnum axis) {
2836
-    if (lcd_clicked) { return lcd_goto_previous_menu(); }
2919
+    if (use_click()) { return lcd_goto_previous_menu(); }
2837
     ENCODER_DIRECTION_NORMAL();
2920
     ENCODER_DIRECTION_NORMAL();
2838
     if (encoderPosition && !processing_manual_move) {
2921
     if (encoderPosition && !processing_manual_move) {
2839
       gcode.refresh_cmd_timeout();
2922
       gcode.refresh_cmd_timeout();
2917
       int8_t eindex=-1
3000
       int8_t eindex=-1
2918
     #endif
3001
     #endif
2919
   ) {
3002
   ) {
2920
-    if (lcd_clicked) { return lcd_goto_previous_menu(); }
3003
+    if (use_click()) { return lcd_goto_previous_menu(); }
2921
     ENCODER_DIRECTION_NORMAL();
3004
     ENCODER_DIRECTION_NORMAL();
2922
     if (encoderPosition) {
3005
     if (encoderPosition) {
2923
       if (!processing_manual_move) {
3006
       if (!processing_manual_move) {
2999
     _manual_move_func_ptr = func;
3082
     _manual_move_func_ptr = func;
3000
     START_MENU();
3083
     START_MENU();
3001
     if (LCD_HEIGHT >= 4) {
3084
     if (LCD_HEIGHT >= 4) {
3002
-      switch(axis) {
3085
+      switch (axis) {
3003
         case X_AXIS:
3086
         case X_AXIS:
3004
           STATIC_ITEM(MSG_MOVE_X, true, true); break;
3087
           STATIC_ITEM(MSG_MOVE_X, true, true); break;
3005
         case Y_AXIS:
3088
         case Y_AXIS:
3802
        *
3885
        *
3803
        */
3886
        */
3804
       void lcd_info_stats_menu() {
3887
       void lcd_info_stats_menu() {
3805
-        if (lcd_clicked) { return lcd_goto_previous_menu(); }
3888
+        if (use_click()) { return lcd_goto_previous_menu(); }
3806
 
3889
 
3807
         char buffer[21];
3890
         char buffer[21];
3808
         printStatistics stats = print_job_timer.getStats();
3891
         printStatistics stats = print_job_timer.getStats();
3836
      *
3919
      *
3837
      */
3920
      */
3838
     void lcd_info_thermistors_menu() {
3921
     void lcd_info_thermistors_menu() {
3839
-      if (lcd_clicked) { return lcd_goto_previous_menu(); }
3922
+      if (use_click()) { return lcd_goto_previous_menu(); }
3840
       START_SCREEN();
3923
       START_SCREEN();
3841
       #define THERMISTOR_ID TEMP_SENSOR_0
3924
       #define THERMISTOR_ID TEMP_SENSOR_0
3842
       #include "thermistornames.h"
3925
       #include "thermistornames.h"
3897
      *
3980
      *
3898
      */
3981
      */
3899
     void lcd_info_board_menu() {
3982
     void lcd_info_board_menu() {
3900
-      if (lcd_clicked) { return lcd_goto_previous_menu(); }
3983
+      if (use_click()) { return lcd_goto_previous_menu(); }
3901
       START_SCREEN();
3984
       START_SCREEN();
3902
       STATIC_ITEM(BOARD_NAME, true, true);                           // MyPrinterController
3985
       STATIC_ITEM(BOARD_NAME, true, true);                           // MyPrinterController
3903
       STATIC_ITEM(MSG_INFO_BAUDRATE ": " STRINGIFY(BAUDRATE), true); // Baud: 250000
3986
       STATIC_ITEM(MSG_INFO_BAUDRATE ": " STRINGIFY(BAUDRATE), true); // Baud: 250000
3918
      *
4001
      *
3919
      */
4002
      */
3920
     void lcd_info_printer_menu() {
4003
     void lcd_info_printer_menu() {
3921
-      if (lcd_clicked) { return lcd_goto_previous_menu(); }
4004
+      if (use_click()) { return lcd_goto_previous_menu(); }
3922
       START_SCREEN();
4005
       START_SCREEN();
3923
       STATIC_ITEM(MSG_MARLIN, true, true);                             // Marlin
4006
       STATIC_ITEM(MSG_MARLIN, true, true);                             // Marlin
3924
       STATIC_ITEM(SHORT_BUILD_VERSION, true);                          // x.x.x-Branch
4007
       STATIC_ITEM(SHORT_BUILD_VERSION, true);                          // x.x.x-Branch
4317
         if (liveEdit) (*callbackFunc)(); \
4400
         if (liveEdit) (*callbackFunc)(); \
4318
         if (lcd_clicked) lcd_goto_previous_menu(); \
4401
         if (lcd_clicked) lcd_goto_previous_menu(); \
4319
       } \
4402
       } \
4320
-      return lcd_clicked; \
4403
+      return use_click(); \
4321
     } \
4404
     } \
4322
     void menu_edit_ ## _name() { _menu_edit_ ## _name(); } \
4405
     void menu_edit_ ## _name() { _menu_edit_ ## _name(); } \
4323
     void menu_edit_callback_ ## _name() { if (_menu_edit_ ## _name()) (*callbackFunc)(); } \
4406
     void menu_edit_callback_ ## _name() { if (_menu_edit_ ## _name()) (*callbackFunc)(); } \
4674
     #if ENABLED(DOGLCD)
4757
     #if ENABLED(DOGLCD)
4675
       || drawing_screen
4758
       || drawing_screen
4676
     #endif
4759
     #endif
4677
-    ) {
4760
+  ) {
4678
 
4761
 
4679
     next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
4762
     next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
4680
 
4763
 
4778
 
4861
 
4779
     if ((lcdDrawUpdate || IS_DRAWING) && (!bbr2 || bbr2 > max_display_update_time)) {
4862
     if ((lcdDrawUpdate || IS_DRAWING) && (!bbr2 || bbr2 > max_display_update_time)) {
4780
 
4863
 
4864
+      // Change state of drawing flag between screen updates
4781
       if (!IS_DRAWING) switch (lcdDrawUpdate) {
4865
       if (!IS_DRAWING) switch (lcdDrawUpdate) {
4782
         case LCDVIEW_CALL_NO_REDRAW:
4866
         case LCDVIEW_CALL_NO_REDRAW:
4783
           lcdDrawUpdate = LCDVIEW_NONE;
4867
           lcdDrawUpdate = LCDVIEW_NONE;
4784
           break;
4868
           break;
4785
-        case LCDVIEW_CLEAR_CALL_REDRAW: // set by handlers, then altered after (rarely occurs here)
4786
-        case LCDVIEW_CALL_REDRAW_NEXT:  // set by handlers, then altered after (never occurs here?)
4869
+        case LCDVIEW_CLEAR_CALL_REDRAW:
4870
+        case LCDVIEW_CALL_REDRAW_NEXT:
4787
           lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4871
           lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4788
         case LCDVIEW_REDRAW_NOW:        // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT
4872
         case LCDVIEW_REDRAW_NOW:        // set above, or by a handler through LCDVIEW_CALL_REDRAW_NEXT
4789
         case LCDVIEW_NONE:
4873
         case LCDVIEW_NONE:
4795
       #endif
4879
       #endif
4796
 
4880
 
4797
       #if ENABLED(ULTIPANEL)
4881
       #if ENABLED(ULTIPANEL)
4798
-        #define CURRENTSCREEN() (*currentScreen)(), lcd_clicked = false
4882
+        #define CURRENTSCREEN() (*currentScreen)()
4799
       #else
4883
       #else
4800
         #define CURRENTSCREEN() lcd_status_screen()
4884
         #define CURRENTSCREEN() lcd_status_screen()
4801
       #endif
4885
       #endif
4820
         CURRENTSCREEN();
4904
         CURRENTSCREEN();
4821
       #endif
4905
       #endif
4822
 
4906
 
4907
+      #if ENABLED(ULTIPANEL)
4908
+        lcd_clicked = false;
4909
+      #endif
4910
+
4823
       // Keeping track of the longest time for an individual LCD update.
4911
       // Keeping track of the longest time for an individual LCD update.
4824
       // Used to do screen throttling when the planner starts to fill up.
4912
       // Used to do screen throttling when the planner starts to fill up.
4825
       NOLESS(max_display_update_time, millis() - ms);
4913
       NOLESS(max_display_update_time, millis() - ms);
4835
 
4923
 
4836
     #endif // ULTIPANEL
4924
     #endif // ULTIPANEL
4837
 
4925
 
4926
+    // Change state of drawing flag between screen updates
4838
     if (!IS_DRAWING) switch (lcdDrawUpdate) {
4927
     if (!IS_DRAWING) switch (lcdDrawUpdate) {
4839
       case LCDVIEW_CLEAR_CALL_REDRAW:
4928
       case LCDVIEW_CLEAR_CALL_REDRAW:
4840
-        lcd_implementation_clear();
4841
-      case LCDVIEW_CALL_REDRAW_NEXT:
4842
-        lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4843
-        break;
4929
+        lcd_implementation_clear(); break;
4844
       case LCDVIEW_REDRAW_NOW:
4930
       case LCDVIEW_REDRAW_NOW:
4845
         lcdDrawUpdate = LCDVIEW_NONE;
4931
         lcdDrawUpdate = LCDVIEW_NONE;
4846
-        break;
4847
       case LCDVIEW_NONE:
4932
       case LCDVIEW_NONE:
4848
-        break;
4933
+      case LCDVIEW_CALL_REDRAW_NEXT:
4934
+      case LCDVIEW_CALL_NO_REDRAW:
4935
+      default: break;
4849
     } // switch
4936
     } // switch
4850
 
4937
 
4851
   } // ELAPSED(ms, next_lcd_update_ms)
4938
   } // ELAPSED(ms, next_lcd_update_ms)

Loading…
Cancel
Save