Browse Source

Changes for parity with 2.0.x

Scott Lahteine 7 years ago
parent
commit
1063b3b2b8

+ 22
- 24
Marlin/G26_Mesh_Validation_Tool.cpp View File

164
   static int8_t g26_prime_flag;
164
   static int8_t g26_prime_flag;
165
 
165
 
166
   #if ENABLED(NEWPANEL)
166
   #if ENABLED(NEWPANEL)
167
+
167
     /**
168
     /**
168
      * Detect is_lcd_clicked, debounce it, and return true for cancel
169
      * Detect is_lcd_clicked, debounce it, and return true for cancel
169
      */
170
      */
185
       lcd_reset_status();
186
       lcd_reset_status();
186
       return true;
187
       return true;
187
     }
188
     }
188
-  #endif
189
 
189
 
190
-  #if ENABLED(NEWPANEL)
191
     bool exit_from_g26() {
190
     bool exit_from_g26() {
192
       lcd_setstatusPGM(PSTR("Leaving G26"), -1);
191
       lcd_setstatusPGM(PSTR("Leaving G26"), -1);
193
       wait_for_release();
192
       wait_for_release();
194
       return G26_ERR;
193
       return G26_ERR;
195
     }
194
     }
195
+
196
   #endif
196
   #endif
197
 
197
 
198
   void G26_line_to_destination(const float &feed_rate) {
198
   void G26_line_to_destination(const float &feed_rate) {
199
     const float save_feedrate = feedrate_mm_s;
199
     const float save_feedrate = feedrate_mm_s;
200
     feedrate_mm_s = feed_rate;      // use specified feed rate
200
     feedrate_mm_s = feed_rate;      // use specified feed rate
201
-    prepare_move_to_destination();  // will ultimately call ubl.line_to_destination_cartesian for UBL or ubl.prepare_linear_move_to for UBL_DELTA
201
+    prepare_move_to_destination();  // will ultimately call ubl.line_to_destination_cartesian or ubl.prepare_linear_move_to for UBL_DELTA
202
     feedrate_mm_s = save_feedrate;  // restore global feed rate
202
     feedrate_mm_s = save_feedrate;  // restore global feed rate
203
   }
203
   }
204
 
204
 
