Allow UBL G29 and G26 to build without a probe

master
deram 7 years ago committed by Scott Lahteine
parent 73c5675485
commit 9239fcf0da

@ -96,13 +96,18 @@ script:
- opt_set_adv FANMUX0_PIN 53 - opt_set_adv FANMUX0_PIN 53
- build_marlin - build_marlin
# #
# Test a simple build of AUTO_BED_LEVELING_UBL # Test a probeless build of AUTO_BED_LEVELING_UBL
# #
- restore_configs - restore_configs
- opt_enable AUTO_BED_LEVELING_UBL UBL_G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT FIX_MOUNTED_PROBE EEPROM_SETTINGS G3D_PANEL - opt_enable AUTO_BED_LEVELING_UBL UBL_G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT EEPROM_SETTINGS G3D_PANEL
- opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING
- build_marlin - build_marlin
# #
# And with a probe...
#
- opt_enable FIX_MOUNTED_PROBE
- build_marlin
#
# Test a Sled Z Probe # Test a Sled Z Probe
# ...with AUTO_BED_LEVELING_LINEAR, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, and EEPROM_CHITCHAT # ...with AUTO_BED_LEVELING_LINEAR, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, and EEPROM_CHITCHAT
# #

@ -136,13 +136,8 @@
extern float destination[XYZE]; extern float destination[XYZE];
void set_destination_to_current(); void set_destination_to_current();
void prepare_move_to_destination(); void prepare_move_to_destination();
#if AVR_AT90USB1286_FAMILY // Teensyduino & Printrboard IDE extensions have compile errors without this
inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); } inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
inline void set_current_to_destination() { COPY(current_position, destination); } inline void set_current_to_destination() { COPY(current_position, destination); }
#else
void sync_plan_position_e();
void set_current_to_destination();
#endif
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
void lcd_setstatusPGM(const char* const message, const int8_t level); void lcd_setstatusPGM(const char* const message, const int8_t level);
void chirp_at_user(); void chirp_at_user();

@ -647,9 +647,7 @@ static_assert(1 >= 0
/** /**
* Require some kind of probe for bed leveling and probe testing * Require some kind of probe for bed leveling and probe testing
*/ */
#if ENABLED(AUTO_BED_LEVELING_UBL) #if HAS_ABL && DISABLED(AUTO_BED_LEVELING_UBL)
#error "Unified Bed Leveling requires a probe: FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
#elif HAS_ABL
#error "Auto Bed Leveling requires one of these: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or a Z Servo." #error "Auto Bed Leveling requires one of these: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or a Z Servo."
#endif #endif

@ -91,13 +91,16 @@
g29_phase_value, g29_phase_value,
g29_repetition_cnt, g29_repetition_cnt,
g29_storage_slot, g29_storage_slot,
g29_map_type, g29_map_type;
g29_grid_size;
static bool g29_c_flag, g29_x_flag, g29_y_flag; static bool g29_c_flag, g29_x_flag, g29_y_flag;
static float g29_x_pos, g29_y_pos, static float g29_x_pos, g29_y_pos,
g29_card_thickness, g29_card_thickness,
g29_constant; g29_constant;
#if HAS_BED_PROBE
static int g29_grid_size;
#endif
#if ENABLED(UBL_G26_MESH_VALIDATION) #if ENABLED(UBL_G26_MESH_VALIDATION)
static float g26_extrusion_multiplier, static float g26_extrusion_multiplier,
g26_retraction_multiplier, g26_retraction_multiplier,

@ -64,8 +64,7 @@
unified_bed_leveling::g29_phase_value, unified_bed_leveling::g29_phase_value,
unified_bed_leveling::g29_repetition_cnt, unified_bed_leveling::g29_repetition_cnt,
unified_bed_leveling::g29_storage_slot = 0, unified_bed_leveling::g29_storage_slot = 0,
unified_bed_leveling::g29_map_type, unified_bed_leveling::g29_map_type;
unified_bed_leveling::g29_grid_size;
bool unified_bed_leveling::g29_c_flag, bool unified_bed_leveling::g29_c_flag,
unified_bed_leveling::g29_x_flag, unified_bed_leveling::g29_x_flag,
unified_bed_leveling::g29_y_flag; unified_bed_leveling::g29_y_flag;
@ -74,6 +73,10 @@
unified_bed_leveling::g29_card_thickness = 0.0, unified_bed_leveling::g29_card_thickness = 0.0,
unified_bed_leveling::g29_constant = 0.0; unified_bed_leveling::g29_constant = 0.0;
#if HAS_BED_PROBE
int unified_bed_leveling::g29_grid_size;
#endif
/** /**
* G29: Unified Bed Leveling by Roxy * G29: Unified Bed Leveling by Roxy
* *
@ -309,6 +312,8 @@
return; return;
} }
if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
// Check for commands that require the printer to be homed // Check for commands that require the printer to be homed
if (axis_unhomed_error()) { if (axis_unhomed_error()) {
const int8_t p_val = parser.intval('P', -1); const int8_t p_val = parser.intval('P', -1);
@ -316,8 +321,6 @@
home_all_axes(); home_all_axes();
} }
if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
// Invalidate Mesh Points. This command is a little bit asymmetrical because // Invalidate Mesh Points. This command is a little bit asymmetrical because
// it directly specifies the repetition count and does not use the 'R' parameter. // it directly specifies the repetition count and does not use the 'R' parameter.
if (parser.seen('I')) { if (parser.seen('I')) {
@ -380,6 +383,8 @@
} }
} }
#if HAS_BED_PROBE
if (parser.seen('J')) { if (parser.seen('J')) {
if (g29_grid_size) { // if not 0 it is a normal n x n grid being probed if (g29_grid_size) { // if not 0 it is a normal n x n grid being probed
save_ubl_active_state_and_disable(); save_ubl_active_state_and_disable();
@ -415,6 +420,8 @@
} }
} }
#endif // HAS_BED_PROBE
if (parser.seen('P')) { if (parser.seen('P')) {
if (WITHIN(g29_phase_value, 0, 1) && state.storage_slot == -1) { if (WITHIN(g29_phase_value, 0, 1) && state.storage_slot == -1) {
state.storage_slot = 0; state.storage_slot = 0;
@ -430,6 +437,8 @@
SERIAL_PROTOCOLLNPGM("Mesh zeroed."); SERIAL_PROTOCOLLNPGM("Mesh zeroed.");
break; break;
#if HAS_BED_PROBE
case 1: case 1:
// //
// Invalidate Entire Mesh and Automatically Probe Mesh in areas that can be reached by the probe // Invalidate Entire Mesh and Automatically Probe Mesh in areas that can be reached by the probe
@ -448,6 +457,8 @@
parser.seen('T'), parser.seen('E'), parser.seen('U')); parser.seen('T'), parser.seen('E'), parser.seen('U'));
break; break;
#endif // HAS_BED_PROBE
case 2: { case 2: {
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
// //
@ -775,6 +786,7 @@
z_values[x][y] += g29_constant; z_values[x][y] += g29_constant;
} }
#if HAS_BED_PROBE
/** /**
* Probe all invalidated locations of the mesh that can be reached by the probe. * Probe all invalidated locations of the mesh that can be reached by the probe.
* This attempts to fill in locations closest to the nozzle's start location first. * This attempts to fill in locations closest to the nozzle's start location first.
@ -928,6 +940,7 @@
} }
} }
} }
#endif // HAS_BED_PROBE
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
float unified_bed_leveling::measure_point_with_encoder() { float unified_bed_leveling::measure_point_with_encoder() {
@ -1079,7 +1092,7 @@
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);
} }
#endif #endif // NEWPANEL
bool unified_bed_leveling::g29_parameter_parsing() { bool unified_bed_leveling::g29_parameter_parsing() {
bool err_flag = false; bool err_flag = false;
@ -1113,19 +1126,34 @@
} }
if (parser.seen('P')) { if (parser.seen('P')) {
g29_phase_value = parser.value_int(); const int pv = parser.value_int();
#if !HAS_BED_PROBE
if (pv == 1) {
SERIAL_PROTOCOLLNPGM("G29 P1 requires a probe.\n");
err_flag = true;
}
else
#endif
{
g29_phase_value = pv;
if (!WITHIN(g29_phase_value, 0, 6)) { if (!WITHIN(g29_phase_value, 0, 6)) {
SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n"); SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n");
err_flag = true; err_flag = true;
} }
} }
}
if (parser.seen('J')) { if (parser.seen('J')) {
#if HAS_BED_PROBE
g29_grid_size = parser.has_value() ? parser.value_int() : 0; g29_grid_size = parser.has_value() ? parser.value_int() : 0;
if (g29_grid_size && !WITHIN(g29_grid_size, 2, 9)) { if (g29_grid_size && !WITHIN(g29_grid_size, 2, 9)) {
SERIAL_PROTOCOLLNPGM("?Invalid grid size (J) specified (2-9).\n"); SERIAL_PROTOCOLLNPGM("?Invalid grid size (J) specified (2-9).\n");
err_flag = true; err_flag = true;
} }
#else
SERIAL_PROTOCOLLNPGM("G29 J action requires a probe.\n");
err_flag = true;
#endif
} }
if (g29_x_flag != g29_y_flag) { if (g29_x_flag != g29_y_flag) {
@ -1625,6 +1653,8 @@
} }
} }
#if HAS_BED_PROBE
void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map) { void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map) {
constexpr int16_t x_min = max(MIN_PROBE_X, UBL_MESH_MIN_X), constexpr int16_t x_min = max(MIN_PROBE_X, UBL_MESH_MIN_X),
x_max = min(MAX_PROBE_X, UBL_MESH_MAX_X), x_max = min(MAX_PROBE_X, UBL_MESH_MAX_X),
@ -1770,6 +1800,8 @@
if (do_ubl_mesh_map) display_map(g29_map_type); if (do_ubl_mesh_map) display_map(g29_map_type);
} }
#endif // HAS_BED_PROBE
#if ENABLED(UBL_G29_P31) #if ENABLED(UBL_G29_P31)
void unified_bed_leveling::smart_fill_wlsf(const float &weight_factor) { void unified_bed_leveling::smart_fill_wlsf(const float &weight_factor) {

Loading…
Cancel
Save