Browse Source

Arrange G26 functions in dependency order

Scott Lahteine 6 years ago
parent
commit
3b431f2f72
5 changed files with 422 additions and 445 deletions
  1. 396
    426
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 0
    1
      Marlin/ubl.h
  3. 14
    14
      Marlin/ubl_G29.cpp
  4. 5
    4
      Marlin/ultralcd.cpp
  5. 7
    0
      Marlin/ultralcd.h

+ 396
- 426
Marlin/G26_Mesh_Validation_Tool.cpp
File diff suppressed because it is too large
View File


+ 0
- 1
Marlin/ubl.h View File

@@ -50,7 +50,6 @@
50 50
   // External references
51 51
 
52 52
   char *ftostr43sign(const float&, char);
53
-  bool ubl_lcd_clicked();
54 53
   void home_all_axes();
55 54
 
56 55
   extern uint8_t ubl_cnt;

+ 14
- 14
Marlin/ubl_G29.cpp View File

@@ -47,7 +47,6 @@
47 47
     float lcd_mesh_edit();
48 48
     void lcd_z_offset_edit_setup(float);
49 49
     extern void _lcd_ubl_output_map_lcd();
50
-    extern bool ubl_lcd_clicked();
51 50
     float lcd_z_offset_edit();
52 51
   #endif
53 52
 
@@ -750,11 +749,11 @@
750 749
         if (do_ubl_mesh_map) display_map(g29_map_type);
751 750
 
752 751
         #if ENABLED(NEWPANEL)
