|
@@ -299,11 +299,13 @@
|
299
|
299
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
300
|
300
|
#include "UBL.h"
|
301
|
301
|
unified_bed_leveling ubl;
|
302
|
|
-#define UBL_MESH_VALID !( z_values[0][0] == z_values[0][1] && z_values[0][1] == z_values[0][2] \
|
303
|
|
- && z_values[1][0] == z_values[1][1] && z_values[1][1] == z_values[1][2] \
|
304
|
|
- && z_values[2][0] == z_values[2][1] && z_values[2][1] == z_values[2][2] \
|
305
|
|
- && z_values[0][0] == 0 && z_values[1][0] == 0 && z_values[2][0] == 0 \
|
306
|
|
- || isnan(z_values[0][0]))
|
|
302
|
+ #define UBL_MESH_VALID !( ( z_values[0][0] == z_values[0][1] && z_values[0][1] == z_values[0][2] \
|
|
303
|
+ && z_values[1][0] == z_values[1][1] && z_values[1][1] == z_values[1][2] \
|
|
304
|
+ && z_values[2][0] == z_values[2][1] && z_values[2][1] == z_values[2][2] \
|
|
305
|
+ && z_values[0][0] == 0 && z_values[1][0] == 0 && z_values[2][0] == 0 ) \
|
|
306
|
+ || isnan(z_values[0][0]))
|
|
307
|
+ extern bool g26_debug_flag;
|
|
308
|
+ extern int ubl_eeprom_start;
|
307
|
309
|
#endif
|
308
|
310
|
|
309
|
311
|
bool Running = true;
|
|
@@ -7213,10 +7215,54 @@ void quickstop_stepper() {
|
7213
|
7215
|
* S[bool] Turns leveling on or off
|
7214
|
7216
|
* Z[height] Sets the Z fade height (0 or none to disable)
|
7215
|
7217
|
* V[bool] Verbose - Print the leveling grid
|
|
7218
|
+ *
|
|
7219
|
+ * L[index] Load UBL mesh from index (0 is default)
|
7216
|
7220
|
*/
|
7217
|
7221
|
inline void gcode_M420() {
|
7218
|
|
- bool to_enable = false;
|
7219
|
7222
|
|
|
7223
|
+ #if ENABLED(AUTO_BED_LEVELING_UBL)
|
|
7224
|
+ // L to load a mesh from the EEPROM
|
|
7225
|
+ if (code_seen('L')) {
|
|
7226
|
+ const int8_t storage_slot = code_has_value() ? code_value_int() : ubl.state.eeprom_storage_slot;
|
|
7227
|
+ const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(z_values);
|
|
7228
|
+ if (storage_slot < 0 || storage_slot >= j || ubl.eeprom_start <= 0) {
|
|
7229
|
+ SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
|
|
7230
|
+ return;
|
|
7231
|
+ }
|
|
7232
|
+ ubl.load_mesh(Storage_Slot);
|
|
7233
|
+ ubl.state.eeprom_storage_slot = Storage_Slot;
|
|
7234
|
+ if (Storage_Slot != ubl.state.eeprom_storage_slot)
|
|
7235
|
+ ubl.store_state();
|
|
7236
|
+ ubl.display_map(0); // Right now, we only support one type of map
|
|
7237
|
+ SERIAL_ECHOLNPAIR("UBL_MESH_VALID = ", UBL_MESH_VALID);
|
|
7238
|
+ SERIAL_ECHOLNPAIR("eeprom_storage_slot = ", ubl.state.eeprom_storage_slot);
|
|
7239
|
+ }
|
|
7240
|
+ #endif // AUTO_BED_LEVELING_UBL
|
|
7241
|
+
|
|
7242
|
+ // V to print the matrix or mesh
|
|
7243
|
+ if (code_seen('V')) {
|
|
7244
|
+ #if ABL_PLANAR
|
|
7245
|
+ planner.bed_level_matrix.debug("Bed Level Correction Matrix:");
|
|
7246
|
+ #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
7247
|
+ if (bilinear_grid_spacing[X_AXIS]) {
|
|
7248
|
+ print_bilinear_leveling_grid();
|
|
7249
|
+ #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
|
7250
|
+ bed_level_virt_print();
|
|
7251
|
+ #endif
|
|
7252
|
+ }
|
|
7253
|
+ #elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
7254
|
+ ubl.display_map(0); // Currently only supports one map type
|
|
7255
|
+ SERIAL_ECHOLNPAIR("UBL_MESH_VALID = ", UBL_MESH_VALID);
|
|
7256
|
+ SERIAL_ECHOLNPAIR("eeprom_storage_slot = ", ubl.state.eeprom_storage_slot);
|
|
7257
|
+ #elif ENABLED(MESH_BED_LEVELING)
|
|
7258
|
+ if (mbl.has_mesh()) {
|
|
7259
|
+ SERIAL_ECHOLNPGM("Mesh Bed Level data:");
|
|
7260
|
+ mbl_mesh_report();
|
|
7261
|
+ }
|
|
7262
|
+ #endif
|
|
7263
|
+ }
|
|
7264
|
+
|
|
7265
|
+ bool to_enable = false;
|
7220
|
7266
|
if (code_seen('S')) {
|
7221
|
7267
|
to_enable = code_value_bool();
|
7222
|
7268
|
set_bed_leveling_enabled(to_enable);
|
|
@@ -7243,28 +7289,6 @@ void quickstop_stepper() {
|
7243
|
7289
|
|
7244
|
7290
|
SERIAL_ECHO_START;
|
7245
|
7291
|
SERIAL_ECHOLNPAIR("Bed Leveling ", new_status ? MSG_ON : MSG_OFF);
|
7246
|
|
-
|
7247
|
|
- // V to print the matrix or mesh
|
7248
|
|
- if (code_seen('V')) {
|
7249
|
|
- #if ABL_PLANAR
|
7250
|
|
- planner.bed_level_matrix.debug("Bed Level Correction Matrix:");
|
7251
|
|
- #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
7252
|
|
- if (bilinear_grid_spacing[X_AXIS]) {
|
7253
|
|
- print_bilinear_leveling_grid();
|
7254
|
|
- #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
7255
|
|
- bed_level_virt_print();
|
7256
|
|
- #endif
|
7257
|
|
- }
|
7258
|
|
- #elif ENABLED(AUTO_BED_LEVELING_UBL)
|
7259
|
|
- ubl.display_map(0); // Right now, we only support one type of map
|
7260
|
|
- #elif ENABLED(MESH_BED_LEVELING)
|
7261
|
|
- if (mbl.has_mesh()) {
|
7262
|
|
- SERIAL_ECHOLNPGM("Mesh Bed Level data:");
|
7263
|
|
- mbl_mesh_report();
|
7264
|
|
- }
|
7265
|
|
- #endif
|
7266
|
|
- }
|
7267
|
|
-
|
7268
|
7292
|
}
|
7269
|
7293
|
#endif
|
7270
|
7294
|
|
|
@@ -8595,7 +8619,7 @@ void process_next_command() {
|
8595
|
8619
|
gcode_G28();
|
8596
|
8620
|
break;
|
8597
|
8621
|
|
8598
|
|
- #if PLANNER_LEVELING
|
|
8622
|
+ #if PLANNER_LEVELING && !ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_MESH_EDIT_ENABLED)
|
8599
|
8623
|
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
|
8600
|
8624
|
// or provides access to the UBL System if enabled.
|
8601
|
8625
|
gcode_G29();
|