|
@@ -28,15 +28,6 @@
|
28
|
28
|
|
29
|
29
|
#include "../shared/eeprom_api.h"
|
30
|
30
|
|
31
|
|
-#if HAS_SERVOS
|
32
|
|
- #include "Servo.h"
|
33
|
|
- #define PAUSE_SERVO_OUTPUT() libServo::pause_all_servos()
|
34
|
|
- #define RESUME_SERVO_OUTPUT() libServo::resume_all_servos()
|
35
|
|
-#else
|
36
|
|
- #define PAUSE_SERVO_OUTPUT()
|
37
|
|
- #define RESUME_SERVO_OUTPUT()
|
38
|
|
-#endif
|
39
|
|
-
|
40
|
31
|
/**
|
41
|
32
|
* The STM32 HAL supports chips that deal with "pages" and some with "sectors" and some that
|
42
|
33
|
* even have multiple "banks" of flash.
|
|
@@ -172,11 +163,11 @@ bool PersistentStore::access_finish() {
|
172
|
163
|
current_slot = EEPROM_SLOTS - 1;
|
173
|
164
|
UNLOCK_FLASH();
|
174
|
165
|
|
175
|
|
- PAUSE_SERVO_OUTPUT();
|
|
166
|
+ TERN_(HAS_PAUSE_SERVO_OUTPUT, PAUSE_SERVO_OUTPUT());
|
176
|
167
|
DISABLE_ISRS();
|
177
|
168
|
status = HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError);
|
178
|
169
|
ENABLE_ISRS();
|
179
|
|
- RESUME_SERVO_OUTPUT();
|
|
170
|
+ TERN_(HAS_PAUSE_SERVO_OUTPUT, RESUME_SERVO_OUTPUT());
|
180
|
171
|
if (status != HAL_OK) {
|
181
|
172
|
DEBUG_ECHOLNPAIR("HAL_FLASHEx_Erase=", status);
|
182
|
173
|
DEBUG_ECHOLNPAIR("GetError=", HAL_FLASH_GetError());
|
|
@@ -227,11 +218,11 @@ bool PersistentStore::access_finish() {
|
227
|
218
|
// Interrupts during this time can have unpredictable results, such as killing Servo
|
228
|
219
|
// output. Servo output still glitches with interrupts disabled, but recovers after the
|
229
|
220
|
// erase.
|
230
|
|
- PAUSE_SERVO_OUTPUT();
|
|
221
|
+ TERN_(HAS_PAUSE_SERVO_OUTPUT, PAUSE_SERVO_OUTPUT());
|
231
|
222
|
DISABLE_ISRS();
|
232
|
223
|
eeprom_buffer_flush();
|
233
|
224
|
ENABLE_ISRS();
|
234
|
|
- RESUME_SERVO_OUTPUT();
|
|
225
|
+ TERN_(HAS_PAUSE_SERVO_OUTPUT, RESUME_SERVO_OUTPUT());
|
235
|
226
|
|
236
|
227
|
eeprom_data_written = false;
|
237
|
228
|
#endif
|