Просмотр исходного кода

Merge pull request #6893 from thinkyhead/bf_lcd_leveling_fixes

Patch PROBE_MANUALLY + LCD_BED_LEVELING
Scott Lahteine 8 лет назад
Родитель
Сommit
5d6366d4e6

+ 13
- 17
Marlin/G26_Mesh_Validation_Tool.cpp Просмотреть файл

@@ -131,7 +131,7 @@
131 131
   void set_destination_to_current();
132 132
   void set_current_to_destination();
133 133
   void prepare_move_to_destination();
134
-  void lcd_setstatuspgm(const char* const message, const uint8_t level);
134
+  void lcd_setstatusPGM(const char* const message, const int8_t level);
135 135
   void sync_plan_position_e();
136 136
   void chirp_at_user();
137 137
 
@@ -181,18 +181,17 @@
181 181
     safe_delay(10);                       // Wait for click to settle
182 182
 
183 183
     #if ENABLED(ULTRA_LCD)
184
-      lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99);
184
+      lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
185 185
       lcd_quick_feedback();
186 186
     #endif
187
-    lcd_reset_alert_level();
188 187
 
189 188
     while (!ubl_lcd_clicked()) idle();    // Wait for button release
190 189
 
191 190
     // If the button is suddenly pressed again,
192 191
     // ask the user to resolve the issue
193
-    lcd_setstatuspgm(PSTR("Release button"), 99); // will never appear...
192
+    lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
194 193
     while (ubl_lcd_clicked()) idle();             // unless this loop happens
195
-    lcd_setstatuspgm(PSTR(""));
194
+    lcd_setstatusPGM(PSTR(""), -1);
196 195
 
197 196
     return true;
198 197
   }
@@ -351,8 +350,7 @@
351 350
     } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
352 351
 
353 352
     LEAVE:
354
-    lcd_reset_alert_level();
355
-    lcd_setstatuspgm(PSTR("Leaving G26"));
353
+    lcd_setstatusPGM(PSTR("Leaving G26"), -1);
356 354
 
357 355
     retract_filament(destination);
358 356
     destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
@@ -726,8 +724,7 @@
726 724
   }
727 725
 
728 726
   bool unified_bed_leveling::exit_from_g26() {
729
-    lcd_reset_alert_level();
730
-    lcd_setstatuspgm(PSTR("Leaving G26"));
727
+    lcd_setstatusPGM(PSTR("Leaving G26"), -1);
731 728
     while (ubl_lcd_clicked()) idle();
732 729
     return UBL_ERR;
733 730
   }
@@ -741,7 +738,7 @@
741 738
     #if HAS_TEMP_BED
742 739
       #if ENABLED(ULTRA_LCD)
743 740
         if (g26_bed_temp > 25) {
744
-          lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99);
741
+          lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
745 742
           lcd_quick_feedback();
746 743
       #endif
747 744
           has_control_of_lcd_panel = true;
@@ -757,7 +754,7 @@
757 754
           }
758 755
       #if ENABLED(ULTRA_LCD)
759 756
         }
760
-        lcd_setstatuspgm(PSTR("G26 Heating Nozzle."), 99);
757
+        lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99);
761 758
         lcd_quick_feedback();
762 759
       #endif
763 760
     #endif
@@ -774,8 +771,7 @@
774 771
     }
775 772
 
776 773
     #if ENABLED(ULTRA_LCD)
777
-      lcd_reset_alert_level();
778
-      lcd_setstatuspgm(PSTR(""));
774
+      lcd_setstatusPGM(PSTR(""), -1);
779 775
       lcd_quick_feedback();
780 776
     #endif
781 777
 
@@ -792,7 +788,7 @@
792 788
 
793 789
       has_control_of_lcd_panel = true;
794 790
 
795
-      lcd_setstatuspgm(PSTR("User-Controlled Prime"), 99);
791
+      lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99);
796 792
       chirp_at_user();
797 793
 
798 794
       set_destination_to_current();
@@ -819,9 +815,9 @@
819 815
       while (ubl_lcd_clicked()) idle();           // Debounce Encoder Wheel
820 816
 
821 817
       #if ENABLED(ULTRA_LCD)
822
-        strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatuspgm() without having it continue;
818
+        strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
823 819
                                                             // So...  We cheat to get a message up.
