123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- /**
- * Marlin 3D Printer Firmware
- * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * 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
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
- /**
- * lcd/extui/nextion_lcd.cpp
- *
- * Nextion TFT support for Marlin
- */
-
- #include "../../inc/MarlinConfigPre.h"
-
- #if ENABLED(NEXTION_TFT)
-
- #include "ui_api.h"
- #include "lib/nextion/nextion_tft.h"
-
- namespace ExtUI {
-
- void onStartup() { nextion.Startup(); }
- void onIdle() { nextion.IdleLoop(); }
- void onPrinterKilled(PGM_P const error, PGM_P const component) { nextion.PrinterKilled(error,component); }
- void onMediaInserted() {}
- void onMediaError() {}
- void onMediaRemoved() {}
- void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
- void onPrintTimerStarted() {}
- void onPrintTimerPaused() {}
- void onPrintTimerStopped() {}
- void onFilamentRunout(const extruder_t) {}
- void onUserConfirmRequired(const char * const msg) { nextion.ConfirmationRequest(msg); }
- void onStatusChanged(const char * const msg) { nextion.StatusChange(msg); }
-
- void onHomingStart() {}
- void onHomingComplete() {}
- void onPrintFinished() { nextion.PrintFinished(); }
-
- void onFactoryReset() {}
-
- 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.
- }
-
- #if HAS_MESH
- void onMeshLevelingStart() {}
-
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
- // Called when any mesh points are updated
- }
-
- void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
- // Called to indicate a special condition
- }
- #endif
-
- #if ENABLED(POWER_LOSS_RECOVERY)
- void onPowerLossResume() {
- // Called on resume from power-loss
- }
- #endif
-
- #if HAS_PID_HEATING
- void onPidTuning(const result_t rst) {
- // Called for temperature PID tuning result
- nextion.PanelInfo(37);
- }
- #endif
-
- void onSteppersDisabled() {}
- void onSteppersEnabled() {}
- }
-
- #endif // NEXTION_TFT
|