mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-02-02 07:00:42 +00:00
🚸🐛 Anycubic Vyper fixes (1) (#26261)
This commit is contained in:
parent
d9fc4f3a99
commit
b99391c810
4 changed files with 21 additions and 14 deletions
|
@ -117,6 +117,8 @@ namespace Anycubic {
|
|||
void DEBUG_PRINT_TIMER_EVENT(const timer_event_t event, FSTR_P const msg=nullptr);
|
||||
void DEBUG_PRINT_MEDIA_EVENT(const media_event_t event, FSTR_P const msg=nullptr);
|
||||
|
||||
void set_brightness();
|
||||
|
||||
DgusTFT dgus;
|
||||
|
||||
DgusTFT::DgusTFT() {
|
||||
|
@ -202,6 +204,14 @@ namespace Anycubic {
|
|||
}
|
||||
#endif
|
||||
|
||||
// Periodically update main page
|
||||
if ((page_index_now == 121 || page_index_now == 1) && ((millis() % 500) == 0)) {
|
||||
TERN_(HAS_HOTEND, send_temperature_hotend(TXT_MAIN_HOTEND));
|
||||
TERN_(HAS_HEATED_BED, send_temperature_bed(TXT_MAIN_BED));
|
||||
set_brightness();
|
||||
delay(1); // wait for millis() to advance so this clause isn't repeated
|
||||
}
|
||||
|
||||
switch (page_index_now) {
|
||||
case 115: page115(); break;
|
||||
case 117: page117(); break;
|
||||
|
@ -672,13 +682,6 @@ namespace Anycubic {
|
|||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
|
||||
void DgusTFT::powerLoss() {
|
||||
// On: 5A A5 05 82 00 82 00 00
|
||||
// Off: 5A A5 05 82 00 82 00 64
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x05, 0x82, 0x00, 0x82, 0x00, uint8_t(recovery.enabled ? 0x00 : 0x64) };
|
||||
for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
void DgusTFT::powerLossRecovery() {
|
||||
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
||||
}
|
||||
|
@ -907,9 +910,10 @@ namespace Anycubic {
|
|||
}
|
||||
|
||||
void DgusTFT::checkHeaters() {
|
||||
static uint32_t time_last = 0;
|
||||
if (PENDING(millis(), time_last)) return;
|
||||
time_last = millis() + 500;
|
||||
static uint32_t time_next = 0;
|
||||
const millis_t ms = millis();
|
||||
if (PENDING(ms, time_next)) return;
|
||||
time_next = ms + 500;
|
||||
|
||||
float temp = 0;
|
||||
|
||||
|
@ -1127,6 +1131,11 @@ namespace Anycubic {
|
|||
}
|
||||
#endif
|
||||
|
||||
void set_brightness() {
|
||||
uint8_t data[] = { 0x5A, 0xA5, 0x07, 0x82, 0x00, 0x82, 0x64, 0x32, 0x03, 0xE8 };
|
||||
for (uint8_t i = 0; i < COUNT(data); ++i) TFTSer.write(data[i]);
|
||||
}
|
||||
|
||||
void DgusTFT::set_language(language_t language) {
|
||||
lcd_info.language = ui_language = lcd_info_back.language = language;
|
||||
}
|
||||
|
|
|
@ -364,7 +364,6 @@ namespace Anycubic {
|
|||
static void filamentRunout();
|
||||
static void confirmationRequest(const char * const);
|
||||
static void statusChange(const char * const);
|
||||
static void powerLoss();
|
||||
static void powerLossRecovery();
|
||||
static void homingStart();
|
||||
static void homingComplete();
|
||||
|
|
|
@ -121,7 +121,6 @@ namespace ExtUI {
|
|||
void onPostprocessSettings() {
|
||||
// Called after loading or resetting stored settings
|
||||
dgus.paramInit();
|
||||
dgus.powerLoss();
|
||||
}
|
||||
|
||||
void onSettingsStored(const bool success) {
|
||||
|
@ -160,7 +159,7 @@ namespace ExtUI {
|
|||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Called when power-loss is enabled/disabled
|
||||
void onSetPowerLoss(const bool) { dgus.powerLoss(); }
|
||||
void onSetPowerLoss(const bool) { /* nothing to do */ }
|
||||
// Called when power-loss state is detected
|
||||
void onPowerLoss() { /* handled internally */ }
|
||||
// Called on resume from power-loss
|
||||
|
|
|
@ -101,7 +101,7 @@ void DGUSRxHandler::retractLength(DGUS_VP &vp, void *data) {
|
|||
|
||||
void DGUSRxHandler::setLanguage(DGUS_VP &vp, void *data) {
|
||||
DGUS_Data::Language language = (DGUS_Data::Language)Endianness::fromBE_P<uint16_t>(data);
|
||||
screen.config.language = language;
|
||||
ui_language = screen.config.language = language;
|
||||
screen.triggerEEPROMSave();
|
||||
screen.triggerFullUpdate();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue