Store current position in EEPROM
Previously, we held our position in EEPROM so it persisted even across power cycles. This seems to have been lost, so I'm restoring it.
This commit is contained in:
parent
40439a0ead
commit
3e4b3e97eb
1 changed files with 6 additions and 4 deletions
|
|
@ -12,12 +12,13 @@
|
||||||
|
|
||||||
// The array below has 3 stepper objects, for X,Y,Z respectively
|
// The array below has 3 stepper objects, for X,Y,Z respectively
|
||||||
const uint8_t n_motors = STAGE_N_MOTORS;
|
const uint8_t n_motors = STAGE_N_MOTORS;
|
||||||
|
const uint8_t stage_position_eeprom = 0;
|
||||||
long min_step_delay = -1;
|
long min_step_delay = -1;
|
||||||
const uint8_t min_step_delay_eeprom = sizeof(long) * n_motors;
|
const uint8_t min_step_delay_eeprom = stage_position_eeprom + sizeof(long) * n_motors;
|
||||||
long ramp_time = -1;
|
long ramp_time = -1;
|
||||||
const uint8_t ramp_time_eeprom = sizeof(long) * (n_motors + 1);
|
const uint8_t ramp_time_eeprom = min_step_delay_eeprom + sizeof(long);
|
||||||
const uint8_t axis_max_eeprom = sizeof(long) * (n_motors + 2);
|
const uint8_t axis_max_eeprom = ramp_time_eeprom + sizeof(long);
|
||||||
const uint8_t non_blocking_moves_eeprom = sizeof(long) * (n_motors + 3);
|
const uint8_t non_blocking_moves_eeprom = axis_max_eeprom + sizeof(long);
|
||||||
Stepper *motors[n_motors];
|
Stepper *motors[n_motors];
|
||||||
signed long current_pos[n_motors];
|
signed long current_pos[n_motors];
|
||||||
long steps_remaining[n_motors];
|
long steps_remaining[n_motors];
|
||||||
|
|
@ -181,6 +182,7 @@ void stage_loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
EEPROM.put(0, current_pos); // ensure our position is held in EEPROM so it persists
|
||||||
|
|
||||||
if (!stage_moving && notify_on_stop)
|
if (!stage_moving && notify_on_stop)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue