Only write position to physical EEPROM when move finishes

This commit is contained in:
Filip Ayazi 2023-10-11 00:37:32 +01:00
parent ef05df7eb9
commit 40e27eeb22
2 changed files with 8 additions and 0 deletions

View file

@ -33,6 +33,7 @@
#define WIRING_PWM_LEDS {} #define WIRING_PWM_LEDS {}
#define SUPPORT_EEPROM #define SUPPORT_EEPROM
#define STAGE_MAX_MOTORS 3 #define STAGE_MAX_MOTORS 3
#define EEPROM_IS_REAL
#elif defined(BOARD_SANGABOARDv2) #elif defined(BOARD_SANGABOARDv2)
#define BOARD_STRING "Sangaboard v0.2" #define BOARD_STRING "Sangaboard v0.2"
#define WIRING_MOTOR_X 13, 12, 11, 10 #define WIRING_MOTOR_X 13, 12, 11, 10
@ -47,6 +48,7 @@
#define WIRING_PWM_LEDS {} #define WIRING_PWM_LEDS {}
#define SUPPORT_EEPROM #define SUPPORT_EEPROM
#define STAGE_MAX_MOTORS 3 #define STAGE_MAX_MOTORS 3
#define EEPROM_IS_REAL
#elif defined(BOARD_CUSTOM_BLUEPILL) #elif defined(BOARD_CUSTOM_BLUEPILL)
#define BOARD_STRING "Custom Bluepill board" #define BOARD_STRING "Custom Bluepill board"
#define WIRING_MOTOR_X PB11, PB10, PB1, PB0 #define WIRING_MOTOR_X PB11, PB10, PB1, PB0

View file

@ -194,7 +194,13 @@ void stage_loop()
} }
} }
} }
#ifndef EEPROM_IS_REAL
EEPROM.put(0, current_pos); // ensure our position is held in EEPROM so it persists EEPROM.put(0, current_pos); // ensure our position is held in EEPROM so it persists
#else
if (!stage_moving)
EEPROM.put(0, current_pos); // ensure our position is held in EEPROM so it persists
#endif
if (!stage_moving && notify_on_stop) if (!stage_moving && notify_on_stop)
{ {