|
@@ -1669,10 +1669,10 @@ void process_commands()
|
1669
|
1669
|
// Let's see if X and Y are homed and probe is inside bed area.
|
1670
|
1670
|
if(code_seen(axis_codes[Z_AXIS])) {
|
1671
|
1671
|
if ( (axis_known_position[X_AXIS]) && (axis_known_position[Y_AXIS]) \
|
1672
|
|
- && (current_position[X_AXIS]+X_PROBE_OFFSET_FROM_EXTRUDER >= X_MIN_POS) \
|
1673
|
|
- && (current_position[X_AXIS]+X_PROBE_OFFSET_FROM_EXTRUDER <= X_MAX_POS) \
|
1674
|
|
- && (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER >= Y_MIN_POS) \
|
1675
|
|
- && (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER <= Y_MAX_POS)) {
|
|
1672
|
+ && (current_position[X_AXIS] >= X_MIN_POS - X_PROBE_OFFSET_FROM_EXTRUDER) \
|
|
1673
|
+ && (current_position[X_AXIS] <= X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER) \
|
|
1674
|
+ && (current_position[Y_AXIS] >= Y_MIN_POS - Y_PROBE_OFFSET_FROM_EXTRUDER) \
|
|
1675
|
+ && (current_position[Y_AXIS] <= Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER)) {
|
1676
|
1676
|
|
1677
|
1677
|
current_position[Z_AXIS] = 0;
|
1678
|
1678
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
@@ -1789,26 +1789,67 @@ void process_commands()
|
1789
|
1789
|
if (code_seen('V') || code_seen('v')) {
|
1790
|
1790
|
verbose_level = code_value();
|
1791
|
1791
|
if (verbose_level < 0 || verbose_level > 4) {
|
1792
|
|
- SERIAL_PROTOCOLPGM("?Verbose Level not plausible (0-4).\n");
|
|
1792
|
+ SERIAL_PROTOCOLPGM("?(V)erbose Level is implausible (0-4).\n");
|
1793
|
1793
|
break;
|
1794
|
1794
|
}
|
1795
|
1795
|
if (verbose_level > 0) {
|
1796
|
|
- SERIAL_PROTOCOLPGM("Enhanced G29 Auto_Bed_Leveling Code V1.25:\n");
|
1797
|
|
- SERIAL_PROTOCOLPGM("Full support at http://3dprintboard.com\n");
|
|
1796
|
+ SERIAL_PROTOCOLPGM("G29 Enhanced Auto Bed Leveling Code V1.25:\n");
|
|
1797
|
+ SERIAL_PROTOCOLPGM("Full support at: http://3dprintboard.com/forum.php\n");
|
1798
|
1798
|
if (verbose_level > 2) topo_flag = true;
|
1799
|
1799
|
}
|
1800
|
1800
|
}
|
1801
|
1801
|
|
1802
|
1802
|
int auto_bed_leveling_grid_points = code_seen('P') ? code_value_long() : AUTO_BED_LEVELING_GRID_POINTS;
|
1803
|
1803
|
if (auto_bed_leveling_grid_points < 2 || auto_bed_leveling_grid_points > AUTO_BED_LEVELING_GRID_POINTS) {
|
1804
|
|
- SERIAL_PROTOCOLPGM("?Number of probed points not plausible (2 minimum).\n");
|
|
1804
|
+ SERIAL_PROTOCOLPGM("?Number of probed (P)oints is implausible (2 minimum).\n");
|
1805
|
1805
|
break;
|
1806
|
1806
|
}
|
1807
|
1807
|
|
1808
|
|
- int left_probe_bed_position = code_seen('L') ? code_value_long() : LEFT_PROBE_BED_POSITION;
|
1809
|
|
- int right_probe_bed_position = code_seen('R') ? code_value_long() : RIGHT_PROBE_BED_POSITION;
|
1810
|
|
- int back_probe_bed_position = code_seen('B') ? code_value_long() : BACK_PROBE_BED_POSITION;
|
1811
|
|
- int front_probe_bed_position = code_seen('F') ? code_value_long() : FRONT_PROBE_BED_POSITION;
|
|
1808
|
+ // Define the possible boundaries for probing based on the set limits.
|
|
1809
|
+ // Code above (in G28) might have these limits wrong, or I am wrong here.
|
|
1810
|
+ #define MIN_PROBE_EDGE 10 // Edges of the probe square can be no less
|
|
1811
|
+ const int min_probe_x = max(X_MIN, X_MIN + X_PROBE_OFFSET_FROM_EXTRUDER),
|
|
1812
|
+ max_probe_x = min(X_MAX, X_MAX + X_PROBE_OFFSET_FROM_EXTRUDER);
|
|
1813
|
+ min_probe_y = max(Y_MIN, Y_MIN + Y_PROBE_OFFSET_FROM_EXTRUDER);
|
|
1814
|
+ max_probe_y = min(Y_MAX, Y_MAX + Y_PROBE_OFFSET_FROM_EXTRUDER);
|
|
1815
|
+
|
|
1816
|
+ int left_probe_bed_position = code_seen('L') ? code_value_long() : LEFT_PROBE_BED_POSITION,
|
|
1817
|
+ right_probe_bed_position = code_seen('R') ? code_value_long() : RIGHT_PROBE_BED_POSITION,
|
|
1818
|
+ front_probe_bed_position = code_seen('F') ? code_value_long() : FRONT_PROBE_BED_POSITION,
|
|
1819
|
+ back_probe_bed_position = code_seen('B') ? code_value_long() : BACK_PROBE_BED_POSITION;
|
|
1820
|
+
|
|
1821
|
+ bool left_out_l = left_probe_bed_position < min_probe_x,
|
|
1822
|
+ left_out_r = left_probe_bed_position > right_probe_bed_position - MIN_PROBE_EDGE,
|
|
1823
|
+ left_out = left_out_l || left_out_r,
|
|
1824
|
+ right_out_r = right_probe_bed_position > max_probe_x,
|
|
1825
|
+ right_out_l =right_probe_bed_position < left_probe_bed_position + MIN_PROBE_EDGE,
|
|
1826
|
+ right_out = right_out_l || right_out_r,
|
|
1827
|
+ front_out_f = front_probe_bed_position < min_probe_y,
|
|
1828
|
+ front_out_b = front_probe_bed_position > back_probe_bed_position - MIN_PROBE_EDGE,
|
|
1829
|
+ front_out = front_out_f || front_out_b,
|
|
1830
|
+ back_out_b = back_probe_bed_position > max_probe_y,
|
|
1831
|
+ back_out_f = back_probe_bed_position < front_probe_bed_position + MIN_PROBE_EDGE,
|
|
1832
|
+ back_out = back_out_f || back_out_b;
|
|
1833
|
+
|
|
1834
|
+ if (left_out || right_out || front_out || back_out) {
|
|
1835
|
+ if (left_out) {
|
|
1836
|
+ SERIAL_PROTOCOLPGM("?Probe (L)eft position out of range.\n");
|
|
1837
|
+ left_probe_bed_position = left_out_l ? min_probe_x : right_probe_bed_position - MIN_PROBE_EDGE;
|
|
1838
|
+ }
|
|
1839
|
+ if (right_out) {
|
|
1840
|
+ SERIAL_PROTOCOLPGM("?Probe (R)ight position out of range.\n");
|
|
1841
|
+ right_probe_bed_position = right_out_r ? max_probe_x : left_probe_bed_position + MIN_PROBE_EDGE;
|
|
1842
|
+ }
|
|
1843
|
+ if (front_out) {
|
|
1844
|
+ SERIAL_PROTOCOLPGM("?Probe (F)ront position out of range.\n");
|
|
1845
|
+ front_probe_bed_position = front_out_f ? min_probe_y : back_probe_bed_position - MIN_PROBE_EDGE;
|
|
1846
|
+ }
|
|
1847
|
+ if (back_out) {
|
|
1848
|
+ SERIAL_PROTOCOLPGM("?Probe (B)ack position out of range.\n");
|
|
1849
|
+ back_probe_bed_position = back_out_b ? max_probe_y : front_probe_bed_position + MIN_PROBE_EDGE;
|
|
1850
|
+ }
|
|
1851
|
+ break;
|
|
1852
|
+ }
|
1812
|
1853
|
|
1813
|
1854
|
#endif
|
1814
|
1855
|
|