205
-  void move_to(const float &x, const float &y, const float &z, const float &e_delta) {
205
+  void move_to(const float &rx, const float &ry, const float &z, const float &e_delta) {
206
     float feed_value;
206
     float feed_value;
207
     static float last_z = -999.99;
207
     static float last_z = -999.99;
208
 
208
 
209
-    bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
209
+    bool has_xy_component = (rx != current_position[X_AXIS] || ry != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
210
 
210
 
211
     if (z != last_z) {
211
     if (z != last_z) {
212
       last_z = z;
212
       last_z = z;
229
 
229
 
230
     if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
230
     if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
231
 
231
 
232
-    destination[X_AXIS] = x;
233
-    destination[Y_AXIS] = y;
232
+    destination[X_AXIS] = rx;
233
+    destination[Y_AXIS] = ry;
234
     destination[E_AXIS] += e_delta;
234
     destination[E_AXIS] += e_delta;
235
 
235
 
236
     G26_line_to_destination(feed_value);
236
     G26_line_to_destination(feed_value);
292
 
292
 
293
         wait_for_release();
293
         wait_for_release();
294
 
294
 
295
-        #if ENABLED(ULTRA_LCD)
296
-          strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
297
-                                                              // So... We cheat to get a message up.
298
-          lcd_setstatusPGM(PSTR("Done Priming"), 99);
299
-          lcd_quick_feedback();
300
-          lcd_external_control = false;
301
-        #endif
295
+        strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
296
+                                                            // So... We cheat to get a message up.
297
+        lcd_setstatusPGM(PSTR("Done Priming"), 99);
298
+        lcd_quick_feedback();
299
+        lcd_external_control = false;
302
       }
300
       }
303
       else
301
       else
304
     #endif
302
     #endif
490
     return false;
488
     return false;
491
   }
489
   }
492
 
490
 
493
-  float valid_trig_angle(float d) {
494
-    while (d > 360.0) d -= 360.0;
495
-    while (d < 0.0) d += 360.0;
496
-    return d;
497
-  }
498
-
499
   /**
491
   /**
500
    * Turn on the bed and nozzle heat and
492
    * Turn on the bed and nozzle heat and
501
    * wait for them to get up to temperature.
493
    * wait for them to get up to temperature.
502
    */
494
    */
503
-  bool turn_on_heaters() {
495
+  inline bool turn_on_heaters() {
504
     millis_t next = millis() + 5000UL;
496
     millis_t next = millis() + 5000UL;
505
     #if HAS_TEMP_BED
497
     #if HAS_TEMP_BED
506
       #if ENABLED(ULTRA_LCD)
498
       #if ENABLED(ULTRA_LCD)
554
     return G26_OK;
546
     return G26_OK;
555
   }
547
   }
556
 
548
 
549
+  float valid_trig_angle(float d) {
550
+    while (d > 360.0) d -= 360.0;
551
+    while (d < 0.0) d += 360.0;
552
+    return d;
553
+  }
554
+
557
   /**
555
   /**
558
    * G26: Mesh Validation Pattern generation.
556
    * G26: Mesh Validation Pattern generation.
559
    *
557
    *
560
-   * Used to interactively edit UBL's Mesh by placing the
558
+   * Used to interactively edit the mesh by placing the
561
    * nozzle in a problem area and doing a G29 P4 R command.
559
    * nozzle in a problem area and doing a G29 P4 R command.
562
    */
560
    */
563
   void gcode_G26() {
561
   void gcode_G26() {
703
       set_current_from_destination();
701
       set_current_from_destination();
704
     }
702
     }
705
 
703
 
706
-    if (turn_on_heaters()) goto LEAVE;
704
+    if (turn_on_heaters() != G26_OK) goto LEAVE;
707
 
705
 
708
     current_position[E_AXIS] = 0.0;
706
     current_position[E_AXIS] = 0.0;
709
     sync_plan_position_e();
707
     sync_plan_position_e();
710
 
708
 
711
-    if (g26_prime_flag && prime_nozzle()) goto LEAVE;
709
+    if (g26_prime_flag && prime_nozzle() != G26_OK) goto LEAVE;
712
 
710
 
713
     /**
711
     /**
714
      *  Bed is preheated
712
      *  Bed is preheated

+ 4
- 0
Marlin/SanityCheck.h View File

298
 #if ENABLED(LCD_PROGRESS_BAR)
298
 #if ENABLED(LCD_PROGRESS_BAR)
299
   #if DISABLED(SDSUPPORT)
299
   #if DISABLED(SDSUPPORT)
300
     #error "LCD_PROGRESS_BAR requires SDSUPPORT."
300
     #error "LCD_PROGRESS_BAR requires SDSUPPORT."
301
+  #elif DISABLED(ULTRA_LCD)
302
+    #error "LCD_PROGRESS_BAR requires a character LCD."
301
   #elif ENABLED(DOGLCD)
303
   #elif ENABLED(DOGLCD)
302
     #error "LCD_PROGRESS_BAR does not apply to graphical displays."
304
     #error "LCD_PROGRESS_BAR does not apply to graphical displays."
303
   #elif ENABLED(FILAMENT_LCD_DISPLAY)
305
   #elif ENABLED(FILAMENT_LCD_DISPLAY)
304
     #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
306
     #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
305
   #endif
307
   #endif
308
+#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && DISABLED(DOGLCD)
309
+  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR or Graphical LCD."
306
 #endif
310
 #endif
307
 
311
 
308
 /**
312
 /**

+ 2
- 2
Marlin/language_en.h View File

813
 #ifndef MSG_DELTA_HEIGHT_CALIBRATE
813
 #ifndef MSG_DELTA_HEIGHT_CALIBRATE
814
   #define MSG_DELTA_HEIGHT_CALIBRATE          _UxGT("Set Delta Height")
814
   #define MSG_DELTA_HEIGHT_CALIBRATE          _UxGT("Set Delta Height")
815
 #endif
815
 #endif
816
-#ifndef MSG_DELTA_DIAG_ROG
817
-  #define MSG_DELTA_DIAG_ROG                  _UxGT("Diag Rod")
816
+#ifndef MSG_DELTA_DIAG_ROD
817
+  #define MSG_DELTA_DIAG_ROD                  _UxGT("Diag Rod")
818
 #endif
818
 #endif
819
 #ifndef MSG_DELTA_HEIGHT
819
 #ifndef MSG_DELTA_HEIGHT
820
   #define MSG_DELTA_HEIGHT                    _UxGT("Height")
820
   #define MSG_DELTA_HEIGHT                    _UxGT("Height")

+ 9
- 4
Marlin/planner.cpp View File

124
           Planner::inverse_z_fade_height,
124
           Planner::inverse_z_fade_height,
125
           Planner::last_fade_z;
125
           Planner::last_fade_z;
126
   #endif
126
   #endif
127
+#else
128
+  constexpr bool Planner::leveling_active;
127
 #endif
129
 #endif
128
 
130
 
129
 #if ENABLED(SKEW_CORRECTION)
131
 #if ENABLED(SKEW_CORRECTION)
130
   #if ENABLED(SKEW_CORRECTION_GCODE)
132
   #if ENABLED(SKEW_CORRECTION_GCODE)
131
-    // Initialized by settings.load()
132
     float Planner::xy_skew_factor;
133
     float Planner::xy_skew_factor;
133
-    #if ENABLED(SKEW_CORRECTION_FOR_Z)
134
-      float Planner::xz_skew_factor, Planner::yz_skew_factor;
135
-    #endif
134
+  #else
135
+    constexpr float Planner::xy_skew_factor;
136
+  #endif
137
+  #if ENABLED(SKEW_CORRECTION_FOR_Z) && ENABLED(SKEW_CORRECTION_GCODE)
138
+    float Planner::xz_skew_factor, Planner::yz_skew_factor;
139
+  #else
140
+    constexpr float Planner::xz_skew_factor, Planner::yz_skew_factor;
136
   #endif
141
   #endif
137
 #endif
142
 #endif
138
 
143
 

+ 1
- 1
Marlin/temperature.cpp View File

1273
    * their target temperature by a configurable margin.
1273
    * their target temperature by a configurable margin.
1274
    * This is called when the temperature is set. (M104, M109)
1274
    * This is called when the temperature is set. (M104, M109)
1275
    */
1275
    */
1276
-  void Temperature::start_watching_heater(uint8_t e) {
1276
+  void Temperature::start_watching_heater(const uint8_t e) {
1277
     #if HOTENDS == 1
1277
     #if HOTENDS == 1
1278
       UNUSED(e);
1278
       UNUSED(e);
1279
     #endif
1279
     #endif

+ 3
- 3
Marlin/temperature.h View File

370
     static int16_t degTargetBed() { return target_temperature_bed; }
370
     static int16_t degTargetBed() { return target_temperature_bed; }
371
 
371
 
372
     #if WATCH_HOTENDS
372
     #if WATCH_HOTENDS
373
-      static void start_watching_heater(uint8_t e = 0);
373
+      static void start_watching_heater(const uint8_t e = 0);
374
     #endif
374
     #endif
375
 
375
 
376
     #if WATCH_THE_BED
376
     #if WATCH_THE_BED
377
       static void start_watching_bed();
377
       static void start_watching_bed();
378
     #endif
378
     #endif
379
 
379
 
380
-    static void setTargetHotend(const int16_t celsius, uint8_t e) {
380
+    static void setTargetHotend(const int16_t celsius, const uint8_t e) {
381
       #if HOTENDS == 1
381
       #if HOTENDS == 1
382
         UNUSED(e);
382
         UNUSED(e);
383
       #endif
383
       #endif
455
 
455
 
456
     #if ENABLED(BABYSTEPPING)
456
     #if ENABLED(BABYSTEPPING)
457
 
457
 
458
-      static void babystep_axis(const AxisEnum axis, const int distance) {
458
+      static void babystep_axis(const AxisEnum axis, const int16_t distance) {
459
         if (axis_known_position[axis]) {
459
         if (axis_known_position[axis]) {
460
           #if IS_CORE
460
           #if IS_CORE
461
             #if ENABLED(BABYSTEP_XY)
461
             #if ENABLED(BABYSTEP_XY)

+ 1
- 1
Marlin/ubl.h View File

84
       #if ENABLED(NEWPANEL)
84
       #if ENABLED(NEWPANEL)
85
         static void move_z_with_encoder(const float &multiplier);
85
         static void move_z_with_encoder(const float &multiplier);
86
         static float measure_point_with_encoder();
86
         static float measure_point_with_encoder();
87
-        static float measure_business_card_thickness(float);
87
+        static float measure_business_card_thickness(const float&);
88
         static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
88
         static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
89
         static void fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map);
89
         static void fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map);
90
       #endif
90
       #endif

+ 12
- 14
Marlin/ubl_G29.cpp View File

45
 
45
 
46
   #if ENABLED(NEWPANEL)
46
   #if ENABLED(NEWPANEL)
47
     void lcd_return_to_status();
47
     void lcd_return_to_status();
48
-    void lcd_mesh_edit_setup(float initial);
48
+    void lcd_mesh_edit_setup(const float initial);
49
     float lcd_mesh_edit();
49
     float lcd_mesh_edit();
50
     void lcd_z_offset_edit_setup(float);
50
     void lcd_z_offset_edit_setup(float);
51
     extern void _lcd_ubl_output_map_lcd();
51
     extern void _lcd_ubl_output_map_lcd();
57
   extern float probe_pt(const float &rx, const float &ry, const bool, const uint8_t, const bool=true);
57
   extern float probe_pt(const float &rx, const float &ry, const bool, const uint8_t, const bool=true);
58
   extern bool set_probe_deployed(bool);
58
   extern bool set_probe_deployed(bool);
59
   extern void set_bed_leveling_enabled(bool);
59
   extern void set_bed_leveling_enabled(bool);
60
+
60
   typedef void (*screenFunc_t)();
61
   typedef void (*screenFunc_t)();
61
-  extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0);
62
+  extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder=0);
62
 
63
 
63
   #define SIZE_OF_LITTLE_RAISE 1
64
   #define SIZE_OF_LITTLE_RAISE 1
64
   #define BIG_RAISE_NOT_NEEDED 0
65
   #define BIG_RAISE_NOT_NEEDED 0
644
               SERIAL_ECHOPAIR(" J ", y);
645
               SERIAL_ECHOPAIR(" J ", y);
645
               SERIAL_ECHOPGM(" Z ");
646
               SERIAL_ECHOPGM(" Z ");
646
               SERIAL_ECHO_F(z_values[x][y], 6);
647
               SERIAL_ECHO_F(z_values[x][y], 6);
647
-              SERIAL_ECHOPAIR(" ; X ", mesh_index_to_xpos(x));
648
-              SERIAL_ECHOPAIR(", Y ", mesh_index_to_ypos(y));
648
+              SERIAL_ECHOPAIR(" ; X ", LOGICAL_X_POSITION(mesh_index_to_xpos(x)));
649
+              SERIAL_ECHOPAIR(", Y ", LOGICAL_Y_POSITION(mesh_index_to_ypos(y)));
649
               SERIAL_EOL();
650
               SERIAL_EOL();
650
             }
651
             }
651
         return;
652
         return;
799
           z_values[location.x_index][location.y_index] = measured_z;
800
           z_values[location.x_index][location.y_index] = measured_z;
800
         }
801
         }
801
 
802
 
802
-
803
       } while (location.x_index >= 0 && --max_iterations);
803
       } while (location.x_index >= 0 && --max_iterations);
804
 
804
 
805
       STOW_PROBE();
805
       STOW_PROBE();
914
         }
914
         }
915
       }
915
       }
916
     }
916
     }
917
+
917
   #endif // HAS_BED_PROBE
918
   #endif // HAS_BED_PROBE
918
 
919
 
919
   #if ENABLED(NEWPANEL)
920
   #if ENABLED(NEWPANEL)
938
 
939
 
939
     static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
940
     static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
940
 
941
 
941
-    float unified_bed_leveling::measure_business_card_thickness(float in_height) {
942
+    float unified_bed_leveling::measure_business_card_thickness(const float &in_height) {
942
       lcd_external_control = true;
943
       lcd_external_control = true;
943
       save_ubl_active_state_and_disable();   // Disable bed level correction for probing
944
       save_ubl_active_state_and_disable();   // Disable bed level correction for probing
944
 
945
 
971
         SERIAL_PROTOCOLLNPGM("mm thick.");
972
         SERIAL_PROTOCOLLNPGM("mm thick.");
972
       }
973
       }
973
 
974
 
974
-      in_height = current_position[Z_AXIS]; // do manual probing at lower height
975
-
976
       lcd_external_control = false;
975
       lcd_external_control = false;
