|
|
@ -314,7 +314,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
void __attribute__((optimize("O0"))) gcode_G29() {
|
|
|
|
void __attribute__((optimize("O0"))) gcode_G29() {
|
|
|
|
|
|
|
|
|
|
|
|
if (ubl.eeprom_start < 0) {
|
|
|
|
if (!settings.calc_num_meshes()) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?You need to enable your EEPROM and initialize it");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?You need to enable your EEPROM and initialize it");
|
|
|
|
SERIAL_PROTOCOLLNPGM("with M502, M500, M501 in that order.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("with M502, M500, M501 in that order.\n");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -419,9 +419,9 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('P')) {
|
|
|
|
if (code_seen('P')) {
|
|
|
|
if (WITHIN(phase_value, 0, 1) && ubl.state.eeprom_storage_slot == -1) {
|
|
|
|
if (WITHIN(phase_value, 0, 1) && ubl.state.storage_slot == -1) {
|
|
|
|
ubl.state.eeprom_storage_slot = 0;
|
|
|
|
ubl.state.storage_slot = 0;
|
|
|
|
SERIAL_PROTOCOLLNPGM("Default storage slot 0 selected.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("Default storage slot 0 selected.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (phase_value) {
|
|
|
|
switch (phase_value) {
|
|
|
@ -430,7 +430,7 @@
|
|
|
|
// Zero Mesh Data
|
|
|
|
// Zero Mesh Data
|
|
|
|
//
|
|
|
|
//
|
|
|
|
ubl.reset();
|
|
|
|
ubl.reset();
|
|
|
|
SERIAL_PROTOCOLLNPGM("Mesh zeroed.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("Mesh zeroed.");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
@ -439,7 +439,7 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
if (!code_seen('C')) {
|
|
|
|
if (!code_seen('C')) {
|
|
|
|
ubl.invalidate();
|
|
|
|
ubl.invalidate();
|
|
|
|
SERIAL_PROTOCOLLNPGM("Mesh invalidated. Probing mesh.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("Mesh invalidated. Probing mesh.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (g29_verbose_level > 1) {
|
|
|
|
if (g29_verbose_level > 1) {
|
|
|
|
SERIAL_PROTOCOLPAIR("Probing Mesh Points Closest to (", x_pos);
|
|
|
|
SERIAL_PROTOCOLPAIR("Probing Mesh Points Closest to (", x_pos);
|
|
|
@ -455,7 +455,7 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Manually Probe Mesh in areas that can't be reached by the probe
|
|
|
|
// Manually Probe Mesh in areas that can't be reached by the probe
|
|
|
|
//
|
|
|
|
//
|
|
|
|
SERIAL_PROTOCOLLNPGM("Manually probing unreachable mesh locations.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("Manually probing unreachable mesh locations.");
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
|
|
if (!x_flag && !y_flag) {
|
|
|
|
if (!x_flag && !y_flag) {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -485,7 +485,7 @@
|
|
|
|
card_thickness = code_has_value() ? code_value_float() : measure_business_card_thickness(height);
|
|
|
|
card_thickness = code_has_value() ? code_value_float() : measure_business_card_thickness(height);
|
|
|
|
|
|
|
|
|
|
|
|
if (fabs(card_thickness) > 1.5) {
|
|
|
|
if (fabs(card_thickness) > 1.5) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Error in Business Card measurement.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Error in Business Card measurement.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -561,17 +561,25 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('L')) { // Load Current Mesh Data
|
|
|
|
if (code_seen('L')) { // Load Current Mesh Data
|
|
|
|
storage_slot = code_has_value() ? code_value_int() : ubl.state.eeprom_storage_slot;
|
|
|
|
storage_slot = code_has_value() ? code_value_int() : ubl.state.storage_slot;
|
|
|
|
|
|
|
|
|
|
|
|
const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
|
|
|
|
int16_t a = settings.calc_num_meshes();
|
|
|
|
|
|
|
|
|
|
|
|
if (!WITHIN(storage_slot, 0, j - 1) || ubl.eeprom_start <= 0) {
|
|
|
|
if (!a) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ubl.load_mesh(storage_slot);
|
|
|
|
|
|
|
|
ubl.state.eeprom_storage_slot = storage_slot;
|
|
|
|
if (!WITHIN(storage_slot, 0, a - 1)) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("Done.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings.load_mesh(storage_slot);
|
|
|
|
|
|
|
|
ubl.state.storage_slot = storage_slot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Done.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -579,7 +587,7 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('S')) { // Store (or Save) Current Mesh Data
|
|
|
|
if (code_seen('S')) { // Store (or Save) Current Mesh Data
|
|
|
|
storage_slot = code_has_value() ? code_value_int() : ubl.state.eeprom_storage_slot;
|
|
|
|
storage_slot = code_has_value() ? code_value_int() : ubl.state.storage_slot;
|
|
|
|
|
|
|
|
|
|
|
|
if (storage_slot == -1) { // Special case, we are going to 'Export' the mesh to the
|
|
|
|
if (storage_slot == -1) { // Special case, we are going to 'Export' the mesh to the
|
|
|
|
SERIAL_ECHOLNPGM("G29 I 999"); // host in a form it can be reconstructed on a different machine
|
|
|
|
SERIAL_ECHOLNPGM("G29 I 999"); // host in a form it can be reconstructed on a different machine
|
|
|
@ -597,17 +605,23 @@
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
|
|
|
|
int16_t a = settings.calc_num_meshes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!a) {
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
|
|
|
|
|
|
|
|
goto LEAVE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!WITHIN(storage_slot, 0, j - 1) || ubl.eeprom_start <= 0) {
|
|
|
|
if (!WITHIN(storage_slot, 0, a - 1)) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
|
|
|
|
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", j - 1);
|
|
|
|
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
|
|
|
|
goto LEAVE;
|
|
|
|
goto LEAVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ubl.store_mesh(storage_slot);
|
|
|
|
|
|
|
|
ubl.state.eeprom_storage_slot = storage_slot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Done.\n");
|
|
|
|
settings.store_mesh(storage_slot);
|
|
|
|
|
|
|
|
ubl.state.storage_slot = storage_slot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Done.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('T'))
|
|
|
|
if (code_seen('T'))
|
|
|
@ -654,7 +668,7 @@
|
|
|
|
if (ELAPSED(millis(), nxt)) {
|
|
|
|
if (ELAPSED(millis(), nxt)) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("\nZ-Offset Adjustment Stopped.");
|
|
|
|
SERIAL_PROTOCOLLNPGM("\nZ-Offset Adjustment Stopped.");
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
|
|
LCD_MESSAGEPGM("Z-Offset Stopped");
|
|
|
|
LCD_MESSAGEPGM("Z-Offset Stopped"); // TODO: Make translatable string
|
|
|
|
ubl.restore_ubl_active_state_and_leave();
|
|
|
|
ubl.restore_ubl_active_state_and_leave();
|
|
|
|
goto LEAVE;
|
|
|
|
goto LEAVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -892,7 +906,7 @@
|
|
|
|
return current_position[Z_AXIS];
|
|
|
|
return current_position[Z_AXIS];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void say_and_take_a_measurement() {
|
|
|
|
static void echo_and_take_a_measurement() {
|
|
|
|
SERIAL_PROTOCOLLNPGM(" and take a measurement.");
|
|
|
|
SERIAL_PROTOCOLLNPGM(" and take a measurement.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -906,17 +920,17 @@
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Place shim under nozzle");
|
|
|
|
SERIAL_PROTOCOLPGM("Place shim under nozzle");
|
|
|
|
LCD_MESSAGEPGM("Place shim & measure");
|
|
|
|
LCD_MESSAGEPGM("Place shim & measure"); // TODO: Make translatable string
|
|
|
|
lcd_goto_screen(lcd_status_screen);
|
|
|
|
lcd_goto_screen(lcd_status_screen);
|
|
|
|
say_and_take_a_measurement();
|
|
|
|
echo_and_take_a_measurement();
|
|
|
|
|
|
|
|
|
|
|
|
const float z1 = use_encoder_wheel_to_measure_point();
|
|
|
|
const float z1 = use_encoder_wheel_to_measure_point();
|
|
|
|
do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
|
|
|
|
do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Remove shim");
|
|
|
|
SERIAL_PROTOCOLPGM("Remove shim");
|
|
|
|
LCD_MESSAGEPGM("Remove & measure bed");
|
|
|
|
LCD_MESSAGEPGM("Remove & measure bed"); // TODO: Make translatable string
|
|
|
|
say_and_take_a_measurement();
|
|
|
|
echo_and_take_a_measurement();
|
|
|
|
|
|
|
|
|
|
|
|
const float z2 = use_encoder_wheel_to_measure_point();
|
|
|
|
const float z2 = use_encoder_wheel_to_measure_point();
|
|
|
|
|
|
|
|
|
|
|
@ -962,7 +976,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
|
|
|
|
|
|
|
|
|
|
|
|
LCD_MESSAGEPGM("Moving to next");
|
|
|
|
LCD_MESSAGEPGM("Moving to next"); // TODO: Make translatable string
|
|
|
|
|
|
|
|
|
|
|
|
do_blocking_move_to_xy(xProbe, yProbe);
|
|
|
|
do_blocking_move_to_xy(xProbe, yProbe);
|
|
|
|
do_blocking_move_to_z(z_clearance);
|
|
|
|
do_blocking_move_to_z(z_clearance);
|
|
|
@ -972,8 +986,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
if (do_ubl_mesh_map) ubl.display_map(map_type); // show user where we're probing
|
|
|
|
if (do_ubl_mesh_map) ubl.display_map(map_type); // show user where we're probing
|
|
|
|
|
|
|
|
|
|
|
|
if (code_seen('B')) {LCD_MESSAGEPGM("Place shim & measure");}
|
|
|
|
if (code_seen('B'))
|
|
|
|
else {LCD_MESSAGEPGM("Measure");}
|
|
|
|
LCD_MESSAGEPGM("Place shim & measure"); // TODO: Make translatable string
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
LCD_MESSAGEPGM("Measure"); // TODO: Make translatable string
|
|
|
|
|
|
|
|
|
|
|
|
while (ubl_lcd_clicked()) delay(50); // wait for user to release encoder wheel
|
|
|
|
while (ubl_lcd_clicked()) delay(50); // wait for user to release encoder wheel
|
|
|
|
delay(50); // debounce
|
|
|
|
delay(50); // debounce
|
|
|
@ -1017,21 +1033,10 @@
|
|
|
|
do_blocking_move_to_xy(lx, ly);
|
|
|
|
do_blocking_move_to_xy(lx, ly);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void say_ubl_name() {
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Unified Bed Leveling ");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void report_ubl_state() {
|
|
|
|
|
|
|
|
say_ubl_name();
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("System ");
|
|
|
|
|
|
|
|
if (!ubl.state.active) SERIAL_PROTOCOLPGM("de");
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("activated.\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool g29_parameter_parsing() {
|
|
|
|
bool g29_parameter_parsing() {
|
|
|
|
bool err_flag = false;
|
|
|
|
bool err_flag = false;
|
|
|
|
|
|
|
|
|
|
|
|
LCD_MESSAGEPGM("Doing G29 UBL!");
|
|
|
|
LCD_MESSAGEPGM("Doing G29 UBL!"); // TODO: Make translatable string
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
|
|
|
|
|
|
|
|
|
ubl_constant = 0.0;
|
|
|
|
ubl_constant = 0.0;
|
|
|
@ -1096,12 +1101,12 @@
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Can't activate and deactivate at the same time.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Can't activate and deactivate at the same time.\n");
|
|
|
|
return UBL_ERR;
|
|
|
|
return UBL_ERR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ubl.state.active = 1;
|
|
|
|
ubl.state.active = true;
|
|
|
|
report_ubl_state();
|
|
|
|
ubl.report_state();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (code_seen('D')) {
|
|
|
|
else if (code_seen('D')) {
|
|
|
|
ubl.state.active = 0;
|
|
|
|
ubl.state.active = false;
|
|
|
|
report_ubl_state();
|
|
|
|
ubl.report_state();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Set global 'C' flag and its value
|
|
|
|
// Set global 'C' flag and its value
|
|
|
@ -1134,7 +1139,7 @@
|
|
|
|
ubl_state_recursion_chk++;
|
|
|
|
ubl_state_recursion_chk++;
|
|
|
|
if (ubl_state_recursion_chk != 1) {
|
|
|
|
if (ubl_state_recursion_chk != 1) {
|
|
|
|
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
|
|
|
|
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
|
|
|
|
LCD_MESSAGEPGM("save_UBL_active() error");
|
|
|
|
LCD_MESSAGEPGM("save_UBL_active() error"); // TODO: Make translatable string
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1145,7 +1150,7 @@
|
|
|
|
void unified_bed_leveling::restore_ubl_active_state_and_leave() {
|
|
|
|
void unified_bed_leveling::restore_ubl_active_state_and_leave() {
|
|
|
|
if (--ubl_state_recursion_chk) {
|
|
|
|
if (--ubl_state_recursion_chk) {
|
|
|
|
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
|
|
|
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
|
|
|
|
LCD_MESSAGEPGM("restore_UBL_active() error");
|
|
|
|
LCD_MESSAGEPGM("restore_UBL_active() error"); // TODO: Make translatable string
|
|
|
|
lcd_quick_feedback();
|
|
|
|
lcd_quick_feedback();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1157,21 +1162,12 @@
|
|
|
|
* good to have the extra information. Soon... we prune this to just a few items
|
|
|
|
* good to have the extra information. Soon... we prune this to just a few items
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void unified_bed_leveling::g29_what_command() {
|
|
|
|
void unified_bed_leveling::g29_what_command() {
|
|
|
|
const uint16_t k = E2END - ubl.eeprom_start;
|
|
|
|
report_state();
|
|
|
|
|
|
|
|
|
|
|
|
say_ubl_name();
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("System Version " UBL_VERSION " ");
|
|
|
|
|
|
|
|
if (state.active)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLCHAR('A');
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("Ina");
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("ctive.\n");
|
|
|
|
|
|
|
|
safe_delay(50);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (state.eeprom_storage_slot == -1)
|
|
|
|
if (state.storage_slot == -1)
|
|
|
|
SERIAL_PROTOCOLPGM("No Mesh Loaded.");
|
|
|
|
SERIAL_PROTOCOLPGM("No Mesh Loaded.");
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
SERIAL_PROTOCOLPAIR("Mesh ", state.eeprom_storage_slot);
|
|
|
|
SERIAL_PROTOCOLPAIR("Mesh ", state.storage_slot);
|
|
|
|
SERIAL_PROTOCOLPGM(" Loaded.");
|
|
|
|
SERIAL_PROTOCOLPGM(" Loaded.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
@ -1188,12 +1184,15 @@
|
|
|
|
SERIAL_PROTOCOL_F(zprobe_zoffset, 7);
|
|
|
|
SERIAL_PROTOCOL_F(zprobe_zoffset, 7);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("ubl.eeprom_start=", hex_address((void*)eeprom_start));
|
|
|
|
SERIAL_ECHOLNPAIR("UBL_MESH_MIN_X " STRINGIFY(UBL_MESH_MIN_X) "=", UBL_MESH_MIN_X);
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPAIR("UBL_MESH_MIN_Y " STRINGIFY(UBL_MESH_MIN_Y) "=", UBL_MESH_MIN_Y);
|
|
|
|
|
|
|
|
safe_delay(25);
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPAIR("UBL_MESH_MAX_X " STRINGIFY(UBL_MESH_MAX_X) "=", UBL_MESH_MAX_X);
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPAIR("UBL_MESH_MAX_Y " STRINGIFY(UBL_MESH_MAX_Y) "=", UBL_MESH_MAX_Y);
|
|
|
|
|
|
|
|
safe_delay(25);
|
|
|
|
SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_X ", GRID_MAX_POINTS_X);
|
|
|
|
SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_X ", GRID_MAX_POINTS_X);
|
|
|
|
SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_Y ", GRID_MAX_POINTS_Y);
|
|
|
|
SERIAL_ECHOLNPAIR("GRID_MAX_POINTS_Y ", GRID_MAX_POINTS_Y);
|
|
|
|
safe_delay(25);
|
|
|
|
safe_delay(25);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPAIR("MESH_X_DIST ", MESH_X_DIST);
|
|
|
|
SERIAL_ECHOLNPAIR("MESH_X_DIST ", MESH_X_DIST);
|
|
|
|
SERIAL_ECHOLNPAIR("MESH_Y_DIST ", MESH_Y_DIST);
|
|
|
|
SERIAL_ECHOLNPAIR("MESH_Y_DIST ", MESH_Y_DIST);
|
|
|
|
safe_delay(25);
|
|
|
|
safe_delay(25);
|
|
|
@ -1214,43 +1213,39 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("Free EEPROM space starts at: ", hex_address((void*)eeprom_start));
|
|
|
|
#if HAS_KILL
|
|
|
|
SERIAL_PROTOCOLLNPAIR("end of EEPROM: ", hex_address((void*)E2END));
|
|
|
|
SERIAL_PROTOCOLPAIR("Kill pin on :", KILL_PIN);
|
|
|
|
safe_delay(25);
|
|
|
|
SERIAL_PROTOCOLLNPAIR(" state:", READ(KILL_PIN));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
safe_delay(50);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPAIR("sizeof(ubl.state) : ", (int)sizeof(state));
|
|
|
|
SERIAL_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values));
|
|
|
|
SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk);
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
safe_delay(25);
|
|
|
|
safe_delay(50);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)k));
|
|
|
|
|
|
|
|
safe_delay(25);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPAIR("EEPROM can hold ", k / sizeof(z_values));
|
|
|
|
SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.get_start_of_meshes()));
|
|
|
|
SERIAL_PROTOCOLLNPGM(" meshes.\n");
|
|
|
|
SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.get_end_of_meshes()));
|
|
|
|
safe_delay(25);
|
|
|
|
safe_delay(50);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPAIR("\nGRID_MAX_POINTS_X ", GRID_MAX_POINTS_X);
|
|
|
|
SERIAL_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl));
|
|
|
|
SERIAL_PROTOCOLPAIR("\nGRID_MAX_POINTS_Y ", GRID_MAX_POINTS_Y);
|
|
|
|
SERIAL_EOL;
|
|
|
|
safe_delay(25);
|
|
|
|
SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values));
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM("UBL_MESH_MIN_X " STRINGIFY(UBL_MESH_MIN_X));
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPAIR("=", UBL_MESH_MIN_X );
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM("UBL_MESH_MIN_Y " STRINGIFY(UBL_MESH_MIN_Y));
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPAIR("=", UBL_MESH_MIN_Y );
|
|
|
|
|
|
|
|
safe_delay(25);
|
|
|
|
safe_delay(25);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPGM("UBL_MESH_MAX_X " STRINGIFY(UBL_MESH_MAX_X));
|
|
|
|
SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.get_end_of_meshes() - settings.get_start_of_meshes())));
|
|
|
|
SERIAL_ECHOLNPAIR("=", UBL_MESH_MAX_X);
|
|
|
|
safe_delay(50);
|
|
|
|
SERIAL_ECHOPGM("UBL_MESH_MAX_Y " STRINGIFY(UBL_MESH_MAX_Y));
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPAIR("=", UBL_MESH_MAX_Y);
|
|
|
|
SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes());
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM(" meshes.\n");
|
|
|
|
safe_delay(25);
|
|
|
|
safe_delay(25);
|
|
|
|
|
|
|
|
|
|
|
|
if (!sanity_check()) {
|
|
|
|
if (!sanity_check()) {
|
|
|
|
say_ubl_name();
|
|
|
|
echo_name();
|
|
|
|
SERIAL_PROTOCOLLNPGM("sanity checks passed.");
|
|
|
|
SERIAL_PROTOCOLLNPGM(" sanity checks passed.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1284,27 +1279,32 @@
|
|
|
|
* use cases for the users. So we can wait and see what to do with it.
|
|
|
|
* use cases for the users. So we can wait and see what to do with it.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void g29_compare_current_mesh_to_stored_mesh() {
|
|
|
|
void g29_compare_current_mesh_to_stored_mesh() {
|
|
|
|
float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
|
|
|
|
int16_t a = settings.calc_num_meshes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!a) {
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!code_has_value()) {
|
|
|
|
if (!code_has_value()) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Mesh # required.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Storage slot # required.");
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
storage_slot = code_value_int();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(tmp_z_values);
|
|
|
|
storage_slot = code_value_int();
|
|
|
|
|
|
|
|
|
|
|
|
if (!WITHIN(storage_slot, 0, j - 1) || ubl.eeprom_start <= 0) {
|
|
|
|
if (!WITHIN(storage_slot, 0, a - 1)) {
|
|
|
|
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
|
|
|
|
SERIAL_PROTOCOLLNPGM("?Invalid storage slot.");
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
j = UBL_LAST_EEPROM_INDEX - (storage_slot + 1) * sizeof(tmp_z_values);
|
|
|
|
float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
|
|
|
|
eeprom_read_block((void *)&tmp_z_values, (void *)j, sizeof(tmp_z_values));
|
|
|
|
settings.load_mesh(storage_slot, &tmp_z_values);
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_ECHOPAIR("Subtracting Mesh ", storage_slot);
|
|
|
|
SERIAL_PROTOCOLPAIR("Subtracting mesh in slot ", storage_slot);
|
|
|
|
SERIAL_PROTOCOLLNPAIR(" loaded from EEPROM address ", hex_address((void*)j)); // Soon, we can remove the extra clutter of printing
|
|
|
|
SERIAL_PROTOCOLLNPGM(" from current mesh.");
|
|
|
|
// the address in the EEPROM where the Mesh is stored.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
|
|
|
|
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
|
|
|
|
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
|
|
|
|
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
|
|
|
@ -1396,7 +1396,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
memset(not_done, 0xFF, sizeof(not_done));
|
|
|
|
memset(not_done, 0xFF, sizeof(not_done));
|
|
|
|
|
|
|
|
|
|
|
|
LCD_MESSAGEPGM("Fine Tuning Mesh");
|
|
|
|
LCD_MESSAGEPGM("Fine Tuning Mesh"); // TODO: Make translatable string
|
|
|
|
|
|
|
|
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
|
|
do_blocking_move_to_xy(lx, ly);
|
|
|
|
do_blocking_move_to_xy(lx, ly);
|
|
|
@ -1454,7 +1454,7 @@
|
|
|
|
lcd_return_to_status();
|
|
|
|
lcd_return_to_status();
|
|
|
|
//SERIAL_PROTOCOLLNPGM("\nFine Tuning of Mesh Stopped.");
|
|
|
|
//SERIAL_PROTOCOLLNPGM("\nFine Tuning of Mesh Stopped.");
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
|
|
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
|
|
|
|
LCD_MESSAGEPGM("Mesh Editing Stopped");
|
|
|
|
LCD_MESSAGEPGM("Mesh Editing Stopped"); // TODO: Make translatable string
|
|
|
|
|
|
|
|
|
|
|
|
while (ubl_lcd_clicked()) idle();
|
|
|
|
while (ubl_lcd_clicked()) idle();
|
|
|
|
|
|
|
|
|
|
|
@ -1481,7 +1481,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
do_blocking_move_to_xy(lx, ly);
|
|
|
|
do_blocking_move_to_xy(lx, ly);
|
|
|
|
|
|
|
|
|
|
|
|
LCD_MESSAGEPGM("Done Editing Mesh");
|
|
|
|
LCD_MESSAGEPGM("Done Editing Mesh"); // TODO: Make translatable string
|
|
|
|
SERIAL_ECHOLNPGM("Done Editing Mesh");
|
|
|
|
SERIAL_ECHOLNPGM("Done Editing Mesh");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|