UBL no longer needs ubl_state
This commit is contained in:
@ -65,10 +65,9 @@
|
||||
safe_delay(10);
|
||||
}
|
||||
|
||||
ubl_state unified_bed_leveling::state;
|
||||
int8_t unified_bed_leveling::storage_slot;
|
||||
|
||||
float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y],
|
||||
unified_bed_leveling::last_specified_z;
|
||||
float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
|
||||
|
||||
// 15 is the maximum nubmer of grid points supported + 1 safety margin for now,
|
||||
// until determinism prevails
|
||||
@ -91,12 +90,11 @@
|
||||
|
||||
void unified_bed_leveling::reset() {
|
||||
set_bed_leveling_enabled(false);
|
||||
state.storage_slot = -1;
|
||||
storage_slot = -1;
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
planner.set_z_fade_height(10.0);
|
||||
#endif
|
||||
ZERO(z_values);
|
||||
last_specified_z = -999.9;
|
||||
}
|
||||
|
||||
void unified_bed_leveling::invalidate() {
|
||||
|
@ -70,16 +70,9 @@ extern uint8_t ubl_cnt;
|
||||
#define MESH_X_DIST (float(UBL_MESH_MAX_X - (UBL_MESH_MIN_X)) / float(GRID_MAX_POINTS_X - 1))
|
||||
#define MESH_Y_DIST (float(UBL_MESH_MAX_Y - (UBL_MESH_MIN_Y)) / float(GRID_MAX_POINTS_Y - 1))
|
||||
|
||||
typedef struct {
|
||||
bool active = false;
|
||||
int8_t storage_slot = -1;
|
||||
} ubl_state;
|
||||
|
||||
class unified_bed_leveling {
|
||||
private:
|
||||
|
||||
static float last_specified_z;
|
||||
|
||||
static int g29_verbose_level,
|
||||
g29_phase_value,
|
||||
g29_repetition_cnt,
|
||||
@ -161,7 +154,7 @@ class unified_bed_leveling {
|
||||
static void G26();
|
||||
#endif
|
||||
|
||||
static ubl_state state;
|
||||
static int8_t storage_slot;
|
||||
|
||||
static float z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
|
||||
|
||||
|
@ -424,8 +424,8 @@
|
||||
#endif // HAS_BED_PROBE
|
||||
|
||||
if (parser.seen('P')) {
|
||||
if (WITHIN(g29_phase_value, 0, 1) && state.storage_slot == -1) {
|
||||
state.storage_slot = 0;
|
||||
if (WITHIN(g29_phase_value, 0, 1) && storage_slot == -1) {
|
||||
storage_slot = 0;
|
||||
SERIAL_PROTOCOLLNPGM("Default storage slot 0 selected.");
|
||||
}
|
||||
|
||||
@ -604,7 +604,7 @@
|
||||
//
|
||||
|
||||
if (parser.seen('L')) { // Load Current Mesh Data
|
||||
g29_storage_slot = parser.has_value() ? parser.value_int() : state.storage_slot;
|
||||
g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
|
||||
|
||||
int16_t a = settings.calc_num_meshes();
|
||||
|
||||
@ -620,7 +620,7 @@
|
||||
}
|
||||
|
||||
settings.load_mesh(g29_storage_slot);
|
||||
state.storage_slot = g29_storage_slot;
|
||||
storage_slot = g29_storage_slot;
|
||||
|
||||
SERIAL_PROTOCOLLNPGM("Done.");
|
||||
}
|
||||
@ -630,7 +630,7 @@
|
||||
//
|
||||
|
||||
if (parser.seen('S')) { // Store (or Save) Current Mesh Data
|
||||
g29_storage_slot = parser.has_value() ? parser.value_int() : state.storage_slot;
|
||||
g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
|
||||
|
||||
if (g29_storage_slot == -1) { // Special case, we are going to 'Export' the mesh to the
|
||||
SERIAL_ECHOLNPGM("G29 I 999"); // host in a form it can be reconstructed on a different machine
|
||||
@ -662,7 +662,7 @@
|
||||
}
|
||||
|
||||
settings.store_mesh(g29_storage_slot);
|
||||
state.storage_slot = g29_storage_slot;
|
||||
storage_slot = g29_storage_slot;
|
||||
|
||||
SERIAL_PROTOCOLLNPGM("Done.");
|
||||
}
|
||||
@ -1195,10 +1195,10 @@
|
||||
void unified_bed_leveling::g29_what_command() {
|
||||
report_state();
|
||||
|
||||
if (state.storage_slot == -1)
|
||||
if (storage_slot == -1)
|
||||
SERIAL_PROTOCOLPGM("No Mesh Loaded.");
|
||||
else {
|
||||
SERIAL_PROTOCOLPAIR("Mesh ", state.storage_slot);
|
||||
SERIAL_PROTOCOLPAIR("Mesh ", storage_slot);
|
||||
SERIAL_PROTOCOLPGM(" Loaded.");
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
Reference in New Issue
Block a user