977
 
976
 
978
       restore_ubl_active_state_and_leave();
977
       restore_ubl_active_state_and_leave();
1460
 
1459
 
1461
           float distance = HYPOT(px - mx, py - my);
1460
           float distance = HYPOT(px - mx, py - my);
1462
 
1461
 
1463
-            // factor in the distance from the current location for the normal case
1464
-            // so the nozzle isn't running all over the bed.
1465
-            distance += HYPOT(current_position[X_AXIS] - mx, current_position[Y_AXIS] - my) * 0.1;
1466
-
1462
+          // factor in the distance from the current location for the normal case
1463
+          // so the nozzle isn't running all over the bed.
1464
+          distance += HYPOT(current_position[X_AXIS] - mx, current_position[Y_AXIS] - my) * 0.1;
1467
           if (distance < best_so_far) {
1465
           if (distance < best_so_far) {
1468
             best_so_far = distance;   // We found a closer location with
1466
             best_so_far = distance;   // We found a closer location with
1469
             out_mesh.x_index = i;     // the specified type of mesh value.
1467
             out_mesh.x_index = i;     // the specified type of mesh value.
1518
 
1516
 
1519
         if (location.x_index < 0) break; // stop when we can't find any more reachable points.
1517
         if (location.x_index < 0) break; // stop when we can't find any more reachable points.
1520
 
1518
 
1521
-        bitmap_clear(not_done, location.x_index, location.y_index);  // Mark this location as 'adjusted' so we will find a
1522
-                                                                  // different location the next time through the loop
1519
+        bitmap_clear(not_done, location.x_index, location.y_index); // Mark this location as 'adjusted' so we will find a
1520
+                                                                    // different location the next time through the loop
1523
 
1521
 
1524
         const float rawx = mesh_index_to_xpos(location.x_index),
1522
         const float rawx = mesh_index_to_xpos(location.x_index),
1525
                     rawy = mesh_index_to_ypos(location.y_index);
1523
                     rawy = mesh_index_to_ypos(location.y_index);

+ 27
- 29
Marlin/ultralcd.cpp View File

57
 #endif
57
 #endif
58
 
58
 
59
 #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
59
 #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
60
-  bool lcd_external_control;
60
+  bool lcd_external_control; // = false
61
 #endif
61
 #endif
62
 
62
 
63
 // Initialized by settings.load()
63
 // Initialized by settings.load()
64
 int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
64
 int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
65
 
65
 
66
-#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
67
-  uint8_t progress_bar_percent;
68
-#endif
69
-
70
 #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
66
 #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
71
   millis_t previous_lcd_status_ms = 0;
67
   millis_t previous_lcd_status_ms = 0;
72
 #endif
68
 #endif
92
   uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
88
   uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
93
 #endif
89
 #endif
94
 
90
 
91
+#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
92
+  uint8_t progress_bar_percent;
93
+#endif
94
+
95
 #if ENABLED(DOGLCD)
95
 #if ENABLED(DOGLCD)
96
   #include "ultralcd_impl_DOGM.h"
96
   #include "ultralcd_impl_DOGM.h"
97
   #include <U8glib.h>
97
   #include <U8glib.h>
259
   //////////// Menu System Macros ////////////
259
   //////////// Menu System Macros ////////////
260
   ////////////////////////////////////////////
260
   ////////////////////////////////////////////
261
 
261
 
262
-  #ifndef ENCODER_FEEDRATE_DEADZONE
263
-    #define ENCODER_FEEDRATE_DEADZONE 6
264
-  #endif
265
-
266
   /**
262
   /**
267
    * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
263
    * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
268
    *
264
    *
734
    * Audio feedback for controller clicks
730
    * Audio feedback for controller clicks
735
    *
731
    *
736
    */
732
    */
737
-  void lcd_buzz(long duration, uint16_t freq) {
733
+  void lcd_buzz(const long duration, const uint16_t freq) {
738
     #if ENABLED(LCD_USE_I2C_BUZZER)
734
     #if ENABLED(LCD_USE_I2C_BUZZER)
739
       lcd.buzz(duration, freq);
735
       lcd.buzz(duration, freq);
740
     #elif PIN_EXISTS(BEEPER)
736
     #elif PIN_EXISTS(BEEPER)
1180
       return mesh_edit_value;
1176
       return mesh_edit_value;
1181
     }
1177
     }
1182
 
1178
 
1183
-    void lcd_mesh_edit_setup(float initial) {
1179
+    void lcd_mesh_edit_setup(const float initial) {
1184
       mesh_edit_value = mesh_edit_accumulator = initial;
1180
       mesh_edit_value = mesh_edit_accumulator = initial;
1185
       lcd_goto_screen(_lcd_mesh_edit_NOP);
1181
       lcd_goto_screen(_lcd_mesh_edit_NOP);
1186
     }
1182
     }
1332
     #if FAN_COUNT > 0
1328
     #if FAN_COUNT > 0
1333
       #if HAS_FAN0
1329
       #if HAS_FAN0
1334
         MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255);
1330
         MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255);
1335
-       #if ENABLED(EXTRA_FAN_SPEED)
1331
+        #if ENABLED(EXTRA_FAN_SPEED)
1336
           MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255);
1332
           MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255);
1337
-       #endif
1333
+        #endif
1338
       #endif
1334
       #endif
1339
       #if HAS_FAN1
1335
       #if HAS_FAN1
1340
         MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255);
1336
         MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255);
1836
     /**
1832
     /**
1837
      * Step 6: Display "Next point: 1 / 9" while waiting for move to finish
1833
      * Step 6: Display "Next point: 1 / 9" while waiting for move to finish
1838
      */
1834
      */
1839
-
1840
     void _lcd_level_bed_moving() {
1835
     void _lcd_level_bed_moving() {
1841
       if (lcdDrawUpdate) {
1836
       if (lcdDrawUpdate) {
1842
         char msg[10];
1837
         char msg[10];
2649
 
2644
 
2650
     void lcd_move_z();
2645
     void lcd_move_z();
2651
 
2646
 
2652
-    void _man_probe_pt(const float rx, const float ry) {
2647
+    void _man_probe_pt(const float &rx, const float &ry) {
2653
       #if HAS_LEVELING
2648
       #if HAS_LEVELING
2654
         reset_bed_level(); // After calibration bed-level data is no longer valid
2649
         reset_bed_level(); // After calibration bed-level data is no longer valid
2655
       #endif
2650
       #endif
2712
     void lcd_delta_settings() {
2707
     void lcd_delta_settings() {
2713
       START_MENU();
2708
       START_MENU();
2714
       MENU_BACK(MSG_DELTA_CALIBRATE);
2709
       MENU_BACK(MSG_DELTA_CALIBRATE);
2715
-      MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_DIAG_ROG, &delta_diagonal_rod, delta_diagonal_rod - 5.0, delta_diagonal_rod + 5.0, recalc_delta_settings);
2710
+      MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_DIAG_ROD, &delta_diagonal_rod, delta_diagonal_rod - 5.0, delta_diagonal_rod + 5.0, recalc_delta_settings);
2716
       MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10.0, delta_height + 10.0, recalc_delta_settings);
2711
       MENU_ITEM_EDIT_CALLBACK(float52, MSG_DELTA_HEIGHT, &delta_height, delta_height - 10.0, delta_height + 10.0, recalc_delta_settings);
2717
       MENU_ITEM_EDIT_CALLBACK(float43, "Ex", &delta_endstop_adj[A_AXIS], -5.0, 5.0, recalc_delta_settings);
2712
       MENU_ITEM_EDIT_CALLBACK(float43, "Ex", &delta_endstop_adj[A_AXIS], -5.0, 5.0, recalc_delta_settings);
2718
       MENU_ITEM_EDIT_CALLBACK(float43, "Ey", &delta_endstop_adj[B_AXIS], -5.0, 5.0, recalc_delta_settings);
2713
       MENU_ITEM_EDIT_CALLBACK(float43, "Ey", &delta_endstop_adj[B_AXIS], -5.0, 5.0, recalc_delta_settings);
2785
         manual_move_offset = 0.0;
2780
         manual_move_offset = 0.0;
2786
         manual_move_axis = (int8_t)NO_AXIS;
2781
         manual_move_axis = (int8_t)NO_AXIS;
2787
 
2782
 
2788
-        // DELTA and SCARA machines use segmented moves, which could fill the planner during the call to
2789
-        // move_to_destination. This will cause idle() to be called, which can then call this function while the
2790
-        // previous invocation is being blocked. Modifications to manual_move_offset shouldn't be made while
2791
-        // processing_manual_move is true or the planner will get out of sync.
2783
+        // Set a blocking flag so no new moves can be added until all segments are done
2792
         processing_manual_move = true;
2784
         processing_manual_move = true;
2793
         prepare_move_to_destination(); // will call set_current_from_destination()
2785
         prepare_move_to_destination(); // will call set_current_from_destination()
2794
         processing_manual_move = false;
2786
         processing_manual_move = false;
2868
             #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
2860
             #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z)
2869
               max = soft_endstop_max[Z_AXIS];
2861
               max = soft_endstop_max[Z_AXIS];
2870
             #endif
2862
             #endif
2871
-            break;
2872
           default: break;
2863
           default: break;
2873
         }
2864
         }
2874
       #endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS
2865
       #endif // MIN_SOFTWARE_ENDSTOPS || MAX_SOFTWARE_ENDSTOPS
3142
     MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
3133
     MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
3143
 
3134
 
3144
     #if HAS_LCD_CONTRAST
3135
     #if HAS_LCD_CONTRAST
3145
-      MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, (int*)&lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
3136
+      MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, &lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
3146
     #endif
3137
     #endif
3147
     #if ENABLED(FWRETRACT)
3138
     #if ENABLED(FWRETRACT)
3148
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
3139
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
4339
     } \
4330
     } \
4340
     typedef void _name
4331
     typedef void _name
4341
 
4332
 
4333
+  DEFINE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01);
4342
   DEFINE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1);
