My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

extui_dgus_lcd.cpp 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * extui_dgus_lcd.cpp
  24. *
  25. * DGUS implementation for Marlin by coldtobi, Feb-May 2019
  26. */
  27. #include "../inc/MarlinConfigPre.h"
  28. #if ENABLED(DGUS_LCD)
  29. #include "extensible_ui/ui_api.h"
  30. #include "extensible_ui/lib/dgus/DGUSDisplay.h"
  31. #include "extensible_ui/lib/dgus/DGUSDisplayDefinition.h"
  32. extern const char NUL_STR[];
  33. namespace ExtUI {
  34. void onStartup() {
  35. dgusdisplay.InitDisplay();
  36. ScreenHandler.UpdateScreenVPData();
  37. }
  38. void onIdle() { ScreenHandler.loop(); }
  39. void onPrinterKilled(PGM_P error, PGM_P component) {
  40. ScreenHandler.sendinfoscreen(GET_TEXT(MSG_HALTED), error, NUL_STR, GET_TEXT(MSG_PLEASE_RESET), true, true, true, true);
  41. ScreenHandler.GotoScreen(DGUSLCD_SCREEN_KILL);
  42. while (!ScreenHandler.loop()); // Wait while anything is left to be sent
  43. }
  44. void onMediaInserted() {
  45. #if ENABLED(SDSUPPORT)
  46. ScreenHandler.SDCardInserted();
  47. #endif
  48. }
  49. void onMediaError() {
  50. #if ENABLED(SDSUPPORT)
  51. ScreenHandler.SDCardError();
  52. #endif
  53. }
  54. void onMediaRemoved() {
  55. #if ENABLED(SDSUPPORT)
  56. ScreenHandler.SDCardRemoved();
  57. #endif
  58. }
  59. void onPlayTone(const uint16_t frequency, const uint16_t duration) {}
  60. void onPrintTimerStarted() {}
  61. void onPrintTimerPaused() {}
  62. void onPrintTimerStopped() {}
  63. void onFilamentRunout(const extruder_t extruder) {}
  64. void onUserConfirmRequired(const char * const msg) {
  65. if (msg) {
  66. ScreenHandler.sendinfoscreen(PSTR("Please confirm."), nullptr, msg, nullptr, true, true, false, true);
  67. ScreenHandler.SetupConfirmAction(ExtUI::setUserConfirmed);
  68. ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
  69. }
  70. else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP ) {
  71. ScreenHandler.SetupConfirmAction(nullptr);
  72. ScreenHandler.PopToOldScreen();
  73. }
  74. }
  75. void onStatusChanged(const char * const msg) { ScreenHandler.setstatusmessage(msg); }
  76. void onFactoryReset() {}
  77. void onLoadSettings() {}
  78. void onStoreSettings() {}
  79. }
  80. #endif // DGUS_LCD