Set and check main parameter values, report all errors
This commit is contained in:
parent
34d3ed9ab1
commit
3729510b1e
@ -1001,47 +1001,45 @@
|
|||||||
lcd_quick_feedback();
|
lcd_quick_feedback();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
x_pos = current_position[X_AXIS];
|
x_flag = code_seen('X') && code_has_value();
|
||||||
y_pos = current_position[Y_AXIS];
|
y_flag = code_seen('Y') && code_has_value();
|
||||||
x_flag = 0;
|
x_pos = x_flag ? code_value_float() : current_position[X_AXIS];
|
||||||
y_flag = 0;
|
y_pos = y_flag ? code_value_float() : current_position[Y_AXIS];
|
||||||
repeat_flag = 0;
|
repeat_flag = code_seen('R') ? code_value_bool() : false;
|
||||||
|
|
||||||
|
bool err_flag = false;
|
||||||
|
|
||||||
g29_verbose_level = code_seen('V') ? code_value_int() : 0;
|
g29_verbose_level = code_seen('V') ? code_value_int() : 0;
|
||||||
if (!WITHIN(g29_verbose_level, 0, 4)) {
|
if (!WITHIN(g29_verbose_level, 0, 4)) {
|
||||||
SERIAL_PROTOCOLLNPGM("Invalid Verbose Level specified. (0-4)\n");
|
SERIAL_PROTOCOLLNPGM("Invalid Verbose Level specified. (0-4)\n");
|
||||||
return UBL_ERR;
|
err_flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code_seen('G')) {
|
if (code_seen('G')) {
|
||||||
grid_size_G = 3;
|
grid_size_G = code_has_value() ? code_value_int() : 3;
|
||||||
if (code_has_value())
|
|
||||||
grid_size_G = code_value_int();
|
|
||||||
if (!WITHIN(grid_size_G, 2, 10)) {
|
if (!WITHIN(grid_size_G, 2, 10)) {
|
||||||
SERIAL_PROTOCOLLNPGM("Invalid grid probe points specified.\n");
|
SERIAL_PROTOCOLLNPGM("Invalid grid probe points specified.\n");
|
||||||
return UBL_ERR;
|
err_flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x_flag = code_seen('X') && code_has_value();
|
|
||||||
x_pos = x_flag ? code_value_float() : current_position[X_AXIS];
|
|
||||||
if (!WITHIN(RAW_X_POSITION(x_pos), X_MIN_POS, X_MAX_POS)) {
|
|
||||||
SERIAL_PROTOCOLLNPGM("Invalid X location specified.\n");
|
|
||||||
return UBL_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
y_flag = code_seen('Y') && code_has_value();
|
|
||||||
y_pos = y_flag ? code_value_float() : current_position[Y_AXIS];
|
|
||||||
if (!WITHIN(RAW_Y_POSITION(y_pos), Y_MIN_POS, Y_MAX_POS)) {
|
|
||||||
SERIAL_PROTOCOLLNPGM("Invalid Y location specified.\n");
|
|
||||||
return UBL_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x_flag != y_flag) {
|
if (x_flag != y_flag) {
|
||||||
SERIAL_PROTOCOLLNPGM("Both X & Y locations must be specified.\n");
|
SERIAL_PROTOCOLLNPGM("Both X & Y locations must be specified.\n");
|
||||||
return UBL_ERR;
|
err_flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WITHIN(RAW_X_POSITION(x_pos), X_MIN_POS, X_MAX_POS)) {
|
||||||
|
SERIAL_PROTOCOLLNPGM("Invalid X location specified.\n");
|
||||||
|
err_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WITHIN(RAW_Y_POSITION(y_pos), Y_MIN_POS, Y_MAX_POS)) {
|
||||||
|
SERIAL_PROTOCOLLNPGM("Invalid Y location specified.\n");
|
||||||
|
err_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err_flag) return UBL_ERR;
|
||||||
|
|
||||||
if (code_seen('A')) { // Activate the Unified Bed Leveling System
|
if (code_seen('A')) { // Activate the Unified Bed Leveling System
|
||||||
ubl.state.active = 1;
|
ubl.state.active = 1;
|
||||||
SERIAL_PROTOCOLLNPGM("Unified Bed Leveling System activated.\n");
|
SERIAL_PROTOCOLLNPGM("Unified Bed Leveling System activated.\n");
|
||||||
@ -1069,7 +1067,6 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
repeat_flag = code_seen('R');
|
|
||||||
repetition_cnt = repeat_flag ? (code_has_value() ? code_value_int() : 9999) : 1;
|
repetition_cnt = repeat_flag ? (code_has_value() ? code_value_int() : 9999) : 1;
|
||||||
if (repetition_cnt < 1) {
|
if (repetition_cnt < 1) {
|
||||||
SERIAL_PROTOCOLLNPGM("Invalid Repetition count.\n");
|
SERIAL_PROTOCOLLNPGM("Invalid Repetition count.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user