4334
   DEFINE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1);
4343
   DEFINE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1);
4335
   DEFINE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1);
4344
   DEFINE_MENU_EDIT_TYPE(float, float3, ftostr3, 1.0);
4336
   DEFINE_MENU_EDIT_TYPE(float, float3, ftostr3, 1.0);
4348
   DEFINE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10.0);
4340
   DEFINE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10.0);
4349
   DEFINE_MENU_EDIT_TYPE(float, float52, ftostr52sign, 100.0);
4341
   DEFINE_MENU_EDIT_TYPE(float, float52, ftostr52sign, 100.0);
4350
   DEFINE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100.0);
4342
   DEFINE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100.0);
4351
-  DEFINE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01);
4352
 
4343
 
4353
   /**
4344
   /**
4354
    *
4345
    *
4611
 
4602
 
4612
   #if ENABLED(ULTIPANEL)
4603
   #if ENABLED(ULTIPANEL)
4613
     static millis_t return_to_status_ms = 0;
4604
     static millis_t return_to_status_ms = 0;
4605
+
4606
+    // Handle any queued Move Axis motion
4614
     manage_manual_move();
4607
     manage_manual_move();
4615
 
4608
 
4609
+    // Update button states for LCD_CLICKED, etc.
4610
+    // After state changes the next button update
4611
+    // may be delayed 300-500ms.
4616
     lcd_buttons_update();
4612
     lcd_buttons_update();
4617
 
4613
 
4618
     #if ENABLED(AUTO_BED_LEVELING_UBL)
4614
     #if ENABLED(AUTO_BED_LEVELING_UBL)
4947
     #define encrot3 1
4943
     #define encrot3 1
4948
   #endif
4944
   #endif
4949
 
4945
 
4950
-  #define GET_BUTTON_STATES(DST) \
4946
+  #define GET_SHIFT_BUTTON_STATES(DST) \
4951
     uint8_t new_##DST = 0; \
4947
     uint8_t new_##DST = 0; \
4952
     WRITE(SHIFT_LD, LOW); \
4948
     WRITE(SHIFT_LD, LOW); \
4953
     WRITE(SHIFT_LD, HIGH); \
4949
     WRITE(SHIFT_LD, HIGH); \
4966
    */
