2019-06-21 09:47:23 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 14:00:57 +00:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2019-06-21 09:47:23 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2019-06-21 09:47:23 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-23 03:20:14 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-06-21 09:47:23 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2020-08-20 06:38:22 +00:00
|
|
|
* dgus_lcd.cpp
|
2019-06-21 09:47:23 +00:00
|
|
|
*
|
|
|
|
* DGUS implementation for Marlin by coldtobi, Feb-May 2019
|
|
|
|
*/
|
|
|
|
|
2020-08-20 06:38:22 +00:00
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
2019-06-21 09:47:23 +00:00
|
|
|
|
2020-01-04 03:00:44 +00:00
|
|
|
#if HAS_DGUS_LCD
|
2019-06-21 09:47:23 +00:00
|
|
|
|
2020-08-20 06:38:22 +00:00
|
|
|
#include "ui_api.h"
|
|
|
|
#include "lib/dgus/DGUSDisplay.h"
|
|
|
|
#include "lib/dgus/DGUSDisplayDef.h"
|
|
|
|
#include "lib/dgus/DGUSScreenHandler.h"
|
2019-06-21 09:47:23 +00:00
|
|
|
|
2020-01-02 23:59:06 +00:00
|
|
|
extern const char NUL_STR[];
|
|
|
|
|
2019-06-21 09:47:23 +00:00
|
|
|
namespace ExtUI {
|
|
|
|
|
|
|
|
void onStartup() {
|
|
|
|
dgusdisplay.InitDisplay();
|
|
|
|
ScreenHandler.UpdateScreenVPData();
|
|
|
|
}
|
|
|
|
|
2019-06-23 08:43:36 +00:00
|
|
|
void onIdle() { ScreenHandler.loop(); }
|
2019-06-21 09:47:23 +00:00
|
|
|
|
2020-05-04 19:37:43 +00:00
|
|
|
void onPrinterKilled(PGM_P const error, PGM_P const component) {
|
2019-11-02 12:09:57 +00:00
|
|
|
ScreenHandler.sendinfoscreen(GET_TEXT(MSG_HALTED), error, NUL_STR, GET_TEXT(MSG_PLEASE_RESET), true, true, true, true);
|
2019-06-23 08:43:36 +00:00
|
|
|
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL);
|
|
|
|
while (!ScreenHandler.loop()); // Wait while anything is left to be sent
|
|
|
|
}
|
2019-06-21 09:47:23 +00:00
|
|
|
|
2020-04-22 21:35:03 +00:00
|
|
|
void onMediaInserted() { TERN_(SDSUPPORT, ScreenHandler.SDCardInserted()); }
|
|
|
|
void onMediaError() { TERN_(SDSUPPORT, ScreenHandler.SDCardError()); }
|
|
|
|
void onMediaRemoved() { TERN_(SDSUPPORT, ScreenHandler.SDCardRemoved()); }
|
2019-06-21 09:47:23 +00:00
|
|
|
|
|
|
|
void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
|
|
|
|
void onPrintTimerStarted() {}
|
|
|
|
void onPrintTimerPaused() {}
|
|
|
|
void onPrintTimerStopped() {}
|
2019-09-18 04:41:34 +00:00
|
|
|
void onFilamentRunout(const extruder_t extruder) {}
|
2019-06-21 09:47:23 +00:00
|
|
|
|
2019-10-10 00:46:10 +00:00
|
|
|
void onUserConfirmRequired(const char * const msg) {
|
2019-06-21 09:47:23 +00:00
|
|
|
if (msg) {
|
|
|
|
ScreenHandler.sendinfoscreen(PSTR("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
|
|
|
|
ScreenHandler.SetupConfirmAction(ExtUI::setUserConfirmed);
|
|
|
|
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
|
|
|
|
}
|
|
|
|
else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP ) {
|
|
|
|
ScreenHandler.SetupConfirmAction(nullptr);
|
|
|
|
ScreenHandler.PopToOldScreen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
|
|
|
|
|
2020-11-05 22:45:22 +00:00
|
|
|
void onHomingStart() {}
|
|
|
|
void onHomingComplete() {}
|
|
|
|
void onPrintFinished() {}
|
|
|
|
|
2019-06-21 09:47:23 +00:00
|
|
|
void onFactoryReset() {}
|
2020-11-05 22:45:22 +00:00
|
|
|
|
2020-01-04 03:00:44 +00:00
|
|
|
void onStoreSettings(char *buff) {
|
|
|
|
// Called when saving to EEPROM (i.e. M500). If the ExtUI needs
|
|
|
|
// permanent data to be stored, it can write up to eeprom_data_size bytes
|
|
|
|
// into buff.
|
|
|
|
|
|
|
|
// Example:
|
|
|
|
// static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
|
|
|
|
// memcpy(buff, &myDataStruct, sizeof(myDataStruct));
|
|
|
|
}
|
|
|
|
|
|
|
|
void onLoadSettings(const char *buff) {
|
|
|
|
// Called while loading settings from EEPROM. If the ExtUI
|
|
|
|
// needs to retrieve data, it should copy up to eeprom_data_size bytes
|
|
|
|
// from buff
|
|
|
|
|
|
|
|
// Example:
|
|
|
|
// static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
|
|
|
|
// memcpy(&myDataStruct, buff, sizeof(myDataStruct));
|
|
|
|
}
|
|
|
|
|
|
|
|
void onConfigurationStoreWritten(bool success) {
|
|
|
|
// Called after the entire EEPROM has been written,
|
|
|
|
// whether successful or not.
|
|
|
|
}
|
|
|
|
|
|
|
|
void onConfigurationStoreRead(bool success) {
|
|
|
|
// Called after the entire EEPROM has been read,
|
|
|
|
// whether successful or not.
|
|
|
|
}
|
|
|
|
|
2020-05-02 22:30:51 +00:00
|
|
|
#if HAS_MESH
|
2020-11-05 22:45:22 +00:00
|
|
|
void onMeshLevelingStart() {}
|
|
|
|
|
2020-05-02 22:30:51 +00:00
|
|
|
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
|
|
|
|
// Called when any mesh points are updated
|
|
|
|
}
|
2020-01-04 03:00:44 +00:00
|
|
|
|
2020-05-02 22:30:51 +00:00
|
|
|
void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
|
|
|
|
// Called to indicate a special condition
|
|
|
|
}
|
|
|
|
#endif
|
2020-04-02 19:24:55 +00:00
|
|
|
|
2020-01-04 03:00:44 +00:00
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
2020-03-31 19:22:04 +00:00
|
|
|
void onPowerLossResume() {
|
2020-01-04 03:00:44 +00:00
|
|
|
// Called on resume from power-loss
|
|
|
|
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POWER_LOSS);
|
|
|
|
}
|
|
|
|
#endif
|
2019-06-21 09:47:23 +00:00
|
|
|
|
2020-01-04 03:00:44 +00:00
|
|
|
|
|
|
|
#if HAS_PID_HEATING
|
2020-03-31 19:22:04 +00:00
|
|
|
void onPidTuning(const result_t rst) {
|
2020-01-04 03:00:44 +00:00
|
|
|
// Called for temperature PID tuning result
|
2020-05-04 19:37:43 +00:00
|
|
|
switch (rst) {
|
2020-01-04 03:00:44 +00:00
|
|
|
case PID_BAD_EXTRUDER_NUM:
|
2020-05-04 19:37:43 +00:00
|
|
|
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_BAD_EXTRUDER_NUM));
|
2020-01-04 03:00:44 +00:00
|
|
|
break;
|
|
|
|
case PID_TEMP_TOO_HIGH:
|
2020-05-04 19:37:43 +00:00
|
|
|
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_TEMP_TOO_HIGH));
|
2020-01-04 03:00:44 +00:00
|
|
|
break;
|
|
|
|
case PID_TUNING_TIMEOUT:
|
2020-05-04 19:37:43 +00:00
|
|
|
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_TIMEOUT));
|
2020-01-04 03:00:44 +00:00
|
|
|
break;
|
|
|
|
case PID_DONE:
|
2020-05-04 19:37:43 +00:00
|
|
|
ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_AUTOTUNE_DONE));
|
2020-01-04 03:00:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-11-05 22:45:22 +00:00
|
|
|
void onSteppersDisabled() {}
|
|
|
|
void onSteppersEnabled() {}
|
2020-01-04 03:00:44 +00:00
|
|
|
}
|
2020-11-05 22:45:22 +00:00
|
|
|
|
2020-01-04 03:00:44 +00:00
|
|
|
#endif // HAS_DGUS_LCD
|