浏览代码

Changes for parity with 1.1.x

Scott Lahteine 6 年前
父节点
当前提交
2fde60da12

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl.cpp 查看文件

@@ -64,7 +64,7 @@
64 64
   constexpr float unified_bed_leveling::_mesh_index_to_xpos[16],
65 65
                   unified_bed_leveling::_mesh_index_to_ypos[16];
66 66
 
67
-  #if ENABLED(ULTRA_LCD)
67
+  #if ENABLED(ULTIPANEL)
68 68
     bool unified_bed_leveling::lcd_map_control = false;
69 69
   #endif
70 70
 

+ 9
- 5
Marlin/src/feature/bedlevel/ubl/ubl.h 查看文件

@@ -76,19 +76,23 @@ class unified_bed_leveling {
76 76
       static int  g29_grid_size;
77 77
     #endif
78 78
 
79
-    static float measure_point_with_encoder();
80
-    static float measure_business_card_thickness(float);
79
+    #if ENABLED(NEWPANEL)
80
+      static void move_z_with_encoder(const float &multiplier);
81
+      static float measure_point_with_encoder();
82
+      static float measure_business_card_thickness(const float&);
83
+      static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
84
+      static void fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map);
85
+    #endif
86
+
81 87
     static bool g29_parameter_parsing();
82 88
     static void find_mean_mesh_height();
83 89
     static void shift_mesh_height();
84 90
     static void probe_entire_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest);
85
-    static void manually_probe_remaining_mesh(const float&, const float&, const float&, const float&, const bool);
86 91
     static void tilt_mesh_based_on_3pts(const float &z1, const float &z2, const float &z3);
87 92
     static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
88 93
     static void g29_what_command();
89 94
     static void g29_eeprom_dump();
90 95
     static void g29_compare_current_mesh_to_stored_mesh();
91
-    static void fine_tune_mesh(const float &rx, const float &ry, const bool do_ubl_mesh_map);
92 96
     static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
93 97
     static void smart_fill_mesh();
94 98
 
@@ -137,7 +141,7 @@ class unified_bed_leveling {
137 141
                               MESH_MIN_Y + 14 * (MESH_Y_DIST), MESH_MIN_Y + 15 * (MESH_Y_DIST)
138 142
                             };
139 143
 
140
-    #if ENABLED(ULTRA_LCD)
144
+    #if ENABLED(ULTIPANEL)
141 145
       static bool lcd_map_control;
142 146
     #endif
143 147
 

+ 16
- 20
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp 查看文件

@@ -458,7 +458,7 @@
458 458
                               parser.seen('T'), parser.seen('E'), parser.seen('U'));
459 459
             break;
460 460
 
461
-        #endif
461
+        #endif // HAS_BED_PROBE
462 462
 
463 463
         case 2: {
464 464
           #if ENABLED(NEWPANEL)
@@ -913,7 +913,7 @@
913 913
 
914 914
     static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); }
915 915
 
916
-    float unified_bed_leveling::measure_business_card_thickness(const float in_height) {
916
+    float unified_bed_leveling::measure_business_card_thickness(const float &in_height) {
917 917
       lcd_external_control = true;
918 918
       save_ubl_active_state_and_disable();   // Disable bed level correction for probing
919 919
 
@@ -1033,7 +1033,6 @@
1033 1033
       KEEPALIVE_STATE(IN_HANDLER);
1034 1034
       do_blocking_move_to(rx, ry, Z_CLEARANCE_DEPLOY_PROBE);
1035 1035
     }
1036
-
1037 1036
   #endif // NEWPANEL
1038 1037
 
1039 1038
   bool unified_bed_leveling::g29_parameter_parsing() {
@@ -1078,11 +1077,11 @@
1078 1077
       #endif
1079 1078
         {
1080 1079
           g29_phase_value = pv;
1081
-           if (!WITHIN(g29_phase_value, 0, 6)) {
1082
-             SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
1083
-             err_flag = true;
1084
-           }
1085
-         }
1080
+          if (!WITHIN(g29_phase_value, 0, 6)) {
1081
+            SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
1082
+            err_flag = true;
1083
+          }
1084
+        }
1086 1085
     }
