Merge pull request #7260 from thinkyhead/bf_G33_update_27

Updates to G33 and its LCD code
2.0.x
Scott Lahteine 7 years ago committed by GitHub
commit 1066b17457

@ -5168,11 +5168,28 @@ void home_all_axes() { gcode_G28(true); }
SERIAL_PROTOCOL_F(f, 2);
}
inline void print_G33_settings(const bool end_stops, const bool tower_angles){ // TODO echo these to LCD ???
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
if (end_stops) {
print_signed_float(PSTR(" Ex"), endstop_adj[A_AXIS]);
print_signed_float(PSTR("Ey"), endstop_adj[B_AXIS]);
print_signed_float(PSTR("Ez"), endstop_adj[C_AXIS]);
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
}
SERIAL_EOL();
if (tower_angles) {
SERIAL_PROTOCOLPGM(".Tower angle : ");
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
SERIAL_PROTOCOLLNPGM(" Tz:+0.00");
}
}
inline void gcode_G33() {
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
if (!WITHIN(probe_points, 1, 7)) {
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (1 to 7).");
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (1-7).");
return;
}
@ -5256,26 +5273,13 @@ void home_all_axes() { gcode_G28(true); }
// print settings
SERIAL_PROTOCOLPGM("Checking... AC");
const char *checkingac = PSTR("Checking... AC"); // TODO: Make translatable string
serialprintPGM(checkingac);
if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
SERIAL_EOL();
LCD_MESSAGEPGM("Checking... AC"); // TODO: Make translatable string
lcd_setstatusPGM(checkingac);
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
if (!_1p_calibration) {
print_signed_float(PSTR(" Ex"), endstop_adj[A_AXIS]);
print_signed_float(PSTR("Ey"), endstop_adj[B_AXIS]);
print_signed_float(PSTR("Ez"), endstop_adj[C_AXIS]);
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
}
SERIAL_EOL();
if (_7p_calibration && towers_set) {
SERIAL_PROTOCOLPGM(".Tower angle : ");
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
SERIAL_PROTOCOLPGM(" Tz:+0.00");
SERIAL_EOL();
}
print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
#if DISABLED(PROBE_MANUALLY)
home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
@ -5345,7 +5349,6 @@ void home_all_axes() { gcode_G28(true); }
N++;
}
zero_std_dev_old = zero_std_dev;
NOMORE(zero_std_dev_min, zero_std_dev);
zero_std_dev = round(sqrt(S2 / N) * 1000.0) / 1000.0 + 0.00001;
// Solve matrices
@ -5436,8 +5439,9 @@ void home_all_axes() { gcode_G28(true); }
recalc_delta_settings(delta_radius, delta_diagonal_rod);
}
NOMORE(zero_std_dev_min, zero_std_dev);
// print report
// print report
if (verbose_level != 1) {
SERIAL_PROTOCOLPGM(". ");
@ -5470,47 +5474,51 @@ void home_all_axes() { gcode_G28(true); }
#endif
{
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev, 3);
SERIAL_PROTOCOL_F(zero_std_dev_min, 3);
}
SERIAL_EOL();
LCD_MESSAGEPGM("Calibration OK"); // TODO: Make translatable string
char mess[21];
sprintf_P(mess, PSTR("Calibration sd:"));
if (zero_std_dev_min < 1)
sprintf_P(&mess[15], PSTR("0.%03i"), (int)round(zero_std_dev_min * 1000.0));
else
sprintf_P(&mess[15], PSTR("%03i.x"), (int)round(zero_std_dev_min));
lcd_setstatus(mess);
print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
serialprintPGM(save_message);
SERIAL_EOL();
}
else { // !end iterations
char mess[15] = "No convergence";
char mess[15];
if (iterations < 31)
sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations);
else
sprintf_P(mess, PSTR("No convergence"));
SERIAL_PROTOCOL(mess);
SERIAL_PROTOCOL_SP(36);
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev, 3);
SERIAL_EOL();
lcd_setstatus(mess);
print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
}
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
if (!_1p_calibration) {
print_signed_float(PSTR(" Ex"), endstop_adj[A_AXIS]);
print_signed_float(PSTR("Ey"), endstop_adj[B_AXIS]);
print_signed_float(PSTR("Ez"), endstop_adj[C_AXIS]);
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
}
SERIAL_EOL();
if (_7p_calibration && towers_set) {
SERIAL_PROTOCOLPGM(".Tower angle : ");
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
SERIAL_PROTOCOLPGM(" Tz:+0.00");
SERIAL_EOL();
}
if ((zero_std_dev >= test_precision || zero_std_dev <= calibration_precision) && iterations > force_iterations)
serialprintPGM(save_message);
SERIAL_EOL();
}
else { // dry run
SERIAL_PROTOCOLPGM("End DRY-RUN");
const char *enddryrun = PSTR("End DRY-RUN");
serialprintPGM(enddryrun);
SERIAL_PROTOCOL_SP(39);
SERIAL_PROTOCOLPGM("std dev:");
SERIAL_PROTOCOL_F(zero_std_dev, 3);
SERIAL_EOL();
char mess[21];
sprintf_P(mess, enddryrun);
sprintf_P(&mess[11], PSTR(" sd:"));
if (zero_std_dev < 1)
sprintf_P(&mess[15], PSTR("0.%03i"), (int)round(zero_std_dev * 1000.0));
else
sprintf_P(&mess[15], PSTR("%03i.x"), (int)round(zero_std_dev));
lcd_setstatus(mess);
}
endstops.enable(true);