4962
    */
4967
   void lcd_buttons_update() {
4963
   void lcd_buttons_update() {
4968
     static uint8_t lastEncoderBits;
4964
     static uint8_t lastEncoderBits;
4969
-    millis_t now = millis();
4965
+    const millis_t now = millis();
4970
     if (ELAPSED(now, next_button_update_ms)) {
4966
     if (ELAPSED(now, next_button_update_ms)) {
4971
 
4967
 
4972
       #if ENABLED(NEWPANEL)
4968
       #if ENABLED(NEWPANEL)
5047
 
5043
 
5048
         #elif ENABLED(REPRAPWORLD_KEYPAD)
5044
         #elif ENABLED(REPRAPWORLD_KEYPAD)
5049
 
5045
 
5050
-          GET_BUTTON_STATES(buttons_reprapworld_keypad);
5046
+          GET_SHIFT_BUTTON_STATES(buttons_reprapworld_keypad);
5051
 
5047
 
5052
         #endif
5048
         #endif
5053
 
5049
 
5054
-      #else
5055
-        GET_BUTTON_STATES(buttons);
5056
-      #endif // !NEWPANEL
5050
+      #else // !NEWPANEL
5051
+
5052
+        GET_SHIFT_BUTTON_STATES(buttons);
5053
+
5054
+      #endif
5057
 
5055
 
5058
     } // next_button_update_ms
5056
     } // next_button_update_ms
5059
 
5057
 

+ 5
- 3
Marlin/ultralcd.h View File

23
 #ifndef ULTRALCD_H
23
 #ifndef ULTRALCD_H
24
 #define ULTRALCD_H
24
 #define ULTRALCD_H
25
 
25
 
26
-#include "Marlin.h"
26
+#include "MarlinConfig.h"
27
 
27
 
28
 #if ENABLED(ULTRA_LCD)
28
 #if ENABLED(ULTRA_LCD)
29
 
29
 
30
+  #include "Marlin.h"
31
+
30
   #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
32
   #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
31
     extern bool lcd_external_control;
33
     extern bool lcd_external_control;
32
     #if ENABLED(G26_MESH_VALIDATION)
34
     #if ENABLED(G26_MESH_VALIDATION)
57
   inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
59
   inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
58
 
60
 
59
   #if HAS_BUZZER
61
   #if HAS_BUZZER
60
-    void lcd_buzz(long duration, uint16_t freq);
62
+    void lcd_buzz(const long duration, const uint16_t freq);
61
   #endif
63
   #endif
62
 
64
 
63
   #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
65
   #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
205
 void lcd_reset_status();
207
 void lcd_reset_status();
206
 
208
 
207
 #if ENABLED(AUTO_BED_LEVELING_UBL)
209
 #if ENABLED(AUTO_BED_LEVELING_UBL)
208
-  void lcd_mesh_edit_setup(float initial);
210
+  void lcd_mesh_edit_setup(const float initial);
209
   float lcd_mesh_edit();
211
   float lcd_mesh_edit();
210
   void lcd_z_offset_edit_setup(float);
212
   void lcd_z_offset_edit_setup(float);
211
   float lcd_z_offset_edit();
213
   float lcd_z_offset_edit();

Loading…
Cancel
Save