|
@@ -202,12 +202,19 @@ void save_job_recovery_info() {
|
202
|
202
|
millis_t ms = millis();
|
203
|
203
|
#endif
|
204
|
204
|
if (
|
205
|
|
- #if SAVE_INFO_INTERVAL_MS > 0
|
206
|
|
- ELAPSED(ms, next_save_ms) ||
|
207
|
|
- #endif
|
|
205
|
+ // Save on every command
|
208
|
206
|
#if ENABLED(SAVE_EACH_CMD_MODE)
|
209
|
207
|
true
|
210
|
208
|
#else
|
|
209
|
+ // Save if power loss pin is triggered
|
|
210
|
+ #if PIN_EXISTS(POWER_LOSS)
|
|
211
|
+ READ(POWER_LOSS_PIN) == POWER_LOSS_STATE ||
|
|
212
|
+ #endif
|
|
213
|
+ // Save if interval is elapsed
|
|
214
|
+ #if SAVE_INFO_INTERVAL_MS > 0
|
|
215
|
+ ELAPSED(ms, next_save_ms) ||
|
|
216
|
+ #endif
|
|
217
|
+ // Save on every new Z height
|
211
|
218
|
(current_position[Z_AXIS] > 0 && current_position[Z_AXIS] > job_recovery_info.current_position[Z_AXIS])
|
212
|
219
|
#endif
|
213
|
220
|
) {
|
|
@@ -267,6 +274,11 @@ void save_job_recovery_info() {
|
267
|
274
|
|
268
|
275
|
card.openJobRecoveryFile(false);
|
269
|
276
|
(void)card.saveJobRecoveryInfo();
|
|
277
|
+
|
|
278
|
+ // If power-loss pin was triggered, write just once then kill
|
|
279
|
+ #if PIN_EXISTS(POWER_LOSS)
|
|
280
|
+ if (READ(POWER_LOSS_PIN) == POWER_LOSS_STATE) kill(MSG_POWER_LOSS_RECOVERY);
|
|
281
|
+ #endif
|
270
|
282
|
}
|
271
|
283
|
}
|
272
|
284
|
|