Backlash cleanup (#13659)

…And save backlash, fil. sensor, ExtUI userdata to EEPROM.
This commit is contained in:
Marcio Teixeira
2019-05-03 22:53:15 -06:00
committed by Scott Lahteine
parent 0181e57417
commit 15357af67c
22 changed files with 645 additions and 293 deletions

View File

@ -82,11 +82,7 @@
#include "ui_api.h"
#if ENABLED(BACKLASH_GCODE)
extern float backlash_distance_mm[XYZ];
extern uint8_t backlash_correction;
#ifdef BACKLASH_SMOOTHING_MM
extern float backlash_smoothing_mm;
#endif
#include "../../feature/backlash.h"
#endif
#if HAS_LEVELING
@ -111,7 +107,6 @@ static struct {
} flags;
namespace ExtUI {
#ifdef __SAM3X8E__
/**
* Implement a special millis() to allow time measurement
@ -517,13 +512,13 @@ namespace ExtUI {
bool getFilamentRunoutEnabled() { return runout.enabled; }
void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; }
#if FILAMENT_RUNOUT_DISTANCE_MM > 0
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
float getFilamentRunoutDistance_mm() {
return RunoutResponseDelayed::runout_distance_mm;
return runout.runout_distance();
}
void setFilamentRunoutDistance_mm(const float value) {
RunoutResponseDelayed::runout_distance_mm = clamp(value, 0, 999);
runout.set_runout_distance(clamp(value, 0, 999));
}
#endif
#endif
@ -687,16 +682,16 @@ namespace ExtUI {
#endif // HAS_HOTEND_OFFSET
#if ENABLED(BACKLASH_GCODE)
float getAxisBacklash_mm(const axis_t axis) { return backlash_distance_mm[axis]; }
float getAxisBacklash_mm(const axis_t axis) { return backlash.distance_mm[axis]; }
void setAxisBacklash_mm(const float value, const axis_t axis)
{ backlash_distance_mm[axis] = clamp(value,0,5); }
{ backlash.distance_mm[axis] = clamp(value,0,5); }
float getBacklashCorrection_percent() { return ui8_to_percent(backlash_correction); }
void setBacklashCorrection_percent(const float value) { backlash_correction = map(clamp(value, 0, 100), 0, 100, 0, 255); }
float getBacklashCorrection_percent() { return ui8_to_percent(backlash.correction); }
void setBacklashCorrection_percent(const float value) { backlash.correction = map(clamp(value, 0, 100), 0, 100, 0, 255); }
#ifdef BACKLASH_SMOOTHING_MM
float getBacklashSmoothing_mm() { return backlash_smoothing_mm; }
void setBacklashSmoothing_mm(const float value) { backlash_smoothing_mm = clamp(value, 0, 999); }
float getBacklashSmoothing_mm() { return backlash.smoothing_mm; }
void setBacklashSmoothing_mm(const float value) { backlash.smoothing_mm = clamp(value, 0, 999); }
#endif
#endif
@ -750,7 +745,7 @@ namespace ExtUI {
}
bool commandsInQueue() { return (planner.movesplanned() || commands_in_queue); }
bool isAxisPositionKnown(const axis_t axis) {
return TEST(axis_known_position, axis);
}