1087 1086
 
1088 1087
     if (parser.seen('J')) {
@@ -1341,11 +1340,10 @@
1341 1340
         z_values[x][y] -= tmp_z_values[x][y];
1342 1341
   }
1343 1342
 
1344
-
1345 1343
   mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
1346 1344
 
1347
-    bool found_a_NAN  = false;
1348
-    bool found_a_real = false;
1345
+    bool found_a_NAN  = false, found_a_real = false;
1346
+
1349 1347
     mesh_index_pair out_mesh;
1350 1348
     out_mesh.x_index = out_mesh.y_index = -1;
1351 1349
     out_mesh.distance = -99999.99;
@@ -1353,12 +1351,12 @@
1353 1351
     for (int8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
1354 1352
       for (int8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
1355 1353
 
1356
-        if ( isnan(z_values[i][j])) { // Check to see if this location holds an invalid mesh point
1354
+        if (isnan(z_values[i][j])) { // Check to see if this location holds an invalid mesh point
1357 1355
 
1358 1356
           const float mx = mesh_index_to_xpos(i),
1359 1357
                       my = mesh_index_to_ypos(j);
1360 1358
 
1361
-          if ( !position_is_reachable_by_probe(mx, my))  // make sure the probe can get to the mesh point
1359
+          if (!position_is_reachable_by_probe(mx, my))  // make sure the probe can get to the mesh point
1362 1360
             continue;
1363 1361
 
1364 1362
           found_a_NAN = true;
@@ -1452,6 +1450,7 @@
1452 1450
         }
1453 1451
       } // for j
1454 1452
     } // for i
1453
+
1455 1454
     return out_mesh;
1456 1455
   }
1457 1456
 
@@ -1499,15 +1498,8 @@
1499 1498
         if (!position_is_reachable(rawx, rawy)) // SHOULD NOT OCCUR because find_closest_mesh_point_of_type will only return reachable
1500 1499
           break;
1501 1500
 
1502
-        float new_z = z_values[location.x_index][location.y_index];
1503
-
1504
-        if (isnan(new_z)) // if the mesh point is invalid, set it to 0.0 so it can be edited
1505
-          new_z = 0.0;
1506
-
1507 1501
         do_blocking_move_to(rawx, rawy, Z_CLEARANCE_BETWEEN_PROBES); // Move the nozzle to the edit point
1508 1502
 
1509
-        new_z = FLOOR(new_z * 1000.0) * 0.001; // Chop off digits after the 1000ths place
1510
-
1511 1503
         KEEPALIVE_STATE(PAUSED_FOR_USER);
1512 1504
         lcd_external_control = true;
1513 1505
 
@@ -1515,6 +1507,10 @@
1515 1507
 
1516 1508
         lcd_refresh();
1517 1509
 
1510
+        float new_z = z_values[location.x_index][location.y_index];
1511
+        if (isnan(new_z)) new_z = 0.0;          // Set invalid mesh points to 0.0 so they can be edited
1512
+        new_z = FLOOR(new_z * 1000.0) * 0.001;  // Chop off digits after the 1000ths place
1513
+
1518 1514
         lcd_mesh_edit_setup(new_z);
1519 1515
 