@ -482,6 +482,8 @@
#if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU)
// Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS*0.869 for non-eccentric probes
#define DELTA_CALIBRATION_RADIUS 73.5 // mm
// Set the steprate for papertest probing
#define PROBE_MANUALLY_STEP 0.025
#endif
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).

@ -482,6 +482,8 @@
#if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU)
// Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS*0.869 for non-eccentric probes
#define DELTA_CALIBRATION_RADIUS 73.5 // mm
// Set the steprate for papertest probing
#define PROBE_MANUALLY_STEP 0.025
#endif
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).

@ -472,6 +472,8 @@
#if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU)
// Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS*0.869 for non-eccentric probes
#define DELTA_CALIBRATION_RADIUS 121.5 // mm
// Set the steprate for papertest probing
#define PROBE_MANUALLY_STEP 0.025
#endif
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).

@ -472,6 +472,8 @@
#if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU)
// Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS*0.869 for non-eccentric probes
#define DELTA_CALIBRATION_RADIUS 78.0 // mm
// Set the steprate for papertest probing
#define PROBE_MANUALLY_STEP 0.025
#endif
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).

@ -458,6 +458,8 @@
#if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU)
// Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS*0.869 for non-eccentric probes
#define DELTA_CALIBRATION_RADIUS 110.0 // mm
// Set the steprate for papertest probing
#define PROBE_MANUALLY_STEP 0.025
#endif
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).

@ -476,6 +476,8 @@
#if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU)
// Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS*0.869 for non-eccentric probes
#define DELTA_CALIBRATION_RADIUS 121.5 // mm
// Set the steprate for papertest probing
#define PROBE_MANUALLY_STEP 0.025
#endif
// Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).

@ -716,6 +716,9 @@
#ifndef MSG_DELTA_CALIBRATE_CENTER
#define MSG_DELTA_CALIBRATE_CENTER _UxGT("Calibrate Center")
#endif
#ifndef MSG_DELTA_SETTINGS
#define MSG_DELTA_SETTINGS _UxGT("Show Delta Settings")
#endif
#ifndef MSG_DELTA_AUTO_CALIBRATE
#define MSG_DELTA_AUTO_CALIBRATE _UxGT("Auto Calibration")
#endif

@ -2505,16 +2505,19 @@ void kill_screen(const char* lcd_msg) {
line_to_z(z_dest);
lcd_synchronize();
move_menu_scale = 0.1;
move_menu_scale = PROBE_MANUALLY_STEP;
lcd_goto_screen(lcd_move_z);
}
float lcd_probe_pt(const float &lx, const float &ly) {
_man_probe_pt(lx, ly);
KEEPALIVE_STATE(PAUSED_FOR_USER);
defer_return_to_status = true;
wait_for_user = true;
while (wait_for_user) idle();
KEEPALIVE_STATE(IN_HANDLER);
defer_return_to_status = false;
lcd_goto_previous_menu();
return current_position[Z_AXIS];
}
@ -2523,12 +2526,32 @@ void kill_screen(const char* lcd_msg) {
void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); }
void _goto_center() { _man_probe_pt(0,0); }
void lcd_delta_G33_settings() {
START_MENU();
MENU_BACK(MSG_DELTA_CALIBRATE);
float delta_height = DELTA_HEIGHT + home_offset[Z_AXIS], Tz = 0.00;
MENU_ITEM_EDIT(float52, "Height", &delta_height, delta_height, delta_height);
MENU_ITEM_EDIT(float43, "Ex", &endstop_adj[A_AXIS], -5.0, 5.0);
MENU_ITEM_EDIT(float43, "Ey", &endstop_adj[B_AXIS], -5.0, 5.0);
MENU_ITEM_EDIT(float43, "Ez", &endstop_adj[C_AXIS], -5.0, 5.0);
MENU_ITEM_EDIT(float52, "Radius", &delta_radius, DELTA_RADIUS - 5.0, DELTA_RADIUS + 5.0);
MENU_ITEM_EDIT(float43, "Tx", &delta_tower_angle_trim[A_AXIS], -5.0, 5.0);
MENU_ITEM_EDIT(float43, "Ty", &delta_tower_angle_trim[B_AXIS], -5.0, 5.0);
MENU_ITEM_EDIT(float43, "Tz", &Tz, -5.0, 5.0);
END_MENU();
}
void lcd_delta_calibrate_menu() {
START_MENU();
MENU_BACK(MSG_MAIN);
#if ENABLED(DELTA_AUTO_CALIBRATION)
MENU_ITEM(submenu, MSG_DELTA_SETTINGS, lcd_delta_G33_settings);
MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33"));
MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 P1"));
#if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);
#endif
#endif
MENU_ITEM(submenu, MSG_AUTO_HOME, _lcd_delta_calibrate_home);
if (axis_homed[Z_AXIS]) {
@ -2617,7 +2640,8 @@ void kill_screen(const char* lcd_msg) {
encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr41sign(current_position[axis]));
if (lcdDrawUpdate)
lcd_implementation_drawedit(name, move_menu_scale >= 0.1 ? ftostr41sign(current_position[axis]) : ftostr43sign(current_position[axis]));
}
void lcd_move_x() { _lcd_move_xyz(PSTR(MSG_MOVE_X), X_AXIS); }
void lcd_move_y() { _lcd_move_xyz(PSTR(MSG_MOVE_Y), Y_AXIS); }

@ -47,7 +47,7 @@ void safe_delay(millis_t ms);
char* ftostr12ns(const float &x);
// Convert signed float to fixed-length string with 023.45 / -23.45 format
char *ftostr32(const float &x);
char* ftostr32(const float &x);
// Convert float to fixed-length string with +123.4 / -123.4 format
char* ftostr41sign(const float &x);

Loading…
Cancel
Save