Browse Source

Within applied to UBL

Scott Lahteine 8 years ago
parent
commit
b19a15fa7f
5 changed files with 37 additions and 37 deletions
  1. 10
    10
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 7
    7
      Marlin/SanityCheck.h
  3. 2
    2
      Marlin/UBL.h
  4. 2
    2
      Marlin/UBL_Bed_Leveling.cpp
  5. 16
    16
      Marlin/UBL_G29.cpp

+ 10
- 10
Marlin/G26_Mesh_Validation_Tool.cpp View File

267
         #endif
267
         #endif
268
 
268
 
269
         // TODO: Change this to use `position_is_reachable`
269
         // TODO: Change this to use `position_is_reachable`
270
-        if (circle_x < (X_MIN_POS) || circle_x > (X_MAX_POS) || circle_y < (Y_MIN_POS) || circle_y > (Y_MAX_POS)) {
270
+        if (!WITHIN(circle_x, X_MIN_POS, X_MAX_POS) || !WITHIN(circle_y, Y_MIN_POS, Y_MAX_POS)) {
271
           SERIAL_ERROR_START;
271
           SERIAL_ERROR_START;
272
           SERIAL_ERRORLNPGM("Attempt to print off the bed.");
272
           SERIAL_ERRORLNPGM("Attempt to print off the bed.");
273
           goto LEAVE;
273
           goto LEAVE;
638
 
638
 
639
     if (code_seen('B')) {
639
     if (code_seen('B')) {
640
       bed_temp = code_value_float();
640
       bed_temp = code_value_float();
641
-      if (bed_temp < 15.0 || bed_temp > 140.0) {
641
+      if (!WITHIN(bed_temp, 15.0, 140.0)) {
642
         SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible.");
642
         SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible.");
643
         return UBL_ERR;
643
         return UBL_ERR;
644
       }
644
       }
648
 
648
 
649
     if (code_seen('L')) {
649
     if (code_seen('L')) {
650
       layer_height = code_value_float();
650
       layer_height = code_value_float();
651
-      if (layer_height < 0.0 || layer_height > 2.0) {
651
+      if (!WITHIN(layer_height, 0.0, 2.0)) {
652
         SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
652
         SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
653
         return UBL_ERR;
653
         return UBL_ERR;
654
       }
654
       }
657
     if (code_seen('Q')) {
657
     if (code_seen('Q')) {
658
       if (code_has_value()) {
658
       if (code_has_value()) {
659
         retraction_multiplier = code_value_float();
659
         retraction_multiplier = code_value_float();
660
-        if (retraction_multiplier < 0.05 || retraction_multiplier > 15.0) {
660
+        if (!WITHIN(retraction_multiplier, 0.05, 15.0)) {
661
           SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
661
           SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
662
           return UBL_ERR;
662
           return UBL_ERR;
663
         }
663
         }
670
 
670
 
671
     if (code_seen('N')) {
671
     if (code_seen('N')) {
672
       nozzle = code_value_float();
672
       nozzle = code_value_float();
673
-      if (nozzle < 0.1 || nozzle > 1.0) {
673
+      if (!WITHIN(nozzle, 0.1, 1.0)) {
674
         SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
674
         SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
675
         return UBL_ERR;
675
         return UBL_ERR;
676
       }
676
       }
687
       else {
687
       else {
688
         prime_flag++;
688
         prime_flag++;
689
         prime_length = code_value_float();
689
         prime_length = code_value_float();
690
-        if (prime_length < 0.0 || prime_length > 25.0) {
690
+        if (!WITHIN(prime_length, 0.0, 25.0)) {
691
           SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
691
           SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
692
           return UBL_ERR;
692
           return UBL_ERR;
693
         }
693
         }
696
 
696
 
697
     if (code_seen('F')) {
697
     if (code_seen('F')) {
698
       filament_diameter = code_value_float();
698
       filament_diameter = code_value_float();
699
-      if (filament_diameter < 1.0 || filament_diameter > 4.0) {
699
+      if (!WITHIN(filament_diameter, 1.0, 4.0)) {
700
         SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
700
         SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
701
         return UBL_ERR;
701
         return UBL_ERR;
702
       }
702
       }
709
 
709
 
710
     if (code_seen('H')) {
710
     if (code_seen('H')) {
711
       hotend_temp = code_value_float();
711
       hotend_temp = code_value_float();
712
-      if (hotend_temp < 165.0 || hotend_temp > 280.0) {
712
+      if (!WITHIN(hotend_temp, 165.0, 280.0)) {
713
         SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
713
         SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
714
         return UBL_ERR;
714
         return UBL_ERR;
715
       }
715
       }
725
 
725
 
726
     if (code_seen('X')) {
726
     if (code_seen('X')) {
727
       x_pos = code_value_float();
727
       x_pos = code_value_float();
728
-      if (x_pos < X_MIN_POS || x_pos > X_MAX_POS) {
728
+      if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) {
729
         SERIAL_PROTOCOLLNPGM("?Specified X coordinate not plausible.");
729
         SERIAL_PROTOCOLLNPGM("?Specified X coordinate not plausible.");
730
         return UBL_ERR;
730
         return UBL_ERR;
731
       }
731
       }
734
 
734
 
735
     if (code_seen('Y')) {
735
     if (code_seen('Y')) {
736
       y_pos = code_value_float();
736
       y_pos = code_value_float();
737
-      if (y_pos < Y_MIN_POS || y_pos > Y_MAX_POS) {
737
+      if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) {
738
         SERIAL_PROTOCOLLNPGM("?Specified Y coordinate not plausible.");
738
         SERIAL_PROTOCOLLNPGM("?Specified Y coordinate not plausible.");
739
         return UBL_ERR;
739
         return UBL_ERR;
740
       }
740
       }

+ 7
- 7
Marlin/SanityCheck.h View File

598
   #elif ENABLED(AUTO_BED_LEVELING_UBL)
598
   #elif ENABLED(AUTO_BED_LEVELING_UBL)
599
     #if DISABLED(EEPROM_SETTINGS)
599
     #if DISABLED(EEPROM_SETTINGS)
600
       #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS. Please update your configuration."
600
       #error "AUTO_BED_LEVELING_UBL requires EEPROM_SETTINGS. Please update your configuration."
601
-    #elif UBL_MESH_NUM_X_POINTS < 3 || UBL_MESH_NUM_X_POINTS > 15 || UBL_MESH_NUM_Y_POINTS < 3 || UBL_MESH_NUM_Y_POINTS > 15
601
+    #elif !WITHIN(UBL_MESH_NUM_X_POINTS, 3, 15) || !WITHIN(UBL_MESH_NUM_Y_POINTS, 3, 15)
602
       #error "UBL_MESH_NUM_[XY]_POINTS must be a whole number between 3 and 15."
602
       #error "UBL_MESH_NUM_[XY]_POINTS must be a whole number between 3 and 15."
603
-    #elif UBL_PROBE_PT_1_X < MIN_PROBE_X || UBL_PROBE_PT_1_X > MAX_PROBE_X
603
+    #elif !WITHIN(UBL_PROBE_PT_1_X, MIN_PROBE_X, MAX_PROBE_X)
604
       #error "The given UBL_PROBE_PT_1_X can't be reached by the Z probe."
604
       #error "The given UBL_PROBE_PT_1_X can't be reached by the Z probe."
605
-    #elif UBL_PROBE_PT_2_X < MIN_PROBE_X || UBL_PROBE_PT_2_X > MAX_PROBE_X
605
+    #elif !WITHIN(UBL_PROBE_PT_2_X, MIN_PROBE_X, MAX_PROBE_X)
606
       #error "The given UBL_PROBE_PT_2_X can't be reached by the Z probe."
606
       #error "The given UBL_PROBE_PT_2_X can't be reached by the Z probe."
607
-    #elif UBL_PROBE_PT_3_X < MIN_PROBE_X || UBL_PROBE_PT_3_X > MAX_PROBE_X
607
+    #elif !WITHIN(UBL_PROBE_PT_3_X, MIN_PROBE_X, MAX_PROBE_X)
608
       #error "The given UBL_PROBE_PT_3_X can't be reached by the Z probe."
608
       #error "The given UBL_PROBE_PT_3_X can't be reached by the Z probe."
609
-    #elif UBL_PROBE_PT_1_Y < MIN_PROBE_Y || UBL_PROBE_PT_1_Y > MAX_PROBE_Y
609
+    #elif !WITHIN(UBL_PROBE_PT_1_Y, MIN_PROBE_Y, MAX_PROBE_Y)
610
       #error "The given UBL_PROBE_PT_1_Y can't be reached by the Z probe."
610
       #error "The given UBL_PROBE_PT_1_Y can't be reached by the Z probe."
611
-    #elif UBL_PROBE_PT_2_Y < MIN_PROBE_Y || UBL_PROBE_PT_2_Y > MAX_PROBE_Y
611
+    #elif !WITHIN(UBL_PROBE_PT_2_Y, MIN_PROBE_Y, MAX_PROBE_Y)
612
       #error "The given UBL_PROBE_PT_2_Y can't be reached by the Z probe."
612
       #error "The given UBL_PROBE_PT_2_Y can't be reached by the Z probe."
613
-    #elif UBL_PROBE_PT_3_Y < MIN_PROBE_Y || UBL_PROBE_PT_3_Y > MAX_PROBE_Y
613
+    #elif !WITHIN(UBL_PROBE_PT_3_Y, MIN_PROBE_Y, MAX_PROBE_Y)
614
       #error "The given UBL_PROBE_PT_3_Y can't be reached by the Z probe."
614
       #error "The given UBL_PROBE_PT_3_Y can't be reached by the Z probe."
615
     #endif
615
     #endif
616
   #else // AUTO_BED_LEVELING_3POINT
616
   #else // AUTO_BED_LEVELING_3POINT

+ 2
- 2
Marlin/UBL.h View File

169
 
169
 
170
         static int8_t find_closest_x_index(const float &x) {
170
         static int8_t find_closest_x_index(const float &x) {
171
           const int8_t px = (x - (UBL_MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST));
171
           const int8_t px = (x - (UBL_MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST));
172
-          return (px >= 0 && px < (UBL_MESH_NUM_X_POINTS)) ? px : -1;
172
+          return WITHIN(px, 0, UBL_MESH_NUM_X_POINTS - 1) ? px : -1;
173
         }
173
         }
174
 
174
 
175
         static int8_t find_closest_y_index(const float &y) {
175
         static int8_t find_closest_y_index(const float &y) {
176
           const int8_t py = (y - (UBL_MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0 / (MESH_Y_DIST));
176
           const int8_t py = (y - (UBL_MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0 / (MESH_Y_DIST));
177
-          return (py >= 0 && py < (UBL_MESH_NUM_Y_POINTS)) ? py : -1;
177
+          return WITHIN(py, 0, UBL_MESH_NUM_Y_POINTS - 1) ? py : -1;
178
         }
178
         }
179
 
179
 
180
         /**
180
         /**

+ 2
- 2
Marlin/UBL_Bed_Leveling.cpp View File

118
       return;
118
       return;
119
     }
119
     }
120
 
120
 
121
-    if (m < 0 || m >= j || eeprom_start <= 0) {
121
+    if (!WITHIN(m, 0, j - 1) || eeprom_start <= 0) {
122
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
122
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
123
       return;
123
       return;
124
     }
124
     }
133
   void unified_bed_leveling::store_mesh(const int16_t m) {
133
   void unified_bed_leveling::store_mesh(const int16_t m) {
134
     int16_t j = (UBL_LAST_EEPROM_INDEX - eeprom_start) / sizeof(z_values);
134
     int16_t j = (UBL_LAST_EEPROM_INDEX - eeprom_start) / sizeof(z_values);
135
 
135
 
136
-    if (m < 0 || m >= j || eeprom_start <= 0) {
136
+    if (!WITHIN(m, 0, j - 1) || eeprom_start <= 0) {
137
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
137
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
138
       SERIAL_PROTOCOL(m);
138
       SERIAL_PROTOCOL(m);
139
       SERIAL_PROTOCOLLNPGM(" mesh slots available.\n");
139
       SERIAL_PROTOCOLLNPGM(" mesh slots available.\n");

+ 16
- 16
Marlin/UBL_G29.cpp View File

341
     if (code_seen('Q')) {
341
     if (code_seen('Q')) {
342
 
342
 
343
       const int test_pattern = code_has_value() ? code_value_int() : -1;
343
       const int test_pattern = code_has_value() ? code_value_int() : -1;
344
-      if (test_pattern < 0 || test_pattern > 2) {
344
+      if (!WITHIN(test_pattern, 0, 2)) {
345
         SERIAL_PROTOCOLLNPGM("Invalid test_pattern value. (0-2)\n");
345
         SERIAL_PROTOCOLLNPGM("Invalid test_pattern value. (0-2)\n");
346
         return;
346
         return;
347
       }
347
       }
374
     /*
374
     /*
375
     if (code_seen('U')) {
375
     if (code_seen('U')) {
376
       unlevel_value = code_value_int();
376
       unlevel_value = code_value_int();
377
-      //if (unlevel_value < 0 || unlevel_value > 7) {
377
+      //if (!WITHIN(unlevel_value, 0, 7)) {
378
       //  SERIAL_PROTOCOLLNPGM("Invalid Unlevel value. (0-4)\n");
378
       //  SERIAL_PROTOCOLLNPGM("Invalid Unlevel value. (0-4)\n");
379
       //  return;
379
       //  return;
380
       //}
380
       //}
383
 
383
 
384
     if (code_seen('P')) {
384
     if (code_seen('P')) {
385
       phase_value = code_value_int();
385
       phase_value = code_value_int();
386
-      if (phase_value < 0 || phase_value > 7) {
386
+      if (!WITHIN(phase_value, 0, 7)) {
387
         SERIAL_PROTOCOLLNPGM("Invalid Phase value. (0-4)\n");
387
         SERIAL_PROTOCOLLNPGM("Invalid Phase value. (0-4)\n");
388
         return;
388
         return;
389
       }
389
       }
566
 
566
 
567
       const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
567
       const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
568
 
568
 
569
-      if (storage_slot < 0 || storage_slot >= j || ubl.eeprom_start <= 0) {
569
+      if (!WITHIN(storage_slot, 0, j - 1) || ubl.eeprom_start <= 0) {
570
         SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
570
         SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
571
         return;
571
         return;
572
       }
572
       }
600
 
600
 
601
       const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
601
       const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
602
 
602
 
603
-      if (storage_slot < 0 || storage_slot >= j || ubl.eeprom_start <= 0) {
603
+      if (!WITHIN(storage_slot, 0, j - 1) || ubl.eeprom_start <= 0) {
604
         SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
604
         SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
605
         SERIAL_PROTOCOLLNPAIR("?Use 0 to ", j - 1);
605
         SERIAL_PROTOCOLLNPAIR("?Use 0 to ", j - 1);
606
         goto LEAVE;
606
         goto LEAVE;
760
                     rawy = ubl.mesh_index_to_ypos[location.y_index];
760
                     rawy = ubl.mesh_index_to_ypos[location.y_index];
761
 
761
 
762
         // TODO: Change to use `position_is_reachable` (for SCARA-compatibility)
762
         // TODO: Change to use `position_is_reachable` (for SCARA-compatibility)
763
-        if (rawx < (MIN_PROBE_X) || rawx > (MAX_PROBE_X) || rawy < (MIN_PROBE_Y) || rawy > (MAX_PROBE_Y)) {
763
+        if (!WITHIN(rawx, MIN_PROBE_X, MAX_PROBE_X) || !WITHIN(rawy, MIN_PROBE_Y, MAX_PROBE_Y)) {
764
           SERIAL_ERROR_START;
764
           SERIAL_ERROR_START;
765
           SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
765
           SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
766
           ubl.has_control_of_lcd_panel = false;
766
           ubl.has_control_of_lcd_panel = false;
910
                   rawy = ubl.mesh_index_to_ypos[location.y_index];
910
                   rawy = ubl.mesh_index_to_ypos[location.y_index];
911
 
911
 
912
       // TODO: Change to use `position_is_reachable` (for SCARA-compatibility)
912
       // TODO: Change to use `position_is_reachable` (for SCARA-compatibility)
913
-      if (rawx < (X_MIN_POS) || rawx > (X_MAX_POS) || rawy < (Y_MIN_POS) || rawy > (Y_MAX_POS)) {
913
+      if (!WITHIN(rawx, X_MIN_POS, X_MAX_POS) || !WITHIN(rawy, Y_MIN_POS, Y_MAX_POS)) {
914
         SERIAL_ERROR_START;
914
         SERIAL_ERROR_START;
915
         SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
915
         SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
916
         ubl.has_control_of_lcd_panel = false;
916
         ubl.has_control_of_lcd_panel = false;
982
     #endif
982
     #endif
983
 
983
 
984
     g29_verbose_level = code_seen('V') ? code_value_int() : 0;
984
     g29_verbose_level = code_seen('V') ? code_value_int() : 0;
985
-    if (g29_verbose_level < 0 || g29_verbose_level > 4) {
985
+    if (!WITHIN(g29_verbose_level, 0, 4)) {
986
       SERIAL_PROTOCOLLNPGM("Invalid Verbose Level specified. (0-4)\n");
986
       SERIAL_PROTOCOLLNPGM("Invalid Verbose Level specified. (0-4)\n");
987
       return UBL_ERR;
987
       return UBL_ERR;
988
     }
988
     }
989
 
989
 
990
     x_flag = code_seen('X') && code_has_value();
990
     x_flag = code_seen('X') && code_has_value();
991
     x_pos = x_flag ? code_value_float() : current_position[X_AXIS];
991
     x_pos = x_flag ? code_value_float() : current_position[X_AXIS];
992
-    if (x_pos < LOGICAL_X_POSITION(X_MIN_POS) || x_pos > LOGICAL_X_POSITION(X_MAX_POS)) {
992
+    if (!WITHIN(RAW_X_POSITION(x_pos), X_MIN_POS, X_MAX_POS)) {
993
       SERIAL_PROTOCOLLNPGM("Invalid X location specified.\n");
993
       SERIAL_PROTOCOLLNPGM("Invalid X location specified.\n");
994
       return UBL_ERR;
994
       return UBL_ERR;
995
     }
995
     }
996
 
996
 
997
     y_flag = code_seen('Y') && code_has_value();
997
     y_flag = code_seen('Y') && code_has_value();
998
     y_pos = y_flag ? code_value_float() : current_position[Y_AXIS];
998
     y_pos = y_flag ? code_value_float() : current_position[Y_AXIS];
999
-    if (y_pos < LOGICAL_Y_POSITION(Y_MIN_POS) || y_pos > LOGICAL_Y_POSITION(Y_MAX_POS)) {
999
+    if (!WITHIN(RAW_Y_POSITION(y_pos), Y_MIN_POS, Y_MAX_POS)) {
1000
       SERIAL_PROTOCOLLNPGM("Invalid Y location specified.\n");
1000
       SERIAL_PROTOCOLLNPGM("Invalid Y location specified.\n");
1001
       return UBL_ERR;
1001
       return UBL_ERR;
1002
     }
1002
     }
1024
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1024
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
1025
       if (code_seen('F') && code_has_value()) {
1025
       if (code_seen('F') && code_has_value()) {
1026
         const float fh = code_value_float();
1026
         const float fh = code_value_float();
1027
-        if (fh < 0.0 || fh > 100.0) {
1027
+        if (!WITHIN(fh, 0.0, 100.0)) {
1028
           SERIAL_PROTOCOLLNPGM("?Bed Level Correction Fade Height Not Plausible.\n");
1028
           SERIAL_PROTOCOLLNPGM("?Bed Level Correction Fade Height Not Plausible.\n");
1029
           return UBL_ERR;
1029
           return UBL_ERR;
1030
         }
1030
         }
1041
     }
1041
     }
1042
 
1042
 
1043
     map_type = code_seen('O') && code_has_value() ? code_value_int() : 0;
1043
     map_type = code_seen('O') && code_has_value() ? code_value_int() : 0;
1044
-    if (map_type < 0 || map_type > 1) {
1044
+    if (!WITHIN(map_type, 0, 1)) {
1045
       SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
1045
       SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
1046
       return UBL_ERR;
1046
       return UBL_ERR;
1047
     }
1047
     }
1049
     /*
1049
     /*
1050
     if (code_seen('M')) {     // Check if a map type was specified
1050
     if (code_seen('M')) {     // Check if a map type was specified
1051
       map_type = code_has_value() ? code_value_int() : 0; 
1051
       map_type = code_has_value() ? code_value_int() : 0; 
1052
-      if (map_type < 0 || map_type > 1) {
1052
+      if (!WITHIN(map_type, 0, 1)) {
1053
         SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
1053
         SERIAL_PROTOCOLLNPGM("Invalid map type.\n");
1054
         return UBL_ERR;
1054
         return UBL_ERR;
1055
       }
1055
       }
1249
 
1249
 
1250
     int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(tmp_z_values);
1250
     int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(tmp_z_values);
1251
 
1251
 
1252
-    if (storage_slot < 0 || storage_slot > j || ubl.eeprom_start <= 0) {
1252
+    if (!WITHIN(storage_slot, 0, j - 1) || ubl.eeprom_start <= 0) {
1253
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
1253
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
1254
       return;
1254
       return;
1255
     }
1255
     }
1296
           // Prune them from the list and ignore them till the next Phase (manual nozzle probing).
1296
           // Prune them from the list and ignore them till the next Phase (manual nozzle probing).
1297
 
1297
 
1298
           if (probe_as_reference &&
1298
           if (probe_as_reference &&
1299
-            (rawx < (MIN_PROBE_X) || rawx > (MAX_PROBE_X) || rawy < (MIN_PROBE_Y) || rawy > (MAX_PROBE_Y))
1299
+            (!WITHIN(rawx, MIN_PROBE_X, MAX_PROBE_X) || !WITHIN(rawy, MIN_PROBE_Y, MAX_PROBE_Y))
1300
           ) continue;
1300
           ) continue;
1301
 
1301
 
1302
           // Unreachable. Check if it's the closest location to the nozzle.
1302
           // Unreachable. Check if it's the closest location to the nozzle.
1360
                   rawy = ubl.mesh_index_to_ypos[location.y_index];
1360
                   rawy = ubl.mesh_index_to_ypos[location.y_index];
1361
 
1361
 
1362
       // TODO: Change to use `position_is_reachable` (for SCARA-compatibility)
1362
       // TODO: Change to use `position_is_reachable` (for SCARA-compatibility)
1363
-      if (rawx < (X_MIN_POS) || rawx > (X_MAX_POS) || rawy < (Y_MIN_POS) || rawy > (Y_MAX_POS)) { // In theory, we don't need this check.
1363
+      if (!WITHIN(rawx, X_MIN_POS, X_MAX_POS) || !WITHIN(rawy, Y_MIN_POS, Y_MAX_POS)) { // In theory, we don't need this check.
1364
         SERIAL_ERROR_START;
1364
         SERIAL_ERROR_START;
1365
         SERIAL_ERRORLNPGM("Attempt to edit off the bed."); // This really can't happen, but do the check for now
1365
         SERIAL_ERRORLNPGM("Attempt to edit off the bed."); // This really can't happen, but do the check for now
1366
         ubl.has_control_of_lcd_panel = false;
1366
         ubl.has_control_of_lcd_panel = false;

Loading…
Cancel
Save