1520 1516
         do {

+ 12
- 13
Marlin/src/gcode/bedlevel/G26.cpp 查看文件

@@ -53,6 +53,9 @@
53 53
   #error "SIZE_OF_CROSSHAIRS must be less than SIZE_OF_INTERSECTION_CIRCLES."
54 54
 #endif
55 55
 
56
+#define G26_OK false
57
+#define G26_ERR true
58
+
56 59
 /**
57 60
  *   G26 Mesh Validation Tool
58 61
  *
@@ -268,9 +271,7 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de
268 271
   set_destination_from_current();
269 272
 }
270 273
 
271
-FORCE_INLINE void move_to(const float where[XYZE], const float &de) {
272
-  move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], de);
273
-}
274
+FORCE_INLINE void move_to(const float where[XYZE], const float &de) { move_to(where[X_AXIS], where[Y_AXIS], where[Z_AXIS], de); }
274 275
 
275 276
 void retract_filament(const float where[XYZE]) {
276 277
   if (!g26_retracted) { // Only retract if we are not already retracted!
@@ -314,9 +315,8 @@ void print_line_from_here_to_there(const float &sx, const float &sy, const float
314 315
 
315 316
   // If the end point of the line is closer to the nozzle, flip the direction,
316 317
   // moving from the end to the start. On very small lines the optimization isn't worth it.
317
-  if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length)) {
318
+  if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length))
318 319
     return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
319
-  }
320 320
 
321 321
   // Decide whether to retract & bump
322 322
 
@@ -373,7 +373,6 @@ inline bool look_for_lines_to_connect() {
373 373
                 SERIAL_EOL();
374 374
                 //debug_current_and_destination(PSTR("Connecting horizontal line."));
375 375
               }
376
-
377 376
               print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
378 377
             }
379 378
             bitmap_set(horizontal_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if we skipped it
@@ -405,8 +404,8 @@ inline bool look_for_lines_to_connect() {
405 404
                   SERIAL_ECHOPAIR(", ey=", ey);
406 405
                   SERIAL_CHAR(')');
407 406
                   SERIAL_EOL();
407
+
408 408
                   #if ENABLED(AUTO_BED_LEVELING_UBL)
409
-                    void debug_current_and_destination(const char *title);
410 409
                     debug_current_and_destination(PSTR("Connecting vertical line."));
411 410
                   #endif
412 411
                 }
@@ -678,9 +677,8 @@ void GcodeSuite::G26() {
678 677
     return;
679 678
   }
680 679
 
681
-  g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS],
680
+  g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS];
682 681
   g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS];
683
-
684 682
   if (!position_is_reachable(g26_x_pos, g26_y_pos)) {
685 683
     SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
686 684
     return;
@@ -727,6 +725,7 @@ void GcodeSuite::G26() {
727 725
   #if ENABLED(ULTRA_LCD)
728 726
     lcd_external_control = true;
729 727
   #endif
728
+
730 729
   //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
731 730
 
732 731
   /**
@@ -806,7 +805,7 @@ void GcodeSuite::G26() {
806 805
         #if IS_KINEMATIC
807 806
           // Check to make sure this segment is entirely on the bed, skip if not.
808 807
           if (!position_is_reachable(rx, ry) || !position_is_reachable(xe, ye)) continue;
809
-        #else                                              // not, we need to skip
808
+        #else                                               // not, we need to skip
810 809
           rx = constrain(rx, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
811 810
           ry = constrain(ry, Y_MIN_POS + 1, Y_MAX_POS - 1);
812 811
           xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
@@ -842,15 +841,15 @@ void GcodeSuite::G26() {
842 841
   move_to(destination, 0); // Raise the nozzle
843 842
   //debug_current_and_destination(PSTR("done doing Z-Raise."));
844 843
 
845
-  destination[X_AXIS] = g26_x_pos;                                               // Move back to the starting position
844
+  destination[X_AXIS] = g26_x_pos;                               // Move back to the starting position
846 845
   destination[Y_AXIS] = g26_y_pos;
847
-  //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;                        // Keep the nozzle where it is
846
+  //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;            // Keep the nozzle where it is
848 847
 
849 848
   move_to(destination, 0); // Move back to the starting position
850 849
   //debug_current_and_destination(PSTR("done doing X/Y move."));
851 850
 
852 851
   #if ENABLED(ULTRA_LCD)
853
-    lcd_external_control = false;   // Give back control of the LCD Panel!
852
+    lcd_external_control = false;     // Give back control of the LCD Panel!
854 853
   #endif
855 854
 
856 855
   if (!g26_keep_heaters_on) {

+ 4
- 0
Marlin/src/inc/SanityCheck.h 查看文件

@@ -313,11 +313,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
313 313
 #if ENABLED(LCD_PROGRESS_BAR)
314 314
   #if DISABLED(SDSUPPORT)
315 315
     #error "LCD_PROGRESS_BAR requires SDSUPPORT."
316
+  #elif DISABLED(ULTRA_LCD)
317
+    #error "LCD_PROGRESS_BAR requires a character LCD."
316 318
   #elif ENABLED(DOGLCD)
317 319
     #error "LCD_PROGRESS_BAR does not apply to graphical displays."
318 320
   #elif ENABLED(FILAMENT_LCD_DISPLAY)
319 321
     #error "LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both."
320 322
   #endif
323
+#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && DISABLED(DOGLCD)
324
+  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR or Graphical LCD."
321 325
 #endif
322 326
 
323 327
 /**

+ 51
- 53
Marlin/src/lcd/ultralcd.cpp 查看文件

@@ -85,12 +85,13 @@ int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_spe
85 85
 #endif
86 86
 
87 87
 uint8_t lcd_status_update_delay = 1, // First update one loop delayed
88
-        lcd_status_message_level;    // Higher level overrides lower
88
+        lcd_status_message_level;    // Higher level blocks lower level
89 89
 char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
90 90
 
91 91
 #if ENABLED(STATUS_MESSAGE_SCROLLING)
92 92
   uint8_t status_scroll_pos = 0;
93 93
 #endif
94
+
94 95
 #if ENABLED(SCROLL_LONG_FILENAMES)
95 96
   uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash;
96 97
 #endif
@@ -163,8 +164,6 @@ uint16_t max_display_update_time = 0;
163 164
     extern bool powersupply_on;
164 165
   #endif
165 166
 
166
-  float move_menu_scale;
167
-
168 167
   ////////////////////////////////////////////
169 168
   ///////////////// Menu Tree ////////////////
170 169
   ////////////////////////////////////////////
@@ -244,7 +243,6 @@ uint16_t max_display_update_time = 0;
244 243
     void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live=false); \
245 244
     typedef void _name##_void
246 245
 
247
-  DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
248 246
   DECLARE_MENU_EDIT_TYPE(int16_t, int3);
249 247
   DECLARE_MENU_EDIT_TYPE(uint8_t, int8);
250 248
   DECLARE_MENU_EDIT_TYPE(float, float3);
@@ -254,6 +252,7 @@ uint16_t max_display_update_time = 0;
254 252
   DECLARE_MENU_EDIT_TYPE(float, float51);
255 253
   DECLARE_MENU_EDIT_TYPE(float, float52);
256 254
   DECLARE_MENU_EDIT_TYPE(float, float62);
255
+  DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
257 256
 
258 257
   void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
259 258
   void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
@@ -566,10 +565,9 @@ uint16_t max_display_update_time = 0;
566 565
     static bool no_reentry = false;
567 566
     if (lcdDrawUpdate) lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, sync_message);
568 567
     if (no_reentry) return;
569
-
570 568
     // Make this the current handler till all moves are done
571 569
     no_reentry = true;
572
-    screenFunc_t old_screen = currentScreen;
570
+    const screenFunc_t old_screen = currentScreen;
573 571
     lcd_goto_screen(_lcd_synchronize);
574 572
     stepper.synchronize();
575 573
     no_reentry = false;
@@ -997,7 +995,7 @@ void kill_screen(const char* lcd_msg) {
997 995
     #if ENABLED(SDSUPPORT)
998 996
       if (card.cardOK) {
999 997
         if (card.isFileOpen()) {
1000
-          if (IS_SD_PRINTING)
998
+          if (card.sdprinting)
1001 999
             MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause);
1002 1000
           else
1003 1001
             MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
@@ -1074,7 +1072,7 @@ void kill_screen(const char* lcd_msg) {
1074 1072
       if (PAGE_CONTAINS(20, 20)) u8g.drawBitmapP(nozzle + 0, 20, 3, 1, offset_bedline_bmp);
1075 1073
 
1076 1074
       // Draw cw/ccw indicator and up/down arrows.
1077
-      if (PAGE_CONTAINS(47,62)) {
1075
+      if (PAGE_CONTAINS(47, 62)) {
1078 1076
         u8g.drawBitmapP(left  + 0, 47, 3, 16, rot_down);
1079 1077
         u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up);
1080 1078
         u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp);
@@ -1115,6 +1113,8 @@ void kill_screen(const char* lcd_msg) {
1115 1113
         ENCODER_DIRECTION_NORMAL();
1116 1114
         if (encoderPosition) {
1117 1115
           const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
1116
+          encoderPosition = 0;
1117
+
1118 1118
           const float new_zoffset = zprobe_zoffset + planner.steps_to_mm[Z_AXIS] * babystep_increment;
1119 1119
           if (WITHIN(new_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
1120 1120
 
@@ -1124,7 +1124,6 @@ void kill_screen(const char* lcd_msg) {
1124 1124
             zprobe_zoffset = new_zoffset;
1125 1125
             lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
1126 1126
           }
1127
-          encoderPosition = 0;
1128 1127
         }
1129 1128
         if (lcdDrawUpdate) {
1130 1129
           lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset));
@@ -1164,11 +1163,12 @@ void kill_screen(const char* lcd_msg) {
1164 1163
         mesh_edit_value = float(rounded - (rounded % 5L)) / 1000.0;
1165 1164
       }
1166 1165
 
1167
-      if (lcdDrawUpdate)
1166
+      if (lcdDrawUpdate) {
1168 1167
         lcd_implementation_drawedit(msg, ftostr43sign(mesh_edit_value));
1169 1168
         #if ENABLED(MESH_EDIT_GFX_OVERLAY)
1170 1169
           _lcd_zoffset_overlay_gfx(mesh_edit_value);
1171 1170
         #endif
1171
+      }
1172 1172
     }
1173 1173
 
1174 1174
     void _lcd_mesh_edit_NOP() {
@@ -1182,7 +1182,7 @@ void kill_screen(const char* lcd_msg) {
1182 1182
       return mesh_edit_value;
1183 1183
     }
1184 1184
 
1185
-    void lcd_mesh_edit_setup(float initial) {
1185
+    void lcd_mesh_edit_setup(const float initial) {
1186 1186
       mesh_edit_value = mesh_edit_accumulator = initial;
1187 1187
       lcd_goto_screen(_lcd_mesh_edit_NOP);
1188 1188
     }
@@ -1203,6 +1203,7 @@ void kill_screen(const char* lcd_msg) {
1203 1203
 
1204 1204
   #endif // AUTO_BED_LEVELING_UBL
1205 1205
 
1206
+
1206 1207
   /**
1207 1208
    * Watch temperature callbacks
1208 1209
    */
@@ -2030,8 +2031,8 @@ void kill_screen(const char* lcd_msg) {
2030 2031
      */
2031 2032
     void _lcd_ubl_adjust_height_cmd() {
2032 2033
       char UBL_LCD_GCODE[16];
2033
-      const int ind = ubl_height_amount < 0 ? 6 : 7;
2034
-      strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6-"));
2034
+      const int ind = ubl_height_amount > 0 ? 9 : 10;
2035
+      strcpy_P(UBL_LCD_GCODE, PSTR("G29 P6 C -"));
2035 2036
       sprintf_P(&UBL_LCD_GCODE[ind], PSTR(".%i"), abs(ubl_height_amount));
2036 2037
       enqueue_and_echo_command(UBL_LCD_GCODE);
2037 2038
     }
@@ -2047,8 +2048,7 @@ void kill_screen(const char* lcd_msg) {
2047 2048
     void _lcd_ubl_height_adjust_menu() {
2048 2049
       START_MENU();
2049 2050
       MENU_BACK(MSG_UBL_EDIT_MESH_MENU);
2050
-      MENU_ITEM_EDIT(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9);
2051
-      MENU_ITEM(function, MSG_UBL_MESH_HEIGHT_ADJUST, _lcd_ubl_adjust_height_cmd);
2051
+      MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_MESH_HEIGHT_AMOUNT, &ubl_height_amount, -9, 9, _lcd_ubl_adjust_height_cmd);
2052 2052
       MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
2053 2053
       END_MENU();
2054 2054
     }
@@ -2184,8 +2184,7 @@ void kill_screen(const char* lcd_msg) {
2184 2184
     void _lcd_ubl_fillin_menu() {
2185 2185
       START_MENU();
2186 2186
       MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
2187
-      MENU_ITEM_EDIT(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9);
2188
-      MENU_ITEM(function, MSG_UBL_FILLIN_MESH, _lcd_ubl_fillin_amount_cmd);
2187
+      MENU_ITEM_EDIT_CALLBACK(int3, MSG_UBL_FILLIN_AMOUNT, &ubl_fillin_amount, 0, 9, _lcd_ubl_fillin_amount_cmd);
2189 2188
       MENU_ITEM(function, MSG_UBL_SMART_FILLIN, _lcd_ubl_smart_fillin_cmd);
2190 2189
       MENU_ITEM(gcode, MSG_UBL_MANUAL_FILLIN, PSTR("G29 P2 B T0"));
2191 2190
       MENU_ITEM(function, MSG_WATCH, lcd_return_to_status);
@@ -2644,6 +2643,8 @@ void kill_screen(const char* lcd_msg) {
2644 2643
     END_MENU();
2645 2644
   }
2646 2645
 
2646
+  float move_menu_scale;
2647
+
2647 2648
   #if ENABLED(DELTA_CALIBRATION_MENU) || (ENABLED(DELTA_AUTO_CALIBRATION) && !HAS_BED_PROBE)
2648 2649
 
2649 2650
     void lcd_move_z();
@@ -2653,13 +2654,11 @@ void kill_screen(const char* lcd_msg) {
2653 2654
         reset_bed_level(); // After calibration bed-level data is no longer valid
2654 2655
       #endif
2655 2656
 
2656
-      float z_dest = (Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5;
2657
-      line_to_z(z_dest);
2657
+      line_to_z((Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
2658 2658
       current_position[X_AXIS] = rx;
2659 2659
       current_position[Y_AXIS] = ry;
2660 2660
       line_to_current_z();
2661
-      z_dest = Z_CLEARANCE_BETWEEN_PROBES;
2662
-      line_to_z(z_dest);
2661
+      line_to_z(Z_CLEARANCE_BETWEEN_PROBES);
2663 2662
 
2664 2663
       lcd_synchronize();
2665 2664
       move_menu_scale = PROBE_MANUALLY_STEP;
@@ -2813,7 +2812,6 @@ void kill_screen(const char* lcd_msg) {
2813 2812
       #endif
2814 2813
           manual_move_e_index = eindex >= 0 ? eindex : active_extruder;
2815 2814
     #endif
2816
-
2817 2815
     manual_move_start_time = millis() + (move_menu_scale < 0.99 ? 0UL : 250UL); // delay for bigger moves
2818 2816
     manual_move_axis = (int8_t)axis;
2819 2817
   }
@@ -2830,6 +2828,7 @@ void kill_screen(const char* lcd_msg) {
2830 2828
     if (encoderPosition && !processing_manual_move) {
2831 2829
       gcode.refresh_cmd_timeout();
2832 2830
 
2831
+      // Start with no limits to movement
2833 2832
       float min = current_position[axis] - 1000,
2834 2833
             max = current_position[axis] + 1000;
2835 2834
 
@@ -2867,7 +2866,7 @@ void kill_screen(const char* lcd_msg) {
2867 2866
       // This assumes the center is 0,0
2868 2867
       #if ENABLED(DELTA)
2869 2868
         if (axis != Z_AXIS) {
2870
-          max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis]));
2869
+          max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
2871 2870
           min = -max;
2872 2871
         }
2873 2872
       #endif
@@ -3131,7 +3130,7 @@ void kill_screen(const char* lcd_msg) {
3131 3130
     MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_filament_menu);
3132 3131
 
3133 3132
     #if HAS_LCD_CONTRAST
3134
-      MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, (int16_t*)&lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
3133
+      MENU_ITEM_EDIT_CALLBACK(int3, MSG_CONTRAST, &lcd_contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, lcd_callback_set_contrast, true);
3135 3134
     #endif
3136 3135
     #if ENABLED(FWRETRACT)
3137 3136
       MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
@@ -3724,7 +3723,7 @@ void kill_screen(const char* lcd_msg) {
3724 3723
 
3725 3724
         lcd_goto_screen(lcd_sdcard_menu, last_sdfile_encoderPosition);
3726 3725
         defer_return_to_status = true;
3727
-        last_sdfile_encoderPosition == 0xFFFF;
3726
+        last_sdfile_encoderPosition = 0xFFFF;
3728 3727
 
3729 3728
         #if ENABLED(DOGLCD)
3730 3729
           lcd_update();
@@ -3749,29 +3748,27 @@ void kill_screen(const char* lcd_msg) {
3749 3748
         MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
3750 3749
       }
3751 3750
 
3752
-      if (fileCnt) {
3753
-        for (uint16_t i = 0; i < fileCnt; i++) {
3754
-          if (_menuLineNr == _thisItemNr) {
3755
-            const uint16_t nr =
3756
-              #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA)
3757
-                fileCnt - 1 -
3758
-              #endif
3759
-            i;
3760
-
3761
-            #if ENABLED(SDCARD_SORT_ALPHA)
3762
-              card.getfilename_sorted(nr);
3763
-            #else
3764
-              card.getfilename(nr);
3751
+      for (uint16_t i = 0; i < fileCnt; i++) {
3752
+        if (_menuLineNr == _thisItemNr) {
3753
+          const uint16_t nr =
3754
+            #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA)
3755
+              fileCnt - 1 -
3765 3756
             #endif
3757
+          i;
3766 3758
 
3767
-            if (card.filenameIsDir)
3768
-              MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
3769
-            else
3770
-              MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
3771
-          }
3772
-          else {
3773
-            MENU_ITEM_DUMMY();
3774
-          }
3759
+          #if ENABLED(SDCARD_SORT_ALPHA)
3760
+            card.getfilename_sorted(nr);
3761
+          #else
3762
+            card.getfilename(nr);
3763
+          #endif
3764
+
3765
+          if (card.filenameIsDir)
3766
+            MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
3767
+          else
3768
+            MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
3769
+        }
3770
+        else {
3771
+          MENU_ITEM_DUMMY();
3775 3772
         }
3776 3773
       }
3777 3774
       END_MENU();
@@ -4476,13 +4473,14 @@ void lcd_init() {
4476 4473
   lcd_implementation_init();
4477 4474
 
4478 4475
   #if ENABLED(NEWPANEL)
4479
-
4480 4476
     #if BUTTON_EXISTS(EN1)
4481 4477
       SET_INPUT_PULLUP(BTN_EN1);
4482 4478
     #endif
4479
+
4483 4480
     #if BUTTON_EXISTS(EN2)
4484 4481
       SET_INPUT_PULLUP(BTN_EN2);
4485 4482
     #endif
4483
+
4486 4484
     #if BUTTON_EXISTS(ENC)
4487 4485
       SET_INPUT_PULLUP(BTN_ENC);
4488 4486
     #endif
@@ -4684,7 +4682,7 @@ void lcd_update() {
4684 4682
 
4685 4683
       #endif
4686 4684
 
4687
-      bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
4685
+      const bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
4688 4686
       if (encoderPastThreshold || lcd_clicked) {
4689 4687
         if (encoderPastThreshold) {
4690 4688
           int32_t encoderMultiplier = 1;
@@ -4979,11 +4977,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
4979 4977
           if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
4980 4978
         #endif
4981 4979
 
4982
-        buttons = newbutton;
4983
-        #if ENABLED(LCD_HAS_SLOW_BUTTONS)
4984
-          buttons |= slow_buttons;
4985
-        #endif
4986
-
4987 4980
         //
4988 4981
         // Directional buttons
4989 4982
         //
@@ -5032,6 +5025,11 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
5032 5025
 
5033 5026
         #endif // LCD_HAS_DIRECTIONAL_BUTTONS
5034 5027
 
5028
+        buttons = newbutton;
5029
+        #if ENABLED(LCD_HAS_SLOW_BUTTONS)
5030
+          buttons |= slow_buttons;
5031
+        #endif
5032
+
5035 5033
         #if ENABLED(ADC_KEYPAD)
5036 5034
 
5037 5035
           uint8_t newbutton_reprapworld_keypad = 0;

+ 9
- 4
Marlin/src/module/planner.cpp 查看文件

@@ -135,15 +135,20 @@ float Planner::min_feedrate_mm_s,
135 135
           Planner::inverse_z_fade_height,
136 136
           Planner::last_fade_z;
137 137
   #endif
138
+#else
139
+  constexpr bool Planner::leveling_active;
138 140
 #endif
139 141
 
140 142
 #if ENABLED(SKEW_CORRECTION)
141 143
   #if ENABLED(SKEW_CORRECTION_GCODE)
142
-    // Initialized by settings.load()
143 144
     float Planner::xy_skew_factor;
144
-    #if ENABLED(SKEW_CORRECTION_FOR_Z)
145
-      float Planner::xz_skew_factor, Planner::yz_skew_factor;
146
-    #endif
145
+  #else
146
+    constexpr float Planner::xy_skew_factor;
147
+  #endif
148
+  #if ENABLED(SKEW_CORRECTION_FOR_Z) && ENABLED(SKEW_CORRECTION_GCODE)
149
+    float Planner::xz_skew_factor, Planner::yz_skew_factor;
150
+  #else
151
+    constexpr float Planner::xz_skew_factor, Planner::yz_skew_factor;
147 152
   #endif
148 153
 #endif
149 154
 

+ 3
- 8
Marlin/src/module/stepper.cpp 查看文件

@@ -97,18 +97,13 @@ uint8_t Stepper::last_direction_bits = 0;        // The next stepping-bits to be
97 97
 int16_t Stepper::cleaning_buffer_counter = 0;
98 98
 
99 99
 #if ENABLED(X_DUAL_ENDSTOPS)
100
-  bool Stepper::locked_x_motor = false;
101
-  bool Stepper::locked_x2_motor = false;
100
+  bool Stepper::locked_x_motor = false, Stepper::locked_x2_motor = false;
102 101
 #endif
103
-
104 102
 #if ENABLED(Y_DUAL_ENDSTOPS)
105
-  bool Stepper::locked_y_motor = false;
106
-  bool Stepper::locked_y2_motor = false;
103
+  bool Stepper::locked_y_motor = false, Stepper::locked_y2_motor = false;
107 104
 #endif
108
-
109 105
 #if ENABLED(Z_DUAL_ENDSTOPS)
110
-  bool Stepper::locked_z_motor = false;
111
-  bool Stepper::locked_z2_motor = false;
106
+  bool Stepper::locked_z_motor = false, Stepper::locked_z2_motor = false;
112 107
 #endif
113 108
 
114 109
 long Stepper::counter_X = 0,

正在加载...
取消
保存