mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-31 14:12:52 +00:00
🧑💻 ExtUI::onPowerLoss
This commit is contained in:
parent
786c666151
commit
c950f0f5d1
12 changed files with 45 additions and 6 deletions
|
@ -31,6 +31,10 @@
|
|||
#include "powerloss.h"
|
||||
#include "../core/macros.h"
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
bool PrintJobRecovery::enabled; // Initialized by settings.load()
|
||||
|
||||
MediaFile PrintJobRecovery::file;
|
||||
|
@ -313,6 +317,9 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
// and a flag whether the raise was already done here.
|
||||
if (IS_SD_PRINTING()) save(true, zraise, ENABLED(BACKUP_POWER_SUPPLY));
|
||||
|
||||
// Tell the LCD about the outage, even though it is about to die
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPowerLoss());
|
||||
|
||||
// Disable all heaters to reduce power loss
|
||||
thermalManager.disable_all_heaters();
|
||||
|
||||
|
|
|
@ -120,6 +120,9 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
// Called on resume from power-loss
|
||||
void onPowerLossResume() { Chiron.PowerLossRecovery(); }
|
||||
#endif
|
||||
|
|
|
@ -106,6 +106,9 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
}
|
||||
|
|
|
@ -126,6 +126,9 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
IF_DISABLED(DGUS_LCD_UI_MKS, ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS));
|
||||
|
|
|
@ -123,6 +123,9 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
dgus_screen_handler.PowerLossResume();
|
||||
|
|
|
@ -112,6 +112,9 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
}
|
||||
|
|
|
@ -125,7 +125,12 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLossResume() {} // Called on resume from power-loss
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_PID_HEATING
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace ExtUI {
|
|||
|
||||
case DGUS_HEADER2_SEEN: // Waiting for the length byte
|
||||
rx_datagram_len = DWIN_SERIAL.read();
|
||||
//DEBUGLCDCOMM_ECHOPAIR(" (", rx_datagram_len, ") ");
|
||||
//DEBUGLCDCOMM_ECHOPGM(" (", rx_datagram_len, ") ");
|
||||
|
||||
// Telegram min len is 3 (command and one word of payload)
|
||||
rx_datagram_state = WITHIN(rx_datagram_len, 3, DGUS_RX_BUFFER_SIZE) ? DGUS_WAIT_TELEGRAM : DGUS_IDLE;
|
||||
|
@ -448,14 +448,14 @@ namespace ExtUI {
|
|||
Initialized = true; // We've talked to it, so we defined it as initialized.
|
||||
uint8_t command = DWIN_SERIAL.read();
|
||||
|
||||
//DEBUGLCDCOMM_ECHOPAIR("# ", command);
|
||||
//DEBUGLCDCOMM_ECHOPGM("# ", command);
|
||||
|
||||
uint8_t readlen = rx_datagram_len - 1; // command is part of len.
|
||||
uint8_t tmp[rx_datagram_len - 1];
|
||||
uint8_t *ptmp = tmp;
|
||||
while (readlen--) {
|
||||
receivedbyte = DWIN_SERIAL.read();
|
||||
//DEBUGLCDCOMM_ECHOPAIR(" ", receivedbyte);
|
||||
//DEBUGLCDCOMM_ECHOPGM(" ", receivedbyte);
|
||||
*ptmp++ = receivedbyte;
|
||||
}
|
||||
//DEBUGLCDCOMM_ECHOPGM(" # ");
|
||||
|
@ -2016,6 +2016,9 @@ namespace ExtUI {
|
|||
}
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
startprogress = 254;
|
||||
InforShowStatus = true;
|
||||
|
|
|
@ -158,7 +158,12 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLossResume() {}
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
}
|
||||
#endif
|
||||
|
||||
void onSteppersDisabled() {}
|
||||
|
|
|
@ -103,6 +103,9 @@ namespace ExtUI {
|
|||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss() {
|
||||
// Called when power-loss state is detected
|
||||
}
|
||||
void onPowerLossResume() {
|
||||
// Called on resume from power-loss
|
||||
}
|
||||
|
|
|
@ -426,6 +426,7 @@ namespace ExtUI {
|
|||
void onSettingsStored(bool success);
|
||||
void onSettingsLoaded(bool success);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void onPowerLoss();
|
||||
void onPowerLossResume();
|
||||
#endif
|
||||
#if HAS_PID_HEATING
|
||||
|
|
|
@ -56,7 +56,7 @@ const char* ui16tostr3rj(const uint16_t x);
|
|||
// Convert int16_t to string with 123 format
|
||||
const char* i16tostr3rj(const int16_t x);
|
||||
|
||||
// Convert unsigned int to lj string with 123 format
|
||||
// Convert signed int to lj string with 123 format
|
||||
const char* i16tostr3left(const int16_t xx);
|
||||
|
||||
// Convert signed int to rj string with _123, -123, _-12, or __-1 format
|
||||
|
|
Loading…
Reference in a new issue