My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nextion_lcd.cpp 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * lcd/extui/nextion_lcd.cpp
  24. *
  25. * Nextion TFT support for Marlin
  26. */
  27. #include "../../inc/MarlinConfigPre.h"
  28. #if ENABLED(NEXTION_TFT)
  29. #include "ui_api.h"
  30. #include "lib/nextion/nextion_tft.h"
  31. namespace ExtUI {
  32. void onStartup() { nextion.Startup(); }
  33. void onIdle() { nextion.IdleLoop(); }
  34. void onPrinterKilled(PGM_P const error, PGM_P const component) { nextion.PrinterKilled(error,component); }
  35. void onMediaInserted() {}
  36. void onMediaError() {}
  37. void onMediaRemoved() {}
  38. void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
  39. void onPrintTimerStarted() {}
  40. void onPrintTimerPaused() {}
  41. void onPrintTimerStopped() {}
  42. void onFilamentRunout(const extruder_t) {}
  43. void onUserConfirmRequired(const char * const msg) { nextion.ConfirmationRequest(msg); }
  44. void onStatusChanged(const char * const msg) { nextion.StatusChange(msg); }
  45. void onHomingStart() {}
  46. void onHomingComplete() {}
  47. void onPrintFinished() { nextion.PrintFinished(); }
  48. void onFactoryReset() {}
  49. void onStoreSettings(char *buff) {
  50. // Called when saving to EEPROM (i.e. M500). If the ExtUI needs
  51. // permanent data to be stored, it can write up to eeprom_data_size bytes
  52. // into buff.
  53. // Example:
  54. // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
  55. // memcpy(buff, &myDataStruct, sizeof(myDataStruct));
  56. }
  57. void onLoadSettings(const char *buff) {
  58. // Called while loading settings from EEPROM. If the ExtUI
  59. // needs to retrieve data, it should copy up to eeprom_data_size bytes
  60. // from buff
  61. // Example:
  62. // static_assert(sizeof(myDataStruct) <= ExtUI::eeprom_data_size);
  63. // memcpy(&myDataStruct, buff, sizeof(myDataStruct));
  64. }
  65. void onConfigurationStoreWritten(bool success) {
  66. // Called after the entire EEPROM has been written,
  67. // whether successful or not.
  68. }
  69. void onConfigurationStoreRead(bool success) {
  70. // Called after the entire EEPROM has been read,
  71. // whether successful or not.
  72. }
  73. #if HAS_MESH
  74. void onMeshLevelingStart() {}
  75. void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval) {
  76. // Called when any mesh points are updated
  77. }
  78. void onMeshUpdate(const int8_t xpos, const int8_t ypos, const ExtUI::probe_state_t state) {
  79. // Called to indicate a special condition
  80. }
  81. #endif
  82. #if ENABLED(POWER_LOSS_RECOVERY)
  83. void onPowerLossResume() {
  84. // Called on resume from power-loss
  85. }
  86. #endif
  87. #if HAS_PID_HEATING
  88. void onPidTuning(const result_t rst) {
  89. // Called for temperature PID tuning result
  90. nextion.PanelInfo(37);
  91. }
  92. #endif
  93. void onSteppersDisabled() {}
  94. void onSteppersEnabled() {}
  95. }
  96. #endif // NEXTION_TFT