Additional cleanup of UBL code

This commit is contained in:
Scott Lahteine
2017-03-20 01:42:41 -05:00
parent cc3204509c
commit e244399766
35 changed files with 2201 additions and 2070 deletions

View File

@ -301,7 +301,7 @@
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
bed_leveling blm;
unified_bed_leveling ubl;
#endif
bool Running = true;
@ -2309,9 +2309,9 @@ static void clean_up_after_endstop_or_probe_move() {
planner.unapply_leveling(current_position);
}
#elif ENABLED(AUTO_BED_LEVELING_UBL)
if (blm.state.EEPROM_storage_slot == 0) {
blm.state.active = enable;
blm.store_state();
if (ubl.state.eeprom_storage_slot == 0) {
ubl.state.active = enable;
ubl.store_state();
}
#endif
}
@ -2486,7 +2486,7 @@ static void clean_up_after_endstop_or_probe_move() {
SERIAL_PROTOCOLCHAR(' ');
float offset = fn(x, y);
if (offset != UNPROBED) {
if (offset >= 0) SERIAL_CHAR('+');
if (offset >= 0) SERIAL_PROTOCOLCHAR('+');
SERIAL_PROTOCOL_F(offset, precision);
}
else
@ -3258,7 +3258,9 @@ inline void gcode_G4() {
#endif
SERIAL_ECHOPGM("Probe: ");
#if ENABLED(FIX_MOUNTED_PROBE)
#if ENABLED(PROBE_MANUALLY)
SERIAL_ECHOLNPGM("PROBE_MANUALLY");
#elif ENABLED(FIX_MOUNTED_PROBE)
SERIAL_ECHOLNPGM("FIX_MOUNTED_PROBE");
#elif ENABLED(BLTOUCH)
SERIAL_ECHOLNPGM("BLTOUCH");
@ -3314,7 +3316,7 @@ inline void gcode_G4() {
#endif
if (planner.abl_enabled) {
SERIAL_ECHOLNPGM(" (enabled)");
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL)
#if ABL_PLANAR
float diff[XYZ] = {
stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
@ -3329,12 +3331,19 @@ inline void gcode_G4() {
SERIAL_ECHOPGM(" Z");
if (diff[Z_AXIS] > 0) SERIAL_CHAR('+');
SERIAL_ECHO(diff[Z_AXIS]);
#elif ENABLED(AUTO_BED_LEVELING_UBL)
SERIAL_ECHOPAIR("UBL Adjustment Z", stepper.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]);
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
SERIAL_ECHOPAIR("ABL Adjustment Z", bilinear_z_offset(current_position));
#endif
}
else
SERIAL_ECHOLNPGM(" (disabled)");
SERIAL_EOL;
#elif ENABLED(MESH_BED_LEVELING)
SERIAL_ECHOPGM("Mesh Bed Leveling");
if (mbl.active()) {
float lz = current_position[Z_AXIS];
@ -3342,9 +3351,12 @@ inline void gcode_G4() {
SERIAL_ECHOLNPGM(" (enabled)");
SERIAL_ECHOPAIR("MBL Adjustment Z", lz);
}
SERIAL_EOL;
#endif
else
SERIAL_ECHOPGM(" (disabled)");
SERIAL_EOL;
#endif // MESH_BED_LEVELING
}
#endif // DEBUG_LEVELING_FEATURE
@ -5354,7 +5366,7 @@ inline void gcode_M104() {
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(target_extruder), 1);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_raw[target_extruder] / OVERSAMPLENR);
SERIAL_CHAR(')');
SERIAL_PROTOCOLCHAR(')');
#endif
#endif
#if HAS_TEMP_BED
@ -5364,7 +5376,7 @@ inline void gcode_M104() {
SERIAL_PROTOCOL_F(thermalManager.degTargetBed(), 1);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_bed_raw / OVERSAMPLENR);
SERIAL_CHAR(')');
SERIAL_PROTOCOLCHAR(')');
#endif
#endif
#if HOTENDS > 1
@ -5376,7 +5388,7 @@ inline void gcode_M104() {
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(e), 1);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_raw[e] / OVERSAMPLENR);
SERIAL_CHAR(')');
SERIAL_PROTOCOLCHAR(')');
#endif
}
#endif
@ -7132,7 +7144,7 @@ void quickstop_stepper() {
*
* S[bool] Turns leveling on or off
* Z[height] Sets the Z fade height (0 or none to disable)
* V[bool] Verbose - Print the levelng grid
* V[bool] Verbose - Print the leveling grid
*/
inline void gcode_M420() {
bool to_enable = false;
@ -7150,7 +7162,7 @@ void quickstop_stepper() {
#if ENABLED(MESH_BED_LEVELING)
mbl.active()
#elif ENABLED(AUTO_BED_LEVELING_UBL)
blm.state.active
ubl.state.active
#else
planner.abl_enabled
#endif
@ -7176,7 +7188,7 @@ void quickstop_stepper() {
#endif
}
#elif ENABLED(AUTO_BED_LEVELING_UBL)
blm.display_map(0); // Right now, we only support one type of map
ubl.display_map(0); // Right now, we only support one type of map
#elif ENABLED(MESH_BED_LEVELING)
if (mbl.has_mesh()) {
SERIAL_ECHOLNPGM("Mesh Bed Level data:");
@ -8013,7 +8025,7 @@ inline void gcode_M999() {
inline void invalid_extruder_error(const uint8_t &e) {
SERIAL_ECHO_START;
SERIAL_CHAR('T');
SERIAL_PROTOCOL_F(e, DEC);
SERIAL_ECHO_F(e, DEC);
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
}
@ -8616,13 +8628,13 @@ void process_next_command() {
#endif // Z_MIN_PROBE_REPEATABILITY_TEST
#if ENABLED(AUTO_BED_LEVELING_UBL)
case 49: // M49: Turn on or off G26_Debug_flag for verbose output
if (G26_Debug_flag) {
case 49: // M49: Turn on or off g26_debug_flag for verbose output
if (g26_debug_flag) {
SERIAL_PROTOCOLPGM("UBL Debug Flag turned off.\n");
G26_Debug_flag = 0; }
g26_debug_flag = 0; }
else {
SERIAL_PROTOCOLPGM("UBL Debug Flag turned on.\n");
G26_Debug_flag++; }
g26_debug_flag++; }
break;
#endif // Z_MIN_PROBE_REPEATABILITY_TEST
@ -9757,11 +9769,11 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
}
else
#elif ENABLED(AUTO_BED_LEVELING_UBL)
if (blm.state.active) {
if (ubl.state.active) {
// UBL_line_to_destination(MMS_SCALED(feedrate_mm_s));
// ubl_line_to_destination(MMS_SCALED(feedrate_mm_s));
UBL_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS],
ubl_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS],
// (feedrate*(1.0/60.0))*(feedrate_percentage*(1.0/100.0) ), active_extruder);
MMS_SCALED(feedrate_mm_s), active_extruder);