Improve UBL mesh report. Add M420 T, M421 N

This commit is contained in:
Scott Lahteine 2018-04-15 21:02:09 -05:00
parent 6786101c64
commit c0f6eebded
3 changed files with 87 additions and 66 deletions

View file

@ -9912,6 +9912,7 @@ void quickstop_stepper() {
* With AUTO_BED_LEVELING_UBL only:
*
* L[index] Load UBL mesh from index (0 is default)
* T[map] 0:Human-readable 1:CSV 2:"LCD" 4:Compact
*/
inline void gcode_M420() {
@ -9950,7 +9951,7 @@ void quickstop_stepper() {
// L to load a mesh from the EEPROM
if (parser.seen('L') || parser.seen('V')) {
ubl.display_map(0); // Currently only supports one map type
ubl.display_map(parser.byteval('T')); // 0=
SERIAL_ECHOLNPAIR("ubl.mesh_is_valid = ", ubl.mesh_is_valid());
SERIAL_ECHOLNPAIR("ubl.storage_slot = ", ubl.storage_slot);
}
@ -10081,6 +10082,7 @@ void quickstop_stepper() {
* Usage:
* M421 I<xindex> J<yindex> Z<linear>
* M421 I<xindex> J<yindex> Q<offset>
* M421 I<xindex> J<yindex> N
* M421 C Z<linear>
* M421 C Q<offset>
*/
@ -10089,6 +10091,7 @@ void quickstop_stepper() {
const bool hasI = ix >= 0,
hasJ = iy >= 0,
hasC = parser.seen('C'),
hasN = parser.seen('N'),
hasZ = parser.seen('Z'),
hasQ = !hasZ && parser.seen('Q');
@ -10098,7 +10101,7 @@ void quickstop_stepper() {
iy = location.y_index;
}
if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ)) {
if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN)) {
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
@ -10107,7 +10110,7 @@ void quickstop_stepper() {
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
else
ubl.z_values[ix][iy] = parser.value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0);
ubl.z_values[ix][iy] = hasN ? NAN : parser.value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0);
}
#endif // AUTO_BED_LEVELING_UBL