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.

DGUSScreenHandler.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "config/DGUS_Addr.h"
  24. #include "config/DGUS_Data.h"
  25. #include "config/DGUS_Screen.h"
  26. #include "config/DGUS_Constants.h"
  27. #include "../ui_api.h"
  28. #include "../../../inc/MarlinConfigPre.h"
  29. class DGUSScreenHandler {
  30. public:
  31. DGUSScreenHandler() = default;
  32. static void Init();
  33. static void Ready();
  34. static void Loop();
  35. static void PrinterKilled(PGM_P error, PGM_P component);
  36. static void UserConfirmRequired(const char * const msg);
  37. static void SettingsReset();
  38. static void StoreSettings(char *buff);
  39. static void LoadSettings(const char *buff);
  40. static void ConfigurationStoreWritten(bool success);
  41. static void ConfigurationStoreRead(bool success);
  42. static void PlayTone(const uint16_t frequency, const uint16_t duration);
  43. static void MeshUpdate(const int8_t xpos, const int8_t ypos);
  44. static void PrintTimerStarted();
  45. static void PrintTimerPaused();
  46. static void PrintTimerStopped();
  47. static void FilamentRunout(const ExtUI::extruder_t extruder);
  48. #if ENABLED(SDSUPPORT)
  49. /// Marlin informed us that a new SD has been inserted.
  50. static void SDCardInserted();
  51. /// Marlin informed us that the SD Card has been removed().
  52. static void SDCardRemoved();
  53. /// Marlin informed us about a bad SD Card.
  54. static void SDCardError();
  55. #endif
  56. #if ENABLED(POWER_LOSS_RECOVERY)
  57. static void PowerLossResume();
  58. #endif
  59. #if HAS_PID_HEATING
  60. static void PidTuning(const ExtUI::result_t rst);
  61. #endif
  62. static void SetMessageLine(const char* msg, uint8_t line);
  63. static void SetMessageLinePGM(PGM_P msg, uint8_t line);
  64. static void SetStatusMessage(const char* msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS);
  65. static void SetStatusMessagePGM(PGM_P msg, const millis_t duration = DGUS_STATUS_EXPIRATION_MS);
  66. static void ShowWaitScreen(DGUS_Screen return_screen, bool has_continue = false);
  67. static DGUS_Screen GetCurrentScreen();
  68. static void TriggerScreenChange(DGUS_Screen screen);
  69. static void TriggerFullUpdate();
  70. static void TriggerEEPROMSave();
  71. static bool IsPrinterIdle();
  72. static uint8_t debug_count;
  73. #if ENABLED(SDSUPPORT)
  74. static ExtUI::FileList filelist;
  75. static uint16_t filelist_offset;
  76. static int16_t filelist_selected;
  77. #endif
  78. static DGUS_Data::StepSize offset_steps;
  79. static DGUS_Data::StepSize move_steps;
  80. static uint16_t probing_icons[2];
  81. static DGUS_Data::Extruder filament_extruder;
  82. static uint16_t filament_length;
  83. static char gcode[DGUS_GCODE_LEN + 1];
  84. static DGUS_Data::Heater pid_heater;
  85. static uint16_t pid_temp;
  86. static uint8_t pid_cycles;
  87. static bool wait_continue;
  88. static bool leveling_active;
  89. private:
  90. static const DGUS_Addr* FindScreenAddrList(DGUS_Screen screen);
  91. static bool CallScreenSetup(DGUS_Screen screen);
  92. static void MoveToScreen(DGUS_Screen screen, bool abort_wait = false);
  93. static bool SendScreenVPData(DGUS_Screen screen, bool complete_update);
  94. static bool settings_ready;
  95. static bool booted;
  96. static DGUS_Screen current_screen;
  97. static DGUS_Screen new_screen;
  98. static bool full_update;
  99. static DGUS_Screen wait_return_screen;
  100. static millis_t status_expire;
  101. static millis_t eeprom_save;
  102. typedef struct {
  103. bool initialized;
  104. uint8_t volume;
  105. uint8_t brightness;
  106. bool abl;
  107. } eeprom_data_t;
  108. };
  109. extern DGUSScreenHandler dgus_screen_handler;
  110. extern const char DGUS_MSG_HOMING_REQUIRED[],
  111. DGUS_MSG_BUSY[],
  112. DGUS_MSG_UNDEF[],
  113. DGUS_MSG_HOMING[],
  114. DGUS_MSG_FW_OUTDATED[],
  115. DGUS_MSG_ABL_REQUIRED[];
  116. extern const char DGUS_CMD_HOME[],
  117. DGUS_CMD_EEPROM_SAVE[];