824
-        lcd_setstatuspgm(PSTR("Done Priming"), 99);
820
+        lcd_setstatusPGM(PSTR("Done Priming"), 99);
825 821
         lcd_quick_feedback();
826 822
       #endif
827 823
 
@@ -830,7 +826,7 @@
830 826
     }
831 827
     else {
832 828
       #if ENABLED(ULTRA_LCD)
833
-        lcd_setstatuspgm(PSTR("Fixed Length Prime."), 99);
829
+        lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99);
834 830
         lcd_quick_feedback();
835 831
       #endif
836 832
       set_destination_to_current();

+ 2
- 2
Marlin/Marlin.h Просмотреть файл

@@ -217,8 +217,8 @@ extern bool volumetric_enabled;
217 217
 extern int flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
218 218
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
219 219
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
220
-extern bool axis_known_position[XYZ]; // axis[n].is_known
221
-extern bool axis_homed[XYZ]; // axis[n].is_homed
220
+extern bool axis_known_position[XYZ];
221
+extern bool axis_homed[XYZ];
222 222
 extern volatile bool wait_for_heatup;
223 223
 
224 224
 #if HAS_RESUME_CONTINUE

+ 42
- 24
Marlin/Marlin_main.cpp Просмотреть файл

@@ -1743,15 +1743,15 @@ static void clean_up_after_endstop_or_probe_move() {
1743 1743
 #if HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION)
1744 1744
 
1745 1745
   bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) {
1746
-#if ENABLED(HOME_AFTER_DEACTIVATE)
1747
-    const bool xx = x && !axis_known_position[X_AXIS],
1748
-               yy = y && !axis_known_position[Y_AXIS],
1749
-               zz = z && !axis_known_position[Z_AXIS];
1750
-#else
1751
-    const bool xx = x && !axis_homed[X_AXIS],
1752
-               yy = y && !axis_homed[Y_AXIS],
1753
-               zz = z && !axis_homed[Z_AXIS];
1754
-#endif
1746
+    #if ENABLED(HOME_AFTER_DEACTIVATE)
1747
+      const bool xx = x && !axis_known_position[X_AXIS],
1748
+                 yy = y && !axis_known_position[Y_AXIS],
1749
+                 zz = z && !axis_known_position[Z_AXIS];
1750
+    #else
1751
+      const bool xx = x && !axis_homed[X_AXIS],
1752
+                 yy = y && !axis_homed[Y_AXIS],
1753
+                 zz = z && !axis_homed[Z_AXIS];
1754
+    #endif
1755 1755
     if (xx || yy || zz) {
1756 1756
       SERIAL_ECHO_START;
1757 1757
       SERIAL_ECHOPGM(MSG_HOME " ");
@@ -2467,7 +2467,7 @@ static void clean_up_after_endstop_or_probe_move() {
2467 2467
     #endif
2468 2468
     for (uint8_t y = 0; y < sy; y++) {
2469 2469
       #ifdef SCAD_MESH_OUTPUT
2470
-        SERIAL_PROTOCOLLNPGM(" [");           // open sub-array
2470
+        SERIAL_PROTOCOLPGM(" [");           // open sub-array
2471 2471
       #else
2472 2472
         if (y < 10) SERIAL_PROTOCOLCHAR(' ');
2473 2473
         SERIAL_PROTOCOL((int)y);
@@ -2501,7 +2501,7 @@ static void clean_up_after_endstop_or_probe_move() {
2501 2501
       SERIAL_EOL;
2502 2502
     }
2503 2503
     #ifdef SCAD_MESH_OUTPUT
2504
-      SERIAL_PROTOCOLPGM("\n];");                     // close 2D array
2504
+      SERIAL_PROTOCOLPGM("];");                       // close 2D array
2505 2505
     #endif
2506 2506
     SERIAL_EOL;
2507 2507
   }
@@ -3798,6 +3798,8 @@ inline void gcode_G28(const bool always_home_all) {
3798 3798
     tool_change(old_tool_index, 0, true);
3799 3799
   #endif
3800 3800
 
3801
+  lcd_refresh();
3802
+
3801 3803
   report_current_position();
3802 3804
 
3803 3805
   #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -3839,7 +3841,7 @@ void home_all_axes() { gcode_G28(true); }
3839 3841
 
3840 3842
     #if MANUAL_PROBE_HEIGHT > 0
3841 3843
       feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS];
3842
-      current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2; // just slightly over the bed
3844
+      current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); // just slightly over the bed
3843 3845
       line_to_current_position();
3844 3846
     #endif
3845 3847
 
@@ -4132,8 +4134,14 @@ void home_all_axes() { gcode_G28(true); }
4132 4134
       #endif
4133 4135
     #endif
4134 4136
 
4137
+    #if ENABLED(PROBE_MANUALLY)
4138
+      const bool seenA = parser.seen('A'), seenQ = parser.seen('Q'), no_action = seenA || seenQ;
4139
+    #endif
4140
+
4135 4141
     #if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY)
4136 4142
       const bool faux = parser.seen('C') && parser.value_bool();
4143
+    #elif ENABLED(PROBE_MANUALLY)
4144
+      const bool faux = no_action;
4137 4145
     #else
4138 4146
       bool constexpr faux = false;
4139 4147
     #endif
@@ -4231,19 +4239,19 @@ void home_all_axes() { gcode_G28(true); }
4231 4239
             return;
4232 4240
           }
4233 4241
 
4234
-          const float z = parser.seen('Z') && parser.has_value() ? parser.value_float() : 99999;
4235
-          if (!WITHIN(z, -10, 10)) {
4242
+          const float z = parser.seen('Z') && parser.has_value() ? parser.value_float() : NAN;
4243
+          if (!isnan(z) || !WITHIN(z, -10, 10)) {
4236 4244
             SERIAL_ERROR_START;
4237 4245
             SERIAL_ERRORLNPGM("Bad Z value");
4238 4246
             return;
4239 4247
           }
4240 4248
 
4241
-          const float x = parser.seen('X') && parser.has_value() ? parser.value_float() : 99999,
4242
-                      y = parser.seen('Y') && parser.has_value() ? parser.value_float() : 99999;
4249
+          const float x = parser.seen('X') && parser.has_value() ? parser.value_float() : NAN,
4250
+                      y = parser.seen('Y') && parser.has_value() ? parser.value_float() : NAN;
4243 4251
           int8_t i = parser.seen('I') && parser.has_value() ? parser.value_byte() : -1,
4244 4252
                  j = parser.seen('J') && parser.has_value() ? parser.value_byte() : -1;
4245 4253
 
4246
-          if (x < 99998 && y < 99998) {
4254
+          if (!isnan(x) && !isnan(y)) {
4247 4255
             // Get nearest i / j from x / y
4248 4256
             i = (x - LOGICAL_X_POSITION(bilinear_start[X_AXIS]) + 0.5 * xGridSpacing) / xGridSpacing;
4249 4257
             j = (y - LOGICAL_Y_POSITION(bilinear_start[Y_AXIS]) + 0.5 * yGridSpacing) / yGridSpacing;
@@ -4279,7 +4287,11 @@ void home_all_axes() { gcode_G28(true); }
4279 4287
         return;
4280 4288
       }
4281 4289
 
4282
-      dryrun = parser.seen('D') && parser.value_bool();
4290
+      dryrun = (parser.seen('D') && parser.value_bool())
4291
+        #if ENABLED(PROBE_MANUALLY)
4292
+          || no_action
4293
+        #endif
4294
+      ;
4283 4295
 
4284 4296
       #if ENABLED(AUTO_BED_LEVELING_LINEAR)
4285 4297
 
@@ -4424,16 +4436,14 @@ void home_all_axes() { gcode_G28(true); }
4424 4436
 
4425 4437
     #if ENABLED(PROBE_MANUALLY)
4426 4438
 
4427
-      const bool seenA = parser.seen('A'), seenQ = parser.seen('Q');
4428
-
4429 4439
       // For manual probing, get the next index to probe now.
4430 4440
       // On the first probe this will be incremented to 0.
4431
-      if (!seenA && !seenQ) {
4441
+      if (!no_action) {
4432 4442
         ++abl_probe_index;
4433 4443
         g29_in_progress = true;
4434 4444
       }
4435 4445
 
4436
-      // Abort current G29 procedure, go back to ABLStart
4446
+      // Abort current G29 procedure, go back to idle state
4437 4447
       if (seenA && g29_in_progress) {
4438 4448
         SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
4439 4449
         #if HAS_SOFTWARE_ENDSTOPS
@@ -4450,14 +4460,14 @@ void home_all_axes() { gcode_G28(true); }
4450 4460
       if (verbose_level || seenQ) {
4451 4461
         SERIAL_PROTOCOLPGM("Manual G29 ");
4452 4462
         if (g29_in_progress) {
4453
-          SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1);
4463
+          SERIAL_PROTOCOLPAIR("point ", min(abl_probe_index + 1, abl2));
4454 4464
           SERIAL_PROTOCOLLNPAIR(" of ", abl2);
4455 4465
         }
4456 4466
         else
4457 4467
           SERIAL_PROTOCOLLNPGM("idle");
4458 4468
       }
4459 4469
 
4460
-      if (seenA || seenQ) return;
4470
+      if (no_action) return;
4461 4471
 
4462 4472
       if (abl_probe_index == 0) {
4463 4473
         // For the initial G29 save software endstop state
@@ -4482,6 +4492,14 @@ void home_all_axes() { gcode_G28(true); }
4482 4492
 
4483 4493
           z_values[xCount][yCount] = measured_z + zoffset;
4484 4494
 
4495
+          #if ENABLED(DEBUG_LEVELING_FEATURE)
4496
+            if (DEBUGGING(LEVELING)) {
4497
+              SERIAL_PROTOCOLPAIR("Save X", xCount);
4498
+              SERIAL_PROTOCOLPAIR(" Y", yCount);
4499
+              SERIAL_PROTOCOLLNPAIR(" Z", measured_z + zoffset);
4500
+            }
4501
+          #endif
4502
+
4485 4503
         #elif ENABLED(AUTO_BED_LEVELING_3POINT)
4486 4504
 
4487 4505
           points[i].z = measured_z;

+ 2
- 2
Marlin/language_en.h Просмотреть файл

@@ -394,8 +394,8 @@
394 394
 #ifndef MSG_VE_JERK
395 395
   #define MSG_VE_JERK                         _UxGT("Ve-jerk")
396 396
 #endif
397
-#ifndef MSG_FEEDRATE
398
-  #define MSG_FEEDRATE                        _UxGT("Feedrate")
397
+#ifndef MSG_VELOCITY
398
+  #define MSG_VELOCITY                        _UxGT("Velocity")
399 399
 #endif
400 400
 #ifndef MSG_VMAX
401 401
   #define MSG_VMAX                            _UxGT("Vmax ")

+ 1
- 1
Marlin/ubl_G29.cpp Просмотреть файл

@@ -58,7 +58,7 @@
58 58
   typedef void (*screenFunc_t)();
59 59
   extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
60 60
   extern void lcd_setstatus(const char* message, const bool persist);
61
-  extern void lcd_setstatuspgm(const char* message, const uint8_t level);
61
+  extern void lcd_setstatusPGM(const char* message, const int8_t level);
62 62
 
63 63
   int    unified_bed_leveling::g29_verbose_level,
64 64
          unified_bed_leveling::g29_phase_value,

+ 113
- 67
Marlin/ultralcd.cpp Просмотреть файл

@@ -481,21 +481,35 @@ uint16_t max_display_update_time = 0;
481 481
   /**
482 482
    * Show "Moving..." till moves are done, then revert to previous display.
483 483
    */
484
-  inline void lcd_synchronize(const char * const msg=NULL) {
484
+  static const char moving[] PROGMEM = MSG_MOVING;
485
+  static const char *sync_message = moving;
486
+
487
+  //
488
+  // Display the synchronize screen until moves are
489
+  // finished, and don't return to the caller until
490
+  // done. ** This blocks the command queue! **
491
+  //
492
+  void _lcd_synchronize() {
485 493
     static bool no_reentry = false;
486
-    const static char moving[] PROGMEM = MSG_MOVING;
487
-    lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, msg ? msg : moving);
494
+    if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
488 495
     if (no_reentry) return;
489 496
 
490 497
     // Make this the current handler till all moves are done
491 498
     no_reentry = true;
492 499
     screenFunc_t old_screen = currentScreen;
493
-    lcd_goto_screen(lcd_synchronize);
500
+    lcd_goto_screen(_lcd_synchronize);
494 501
     stepper.synchronize();
495 502
     no_reentry = false;
496 503
     lcd_goto_screen(old_screen);
497 504
   }
498 505
 
506
+  // Display the synchronize screen with a custom message
507
+  // ** This blocks the command queue! **
508
+  void lcd_synchronize(const char * const msg=NULL) {
509
+    sync_message = msg ? msg : moving;
510
+    _lcd_synchronize();
511
+  }
512
+
499 513
   void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
500 514
 
501 515
   void lcd_save_previous_screen() {
@@ -680,7 +694,7 @@ void kill_screen(const char* lcd_msg) {
680 694
       #if ENABLED(PARK_HEAD_ON_PAUSE)
681 695
         enqueue_and_echo_commands_P(PSTR("M125"));
682 696
       #endif
683
-      lcd_setstatuspgm(PSTR(MSG_PRINT_PAUSED), true);
697
+      lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1);
684 698
     }
685 699
 
686 700
     void lcd_sdcard_resume() {
@@ -690,7 +704,7 @@ void kill_screen(const char* lcd_msg) {
690 704
         card.startFileprint();
691 705
         print_job_timer.start();
692 706
       #endif
693
-      lcd_setstatuspgm(PSTR(""), true);
707
+      lcd_setstatusPGM(PSTR(""), -1);
694 708
     }
695 709
 
696 710
     void lcd_sdcard_stop() {
@@ -703,7 +717,7 @@ void kill_screen(const char* lcd_msg) {
703 717
         for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
704 718
       #endif
705 719
       wait_for_heatup = false;
706
-      LCD_MESSAGEPGM(MSG_PRINT_ABORTED);
720
+      lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1);
707 721
     }
708 722
 
709 723
   #endif // SDSUPPORT
@@ -1420,6 +1434,26 @@ void kill_screen(const char* lcd_msg) {
1420 1434
       #endif
1421 1435
     );
1422 1436
 
1437
+    //
1438
+    // Raise Z to the "manual probe height"
1439
+    // Don't return until done.
1440
+    // ** This blocks the command queue! **
1441
+    //
1442
+    void _lcd_after_probing() {
1443
+      #if MANUAL_PROBE_HEIGHT > 0
1444
+        current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT;
1445
+        line_to_current(Z_AXIS);
1446
+      #endif
1447
+      // Display "Done" screen and wait for moves to complete
1448
+      #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
1449
+        lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
1450
+      #endif
1451
+      lcd_goto_previous_menu();
1452
+      lcd_completion_feedback();
1453
+      defer_return_to_status = false;
1454
+      //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
1455
+    }
1456
+
1423 1457
     #if ENABLED(MESH_BED_LEVELING)
1424 1458
 
1425 1459
       // Utility to go to the next mesh point
@@ -1432,18 +1466,28 @@ void kill_screen(const char* lcd_msg) {
1432 1466
         current_position[Y_AXIS] = LOGICAL_Y_POSITION(y);
1433 1467
         planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder);
1434 1468
         #if MANUAL_PROBE_HEIGHT > 0
1435
-          current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + 0.2;
1469
+          current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
1436 1470
           line_to_current(Z_AXIS);
1437 1471
         #endif
1438 1472
         lcd_synchronize();
1439 1473
       }
1440 1474
 
1441
-    #endif // MESH_BED_LEVELING
1475
+    #elif ENABLED(PROBE_MANUALLY)
1442 1476
 
1443
-    void _lcd_level_bed_done() {
1444
-      if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
1445
-      lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
1446
-    }
1477
+      bool lcd_wait_for_move;
1478
+
1479
+      //
1480
+      // Bed leveling is done. Wait for G29 to complete.
1481
+      // A flag is used so that this can release control
1482
+      // and allow the command queue to be processed.
1483
+      //
1484
+      void _lcd_level_bed_done() {
1485
+        if (!lcd_wait_for_move) _lcd_after_probing();
1486
+        if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_DONE));
1487
+        lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
1488
+      }
1489
+
1490
+    #endif
1447 1491
 
1448 1492
     void _lcd_level_goto_next_point();
1449 1493
 
@@ -1455,59 +1499,55 @@ void kill_screen(const char* lcd_msg) {
1455 1499
 
1456 1500
       if (lcd_clicked) {
1457 1501
 
1458
-        // Use a hook to set the probe point z
1502
+        //
1503
+        // Save the current Z position
1504
+        //
1505
+
1459 1506
         #if ENABLED(MESH_BED_LEVELING)
1460 1507
 
1508
+          //
1461 1509
           // MBL records the position but doesn't move to the next one
1462
-          mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]);
1510
+          //
1463 1511
 
1464
-        #elif ENABLED(PROBE_MANUALLY)
1465
-
1466
-          // The last G29 will record but not move
1467
-          if (manual_probe_index == total_probe_points - 1)
1468
-            enqueue_and_echo_commands_P(PSTR("G29 V1"));
1512
+          mbl.set_zigzag_z(manual_probe_index, current_position[Z_AXIS]);
1469 1513
 
1470 1514
         #endif
1471 1515
 
1472 1516
         // If done...
1473 1517
         if (++manual_probe_index >= total_probe_points) {
1474 1518
 
1475
-          // Say "Done!"
1476
-          lcd_goto_screen(_lcd_level_bed_done);
1519
+          #if ENABLED(PROBE_MANUALLY)
1477 1520
 
1478
-          // Raise Z to the "manual probe height"
1479
-          #if MANUAL_PROBE_HEIGHT > 0
1480
-            current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT;
1481
-            line_to_current(Z_AXIS);
1482
-          #endif
1521
+            //
1522
+            // The last G29 will record and enable but not move.
1523
+            // Since G29 is deferred, 
1524
+            //
1525
+            lcd_wait_for_move = true;
1526
+            enqueue_and_echo_commands_P(PSTR("G29 V1"));
1527
+            lcd_goto_screen(_lcd_level_bed_done);
1483 1528
 
1484
-          #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING)
1485
-            lcd_synchronize(PSTR(MSG_LEVEL_BED_DONE));
1486
-          #endif
1529
+          #elif ENABLED(MESH_BED_LEVELING)
1487 1530
 
1488
-          // Enable leveling, if needed
1489
-          #if ENABLED(MESH_BED_LEVELING)
1531
+            _lcd_after_probing();
1490 1532
 
1491 1533
             mbl.set_has_mesh(true);
1492 1534
             mesh_probing_done();
1493 1535
 
1494
-          #elif ENABLED(PROBE_MANUALLY)
1495
-
1496
-            // ABL will be enabled due to "G29".
1497
-
1498 1536
           #endif
1499 1537
 
1500
-          lcd_return_to_status();
1501
-          //LCD_MESSAGEPGM(MSG_LEVEL_BED_DONE);
1502
-          lcd_completion_feedback();
1503 1538
         }
1504
-        else
1539
+        else {
1540
+          // MESH_BED_LEVELING: Z already stored, just move
1541
+          //    PROBE_MANUALLY: Send G29 to record Z, then move
1505 1542
           _lcd_level_goto_next_point();
1543
+        }
1506 1544
 
1507 1545
         return;
1508 1546
       }
1509 1547
 
1548
+      //
1510 1549
       // Encoder knob or keypad buttons adjust the Z position
1550
+      //
1511 1551
       if (encoderPosition) {
1512 1552
         refresh_cmd_timeout();
1513 1553
         current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
@@ -1518,8 +1558,9 @@ void kill_screen(const char* lcd_msg) {
1518 1558
         encoderPosition = 0;
1519 1559
       }
1520 1560
 
1521
-      // Update on first display, then only on updates to Z position
1522
-      // Show message above on clicks instead
1561
+      //
1562
+      // Draw on first display, then only on Z change
1563
+      //
1523 1564
       if (lcdDrawUpdate) {
1524 1565
         const float v = current_position[Z_AXIS];
1525 1566
         lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43sign(v + (v < 0 ? -0.0001 : 0.0001), '+'));
@@ -1530,10 +1571,6 @@ void kill_screen(const char* lcd_msg) {
1530 1571
      * Step 6: Display "Next point: 1 / 9" while waiting for move to finish
1531 1572
      */
1532 1573
 
1533
-    #if ENABLED(PROBE_MANUALLY)
1534
-      bool lcd_wait_for_move;
1535
-    #endif
1536
-
1537 1574
     void _lcd_level_bed_moving() {
1538 1575
       if (lcdDrawUpdate) {
1539 1576
         char msg[10];
@@ -1570,7 +1607,7 @@ void kill_screen(const char* lcd_msg) {
1570 1607
 
1571 1608
       #elif ENABLED(PROBE_MANUALLY)
1572 1609
 
1573
-        // G29 will signal when it's done
1610
+        // G29 Records Z, moves, and signals when it pauses
1574 1611
         lcd_wait_for_move = true;
1575 1612
         enqueue_and_echo_commands_P(PSTR("G29 V1"));
1576 1613
 
@@ -1620,19 +1657,22 @@ void kill_screen(const char* lcd_msg) {
1620 1657
     /**
1621 1658
      * Step 1: Bed Level entry-point
1622 1659
      *  - Cancel
1660
+     *  - Auto Home       (if homing needed)
1661
+     *  - Leveling On/Off (if data exists, and homed)
1623 1662
      *  - Level Bed >
1624
-     *  - Leveling On/Off (if there is leveling data)
1625
-     *  - Fade Height (Req: ENABLE_LEVELING_FADE_HEIGHT)
1626
-     *  - Mesh Z Offset (Req: MESH_BED_LEVELING)
1627
-     *  - Z Probe Offset (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET)
1628
-     *  - Load Settings (Req: EEPROM_SETTINGS)
1629
-     *  - Save Settings (Req: EEPROM_SETTINGS)
1663
+     *  - Fade Height     (Req: ENABLE_LEVELING_FADE_HEIGHT)
1664
+     *  - Mesh Z Offset   (Req: MESH_BED_LEVELING)
1665
+     *  - Z Probe Offset  (Req: HAS_BED_PROBE, Opt: BABYSTEP_ZPROBE_OFFSET)
1666
+     *  - Load Settings   (Req: EEPROM_SETTINGS)
1667
+     *  - Save Settings   (Req: EEPROM_SETTINGS)
1630 1668
      */
1631
-    void lcd_level_bed() {
1669
+    void lcd_bed_leveling() {
1632 1670
       START_MENU();
1633 1671
       MENU_BACK(MSG_PREPARE);
1634
-      MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
1635
-      if (leveling_is_valid()) {      // Leveling data exists? Show more options.
1672
+
1673
+      if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
1674
+        MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
1675
+      else if (leveling_is_valid()) {
1636 1676
         _level_state = leveling_is_active();
1637 1677
         MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &_level_state, _lcd_toggle_bed_leveling);
1638 1678
       }
@@ -1642,7 +1682,9 @@ void kill_screen(const char* lcd_msg) {
1642 1682
         MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_Z_FADE_HEIGHT, &planner.z_fade_height, 0.0, 100.0, _lcd_set_z_fade_height);
1643 1683
       #endif
1644 1684
 
1645
-      // Manual bed leveling, Bed Z:
1685
+      //
1686
+      // MBL Z Offset
1687
+      //
1646 1688
       #if ENABLED(MESH_BED_LEVELING)
1647 1689
         MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
1648 1690
       #endif
@@ -1653,6 +1695,8 @@ void kill_screen(const char* lcd_msg) {
1653 1695
         MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset);
1654 1696
       #endif
1655 1697
 
1698
+      MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
1699
+
1656 1700
       #if ENABLED(EEPROM_SETTINGS)
1657 1701
         MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
1658 1702
         MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
@@ -2063,7 +2107,7 @@ void kill_screen(const char* lcd_msg) {
2063 2107
       #if ENABLED(PROBE_MANUALLY)
2064 2108
         if (!g29_in_progress)
2065 2109
       #endif
2066
-      MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_level_bed);
2110
+      MENU_ITEM(submenu, MSG_BED_LEVELING, lcd_bed_leveling);
2067 2111
     #endif
2068 2112
 
2069 2113
     #if HAS_M206_COMMAND
@@ -2826,8 +2870,8 @@ void kill_screen(const char* lcd_msg) {
2826 2870
     static void lcd_refresh_zprobe_zoffset() { refresh_zprobe_zoffset(); }
2827 2871
   #endif
2828 2872
 
2829
-  // M203 / M205 Feedrates
2830
-  void lcd_control_motion_feedrate_menu() {
2873
+  // M203 / M205 Velocity options
2874
+  void lcd_control_motion_velocity_menu() {
2831 2875
     START_MENU();
2832 2876
     MENU_BACK(MSG_MOTION);
2833 2877
 
@@ -2957,18 +3001,19 @@ void kill_screen(const char* lcd_msg) {
2957 3001
       MENU_ITEM_EDIT_CALLBACK(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX, lcd_refresh_zprobe_zoffset);
2958 3002
     #endif
2959 3003
 
2960
-    // M203 / M205 Feedrate items
2961
-    MENU_ITEM(submenu, MSG_FEEDRATE, lcd_control_motion_feedrate_menu);
3004
+    // M203 / M205 - Feedrate items
3005
+    MENU_ITEM(submenu, MSG_VELOCITY, lcd_control_motion_velocity_menu);
2962 3006
 
2963
-    // M201 Acceleration items
3007
+    // M201 - Acceleration items
2964 3008
     MENU_ITEM(submenu, MSG_ACCELERATION, lcd_control_motion_acceleration_menu);
2965 3009
 
2966
-    // M205 Max Jerk
3010
+    // M205 - Max Jerk
2967 3011
     MENU_ITEM(submenu, MSG_JERK, lcd_control_motion_jerk_menu);
2968 3012
 
2969
-    // M92 Steps Per mm
3013
+    // M92 - Steps Per mm
2970 3014
     MENU_ITEM(submenu, MSG_STEPS_PER_MM, lcd_control_motion_steps_per_mm_menu);
2971 3015
 
3016
+    // M540 S - Abort on endstop hit when SD printing
2972 3017
     #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
2973 3018
       MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
2974 3019
     #endif
@@ -4095,7 +4140,8 @@ void lcd_setstatus(const char * const message, const bool persist) {
4095 4140
   lcd_finishstatus(persist);
4096 4141
 }
4097 4142
 
4098
-void lcd_setstatuspgm(const char * const message, const uint8_t level) {
4143
+void lcd_setstatusPGM(const char * const message, int8_t level) {
4144
+  if (level < 0) level = lcd_status_message_level = 0;
4099 4145
   if (level < lcd_status_message_level) return;
4100 4146
   lcd_status_message_level = level;
4101 4147
   strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
@@ -4113,7 +4159,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
4113 4159
 }
4114 4160
 
4115 4161
 void lcd_setalertstatuspgm(const char * const message) {
4116
-  lcd_setstatuspgm(message, 1);
4162
+  lcd_setstatusPGM(message, 1);
4117 4163
   #if ENABLED(ULTIPANEL)
4118 4164
     lcd_return_to_status();
4119 4165
   #endif

+ 7
- 3
Marlin/ultralcd.h Просмотреть файл

@@ -38,7 +38,7 @@
38 38
   void lcd_init();
39 39
   bool lcd_hasstatus();
40 40
   void lcd_setstatus(const char* message, const bool persist=false);
41
-  void lcd_setstatuspgm(const char* message, const uint8_t level=0);
41
+  void lcd_setstatusPGM(const char* message, const int8_t level=0);
42 42
   void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
43 43
   void lcd_setalertstatuspgm(const char* message);
44 44
   void lcd_reset_alert_level();
@@ -46,6 +46,9 @@
46 46
   void kill_screen(const char* lcd_msg);
47 47
   bool lcd_detected(void);
48 48
 
49
+  extern uint8_t lcdDrawUpdate;
50
+  inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
51
+
49 52
   #if HAS_BUZZER
50 53
     void lcd_buzz(long duration, uint16_t freq);
51 54
   #endif
@@ -61,7 +64,7 @@
61 64
     void bootscreen();
62 65
   #endif
63 66
 
64
-  #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
67
+  #define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x))
65 68
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
66 69
 
67 70
   #define LCD_UPDATE_INTERVAL 100
@@ -153,11 +156,12 @@
153 156
   inline void lcd_init() {}
154 157
   inline bool lcd_hasstatus() { return false; }
155 158
   inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
156
-  inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); }
159
+  inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
157 160
   inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
158 161
   inline void lcd_buttons_update() {}
159 162
   inline void lcd_reset_alert_level() {}
160 163
   inline bool lcd_detected() { return true; }
164
+  inline void lcd_refresh() {}
161 165
 
162 166
   #define LCD_MESSAGEPGM(x) NOOP
163 167
   #define LCD_ALERTMESSAGEPGM(x) NOOP

+ 4
- 2
Marlin/ultralcd_impl_HD44780.h Просмотреть файл

@@ -806,8 +806,10 @@ static void lcd_implementation_status_screen() {
806 806
 
807 807
     // Draw the progress bar if the message has shown long enough
808 808
     // or if there is no message set.
809
-    if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0]))
810
-      return lcd_draw_progress_bar(card.percentDone());
809
+    if (card.isFileOpen() && (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0])) {
810
+      const uint8_t percent = card.percentDone();
811
+      if (percent) return lcd_draw_progress_bar(percent);
812
+    }
811 813
 
812 814
   #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
813 815
 

Загрузка…
Отмена
Сохранить