753
-          if (ubl_lcd_clicked()) {
752
+          if (is_lcd_clicked()) {
754 753
             SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n");
755 754
             lcd_quick_feedback();
756 755
             STOW_PROBE();
757
-            while (ubl_lcd_clicked()) idle();
756
+            while (is_lcd_clicked()) idle();
758 757
             lcd_external_control = false;
759 758
             restore_ubl_active_state_and_leave();
760 759
             safe_delay(50);  // Debounce the Encoder wheel
@@ -893,13 +892,14 @@
893 892
   #endif // HAS_BED_PROBE
894 893
 
895 894
   #if ENABLED(NEWPANEL)
895
+
896 896
     float unified_bed_leveling::measure_point_with_encoder() {
897 897
 
898
-      while (ubl_lcd_clicked()) delay(50);  // wait for user to release encoder wheel
898
+      while (is_lcd_clicked()) delay(50);  // wait for user to release encoder wheel
899 899
       delay(50);  // debounce
900 900
 
901 901
       KEEPALIVE_STATE(PAUSED_FOR_USER);
902
-      while (!ubl_lcd_clicked()) {     // we need the loop to move the nozzle based on the encoder wheel here!
902
+      while (!is_lcd_clicked()) {     // we need the loop to move the nozzle based on the encoder wheel here!
903 903
         idle();
904 904
         if (encoder_diff) {
905 905
           do_blocking_move_to_z(current_position[Z_AXIS] + 0.01 * float(encoder_diff));
@@ -989,9 +989,9 @@
989 989
         const float z_step = 0.01;                                        // existing behavior: 0.01mm per click, occasionally step
990 990
         //const float z_step = 1.0 / planner.axis_steps_per_mm[Z_AXIS];   // approx one step each click
991 991
 
992
-        while (ubl_lcd_clicked()) delay(50);             // wait for user to release encoder wheel
992
+        while (is_lcd_clicked()) delay(50);             // wait for user to release encoder wheel
993 993
         delay(50);                                       // debounce
994
-        while (!ubl_lcd_clicked()) {                     // we need the loop to move the nozzle based on the encoder wheel here!
994
+        while (!is_lcd_clicked()) {                     // we need the loop to move the nozzle based on the encoder wheel here!
995 995
           idle();
996 996
           if (encoder_diff) {
997 997
             do_blocking_move_to_z(current_position[Z_AXIS] + float(encoder_diff) * z_step);
@@ -999,11 +999,11 @@
999 999
           }
1000 1000
         }
1001 1001
 
1002
-        // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is
1002
+        // this sequence to detect an is_lcd_clicked() debounce it and leave if it is
1003 1003
         // a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp).   This
1004 1004
         // should be redone and compressed.
1005 1005
         const millis_t nxt = millis() + 1500L;
1006
-        while (ubl_lcd_clicked()) {     // debounce and watch for abort
1006
+        while (is_lcd_clicked()) {     // debounce and watch for abort
1007 1007
           idle();
1008 1008
           if (ELAPSED(millis(), nxt)) {
1009 1009
             SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.");
@@ -1011,7 +1011,7 @@
1011 1011
 
1012 1012
             #if ENABLED(NEWPANEL)
1013 1013
               lcd_quick_feedback();
1014
-              while (ubl_lcd_clicked()) idle();
1014
+              while (is_lcd_clicked()) idle();
1015 1015
               lcd_external_control = false;
1016 1016
             #endif
1017 1017
 
@@ -1528,7 +1528,7 @@
1528 1528
             do_blocking_move_to_z(h_offset + new_z); // Move the nozzle as the point is edited
1529 1529
           #endif
1530 1530
           idle();
1531
-        } while (!ubl_lcd_clicked());
1531
+        } while (!is_lcd_clicked());
1532 1532
 
1533 1533
         if (!lcd_map_control) lcd_return_to_status();
1534 1534
 
@@ -1537,18 +1537,18 @@
1537 1537
         // Let's work on specifying a proper API for the LCD ASAP, OK?
1538 1538
         lcd_external_control = true;
1539 1539
 
1540
-        // this sequence to detect an ubl_lcd_clicked() debounce it and leave if it is
1540
+        // this sequence to detect an is_lcd_clicked() debounce it and leave if it is
1541 1541
         // a Press and Hold is repeated in a lot of places (including G26_Mesh_Validation.cpp).   This
1542 1542
         // should be redone and compressed.
1543 1543
         const millis_t nxt = millis() + 1500UL;
1544
-        while (ubl_lcd_clicked()) { // debounce and watch for abort
1544
+        while (is_lcd_clicked()) { // debounce and watch for abort
1545 1545
           idle();
1546 1546
           if (ELAPSED(millis(), nxt)) {
1547 1547
             lcd_return_to_status();
1548 1548
             do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
1549 1549
             LCD_MESSAGEPGM(MSG_EDITING_STOPPED);
1550 1550
 
1551
-            while (ubl_lcd_clicked()) idle();
1551
+            while (is_lcd_clicked()) idle();
1552 1552
 
1553 1553
             goto FINE_TUNE_EXIT;
1554 1554
           }

+ 5
- 4
Marlin/ultralcd.cpp View File

@@ -5091,17 +5091,18 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
5091 5091
     bool lcd_detected() { return true; }
5092 5092
   #endif
5093 5093
 
5094
-  #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
5095
-    void chirp_at_user() {
5094
+  #if ENABLED(G26_MESH_VALIDATION)
5095
+    void lcd_chirp() {
5096 5096
       #if ENABLED(LCD_USE_I2C_BUZZER)
5097 5097
         lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
5098 5098
       #elif PIN_EXISTS(BEEPER)
5099 5099
         buzzer.tone(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
5100 5100
       #endif
5101 5101
     }
5102
+  #endif
5102 5103
 
5103
-    bool ubl_lcd_clicked() { return LCD_CLICKED; }
5104
-
5104
+  #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
5105
+    bool is_lcd_clicked() { return LCD_CLICKED; }
5105 5106
   #endif
5106 5107
 
5107 5108
 #endif // ULTIPANEL

+ 7
- 0
Marlin/ultralcd.h View File

@@ -29,6 +29,9 @@
29 29
 
30 30
   #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
31 31
     extern bool lcd_external_control;
32
+    #if ENABLED(G26_MESH_VALIDATION)
33
+      void lcd_chirp();
34
+    #endif
32 35
   #endif
33 36
 
34 37
   #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
@@ -171,6 +174,10 @@
171 174
     #define LCD_CLICKED false
172 175
   #endif
173 176
 
177
+  #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
178
+    bool is_lcd_clicked();
179
+  #endif
180
+
174 181
   #if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
175 182
     extern uint8_t progress_bar_percent;
176 183
   #endif

Loading…
Cancel
Save