My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

screens.h 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /*************
  2. * screens.h *
  3. *************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  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. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <http://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #pragma once
  22. #include "../ftdi_eve_lib/ftdi_eve_lib.h"
  23. #include "../language/languages.h"
  24. #include "../theme/theme.h"
  25. #include "string_format.h"
  26. extern tiny_timer_t refresh_timer;
  27. /********************************* DL CACHE SLOTS ******************************/
  28. // In order to reduce SPI traffic, we cache display lists (DL) in RAMG. This
  29. // is done using the CLCD::DLCache class, which takes a unique ID for each
  30. // cache location. These IDs are defined here:
  31. enum {
  32. STATUS_SCREEN_CACHE,
  33. MENU_SCREEN_CACHE,
  34. TUNE_SCREEN_CACHE,
  35. ADJUST_OFFSETS_SCREEN_CACHE,
  36. ALERT_BOX_CACHE,
  37. SPINNER_CACHE,
  38. ADVANCED_SETTINGS_SCREEN_CACHE,
  39. MOVE_AXIS_SCREEN_CACHE,
  40. TEMPERATURE_SCREEN_CACHE,
  41. STEPS_SCREEN_CACHE,
  42. STEPPER_CURRENT_SCREEN_CACHE,
  43. STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE,
  44. ZOFFSET_SCREEN_CACHE,
  45. NOZZLE_OFFSET_SCREEN_CACHE,
  46. BACKLASH_COMPENSATION_SCREEN_CACHE,
  47. MAX_FEEDRATE_SCREEN_CACHE,
  48. MAX_VELOCITY_SCREEN_CACHE,
  49. MAX_ACCELERATION_SCREEN_CACHE,
  50. DEFAULT_ACCELERATION_SCREEN_CACHE,
  51. #if ENABLED(JUNCTION_DEVIATION)
  52. JUNC_DEV_SCREEN_CACHE,
  53. #else
  54. JERK_SCREEN_CACHE,
  55. #endif
  56. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  57. FILAMENT_MENU_CACHE,
  58. #endif
  59. #if ENABLED(LIN_ADVANCE)
  60. LINEAR_ADVANCE_SCREEN_CACHE,
  61. #endif
  62. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  63. FILAMENT_RUNOUT_SCREEN_CACHE,
  64. #endif
  65. #ifdef LULZBOT_USE_BIOPRINTER_UI
  66. PRINTING_SCREEN_CACHE,
  67. #endif
  68. CHANGE_FILAMENT_SCREEN_CACHE,
  69. INTERFACE_SETTINGS_SCREEN_CACHE,
  70. INTERFACE_SOUNDS_SCREEN_CACHE,
  71. LOCK_SCREEN_CACHE,
  72. FILES_SCREEN_CACHE,
  73. DISPLAY_TIMINGS_SCREEN_CACHE
  74. };
  75. // To save MCU RAM, the status message is "baked" in to the status screen
  76. // cache, so we reserve a large chunk of memory for the DL cache
  77. #define STATUS_SCREEN_DL_SIZE 2048
  78. #define ALERT_BOX_DL_SIZE 3072
  79. #define SPINNER_DL_SIZE 3072
  80. #define FILE_SCREEN_DL_SIZE 3072
  81. #define PRINTING_SCREEN_DL_SIZE 2048
  82. /************************* MENU SCREEN DECLARATIONS *************************/
  83. class BaseScreen : public UIScreen {
  84. protected:
  85. #ifdef LCD_TIMEOUT_TO_STATUS
  86. static uint32_t last_interaction;
  87. #endif
  88. public:
  89. static bool buttonStyleCallback(CommandProcessor &, uint8_t, uint8_t &, uint16_t &, bool);
  90. static void reset_menu_timeout();
  91. static void onEntry();
  92. static void onIdle();
  93. };
  94. class BootScreen : public BaseScreen, public UncachedScreen {
  95. private:
  96. static void showSplashScreen();
  97. public:
  98. static void onRedraw(draw_mode_t);
  99. static void onIdle();
  100. };
  101. class AboutScreen : public BaseScreen, public UncachedScreen {
  102. public:
  103. static void onEntry();
  104. static void onRedraw(draw_mode_t);
  105. static bool onTouchEnd(uint8_t tag);
  106. };
  107. #if ENABLED(PRINTCOUNTER)
  108. class StatisticsScreen : public BaseScreen, public UncachedScreen {
  109. public:
  110. static void onRedraw(draw_mode_t);
  111. static bool onTouchEnd(uint8_t tag);
  112. };
  113. #endif
  114. class KillScreen {
  115. // The KillScreen is behaves differently than the
  116. // others, so we do not bother extending UIScreen.
  117. public:
  118. static void show(progmem_str msg);
  119. };
  120. class DialogBoxBaseClass : public BaseScreen {
  121. protected:
  122. template<typename T> static void drawMessage(const T, int16_t font = 0);
  123. static void drawYesNoButtons(uint8_t default_btn = 0);
  124. static void drawOkayButton();
  125. static void drawSpinner();
  126. static void drawButton(const progmem_str);
  127. static void onRedraw(draw_mode_t) {};
  128. public:
  129. static bool onTouchEnd(uint8_t tag);
  130. static void onIdle();
  131. };
  132. class AlertDialogBox : public DialogBoxBaseClass, public CachedScreen<ALERT_BOX_CACHE,ALERT_BOX_DL_SIZE> {
  133. public:
  134. static void onEntry();
  135. static void onRedraw(draw_mode_t);
  136. template<typename T> static void show(T);
  137. template<typename T> static void showError(T);
  138. static void hide();
  139. };
  140. class RestoreFailsafeDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  141. public:
  142. static void onRedraw(draw_mode_t);
  143. static bool onTouchEnd(uint8_t tag);
  144. };
  145. class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  146. private:
  147. static bool needs_save;
  148. public:
  149. static void onRedraw(draw_mode_t);
  150. static bool onTouchEnd(uint8_t tag);
  151. static void promptToSaveSettings();
  152. static void settingsChanged() {needs_save = true;}
  153. };
  154. class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  155. public:
  156. static void onRedraw(draw_mode_t);
  157. static bool onTouchEnd(uint8_t tag);
  158. };
  159. #if ENABLED(CALIBRATION_GCODE)
  160. class ConfirmAutoCalibrationDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  161. public:
  162. static void onRedraw(draw_mode_t);
  163. static bool onTouchEnd(uint8_t tag);
  164. };
  165. #endif
  166. class ConfirmUserRequestAlertBox : public AlertDialogBox {
  167. public:
  168. static void onRedraw(draw_mode_t);
  169. static bool onTouchEnd(uint8_t);
  170. static void hide();
  171. static void show(const char*);
  172. };
  173. class SpinnerDialogBox : public DialogBoxBaseClass, public CachedScreen<SPINNER_CACHE,SPINNER_DL_SIZE> {
  174. public:
  175. static void onRedraw(draw_mode_t);
  176. static void onIdle();
  177. static void show(const progmem_str);
  178. static void hide();
  179. static void enqueueAndWait_P(const progmem_str commands);
  180. static void enqueueAndWait_P(const progmem_str message, const progmem_str commands);
  181. };
  182. #ifndef LULZBOT_USE_BIOPRINTER_UI
  183. class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,STATUS_SCREEN_DL_SIZE> {
  184. private:
  185. static void draw_axis_position(draw_mode_t);
  186. static void draw_temperature(draw_mode_t);
  187. static void draw_progress(draw_mode_t);
  188. static void draw_interaction_buttons(draw_mode_t);
  189. static void draw_status_message(draw_mode_t, const char * const);
  190. public:
  191. static void loadBitmaps();
  192. static void setStatusMessage(const char *);
  193. static void setStatusMessage(progmem_str);
  194. static void onRedraw(draw_mode_t);
  195. static void onStartup();
  196. static void onEntry();
  197. static void onIdle();
  198. static bool onTouchEnd(uint8_t tag);
  199. };
  200. #else
  201. class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE> {
  202. private:
  203. static float increment;
  204. static bool jog_xy;
  205. static bool fine_motion;
  206. static void draw_temperature(draw_mode_t what);
  207. static void draw_syringe(draw_mode_t what);
  208. static void draw_arrows(draw_mode_t what);
  209. static void draw_overlay_icons(draw_mode_t what);
  210. static void draw_fine_motion(draw_mode_t what);
  211. static void draw_buttons(draw_mode_t what);
  212. public:
  213. static void loadBitmaps();
  214. static void unlockMotors();
  215. static void setStatusMessage(const char *);
  216. static void setStatusMessage(progmem_str);
  217. static void onRedraw(draw_mode_t);
  218. static bool onTouchStart(uint8_t tag);
  219. static bool onTouchHeld(uint8_t tag);
  220. static bool onTouchEnd(uint8_t tag);
  221. static void onIdle();
  222. };
  223. class BioPrintingDialogBox : public BaseScreen, public CachedScreen<PRINTING_SCREEN_CACHE,PRINTING_SCREEN_DL_SIZE> {
  224. private:
  225. static void draw_status_message(draw_mode_t, const char * const);
  226. static void draw_progress(draw_mode_t);
  227. static void draw_time_remaining(draw_mode_t);
  228. static void draw_interaction_buttons(draw_mode_t);
  229. public:
  230. static void onRedraw(draw_mode_t);
  231. static void show();
  232. static void setStatusMessage(const char *);
  233. static void setStatusMessage(progmem_str);
  234. static void onIdle();
  235. static bool onTouchEnd(uint8_t tag);
  236. };
  237. class BioConfirmHomeXYZ : public DialogBoxBaseClass, public UncachedScreen {
  238. public:
  239. static void onRedraw(draw_mode_t);
  240. static bool onTouchEnd(uint8_t tag);
  241. };
  242. class BioConfirmHomeE : public DialogBoxBaseClass, public UncachedScreen {
  243. public:
  244. static void onRedraw(draw_mode_t);
  245. static bool onTouchEnd(uint8_t tag);
  246. };
  247. #endif
  248. class MainMenu : public BaseScreen, public CachedScreen<MENU_SCREEN_CACHE> {
  249. public:
  250. static void onRedraw(draw_mode_t);
  251. static bool onTouchEnd(uint8_t tag);
  252. };
  253. class TuneMenu : public BaseScreen, public CachedScreen<TUNE_SCREEN_CACHE> {
  254. public:
  255. static void onRedraw(draw_mode_t);
  256. static bool onTouchEnd(uint8_t tag);
  257. };
  258. class TouchCalibrationScreen : public BaseScreen, public UncachedScreen {
  259. public:
  260. static void onRefresh();
  261. static void onEntry();
  262. static void onRedraw(draw_mode_t);
  263. static void onIdle();
  264. };
  265. class TouchRegistersScreen : public BaseScreen, public UncachedScreen {
  266. public:
  267. static void onRedraw(draw_mode_t);
  268. static bool onTouchEnd(uint8_t tag);
  269. };
  270. class AdvancedSettingsMenu : public BaseScreen, public CachedScreen<ADVANCED_SETTINGS_SCREEN_CACHE> {
  271. public:
  272. static void onRedraw(draw_mode_t);
  273. static bool onTouchEnd(uint8_t tag);
  274. };
  275. class ChangeFilamentScreen : public BaseScreen, public CachedScreen<CHANGE_FILAMENT_SCREEN_CACHE> {
  276. private:
  277. static uint8_t getSoftenTemp();
  278. static ExtUI::extruder_t getExtruder();
  279. static void drawTempGradient(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  280. static uint32_t getTempColor(uint32_t temp);
  281. public:
  282. static void onEntry();
  283. static void onExit();
  284. static void onRedraw(draw_mode_t);
  285. static bool onTouchStart(uint8_t tag);
  286. static bool onTouchEnd(uint8_t tag);
  287. static bool onTouchHeld(uint8_t tag);
  288. static void onIdle();
  289. };
  290. class BaseNumericAdjustmentScreen : public BaseScreen {
  291. public:
  292. enum precision_default_t {
  293. DEFAULT_LOWEST,
  294. DEFAULT_MIDRANGE,
  295. DEFAULT_HIGHEST
  296. };
  297. protected:
  298. class widgets_t {
  299. private:
  300. draw_mode_t _what;
  301. uint8_t _line;
  302. uint32_t _color;
  303. uint8_t _decimals;
  304. progmem_str _units;
  305. protected:
  306. void _draw_increment_btn(uint8_t line, const uint8_t tag);
  307. public:
  308. widgets_t(draw_mode_t);
  309. widgets_t &color(uint32_t color) {_color = color; return *this;}
  310. widgets_t &units(progmem_str units) {_units = units; return *this;}
  311. widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;}
  312. widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST);
  313. void heading (progmem_str label);
  314. void adjuster_sram_val (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  315. void adjuster (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  316. void adjuster (uint8_t tag, progmem_str label, float value=0, bool is_enabled = true);
  317. void button (uint8_t tag, progmem_str label, bool is_enabled = true);
  318. void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  319. void two_buttons (uint8_t tag1, progmem_str label1,
  320. uint8_t tag2, progmem_str label2, bool is_enabled = true);
  321. void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true);
  322. void home_buttons (uint8_t tag);
  323. void increments ();
  324. };
  325. static float getIncrement();
  326. public:
  327. static void onEntry();
  328. static bool onTouchEnd(uint8_t tag);
  329. };
  330. class MoveAxisScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MOVE_AXIS_SCREEN_CACHE> {
  331. private:
  332. static float getManualFeedrate(uint8_t axis, float increment_mm);
  333. public:
  334. static void setManualFeedrate(ExtUI::axis_t, float increment_mm);
  335. static void setManualFeedrate(ExtUI::extruder_t, float increment_mm);
  336. static void onEntry();
  337. static void onRedraw(draw_mode_t);
  338. static bool onTouchHeld(uint8_t tag);
  339. static void onIdle();
  340. };
  341. class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPS_SCREEN_CACHE> {
  342. public:
  343. static void onRedraw(draw_mode_t);
  344. static bool onTouchHeld(uint8_t tag);
  345. };
  346. #if HAS_TRINAMIC
  347. class StepperCurrentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_CURRENT_SCREEN_CACHE> {
  348. public:
  349. static void onRedraw(draw_mode_t);
  350. static bool onTouchHeld(uint8_t tag);
  351. };
  352. class StepperBumpSensitivityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE> {
  353. public:
  354. static void onRedraw(draw_mode_t);
  355. static bool onTouchHeld(uint8_t tag);
  356. };
  357. #endif
  358. #if HAS_BED_PROBE
  359. class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ZOFFSET_SCREEN_CACHE> {
  360. public:
  361. static void onRedraw(draw_mode_t);
  362. static bool onTouchHeld(uint8_t tag);
  363. };
  364. #endif
  365. #if HOTENDS > 1
  366. class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<NOZZLE_OFFSET_SCREEN_CACHE> {
  367. public:
  368. static void onEntry();
  369. static void onRedraw(draw_mode_t);
  370. static bool onTouchHeld(uint8_t tag);
  371. };
  372. #endif
  373. #if ENABLED(BABYSTEPPING)
  374. class NudgeNozzleScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ADJUST_OFFSETS_SCREEN_CACHE> {
  375. public:
  376. static void onEntry();
  377. static void onRedraw(draw_mode_t);
  378. static bool onTouchEnd(uint8_t tag);
  379. static bool onTouchHeld(uint8_t tag);
  380. static void onIdle();
  381. };
  382. #endif
  383. #if ENABLED(BACKLASH_GCODE)
  384. class BacklashCompensationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<BACKLASH_COMPENSATION_SCREEN_CACHE> {
  385. public:
  386. static void onRedraw(draw_mode_t);
  387. static bool onTouchHeld(uint8_t tag);
  388. };
  389. #endif
  390. class FeedratePercentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_FEEDRATE_SCREEN_CACHE> {
  391. public:
  392. static void onRedraw(draw_mode_t);
  393. static bool onTouchHeld(uint8_t tag);
  394. };
  395. class MaxVelocityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_VELOCITY_SCREEN_CACHE> {
  396. public:
  397. static void onRedraw(draw_mode_t);
  398. static bool onTouchHeld(uint8_t tag);
  399. };
  400. class MaxAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_ACCELERATION_SCREEN_CACHE> {
  401. public:
  402. static void onRedraw(draw_mode_t);
  403. static bool onTouchHeld(uint8_t tag);
  404. };
  405. class DefaultAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<DEFAULT_ACCELERATION_SCREEN_CACHE> {
  406. public:
  407. static void onRedraw(draw_mode_t);
  408. static bool onTouchHeld(uint8_t tag);
  409. };
  410. #if ENABLED(JUNCTION_DEVIATION)
  411. class JunctionDeviationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<JUNC_DEV_SCREEN_CACHE> {
  412. public:
  413. static void onRedraw(draw_mode_t);
  414. static bool onTouchHeld(uint8_t tag);
  415. };
  416. #else
  417. class JerkScreen : public BaseNumericAdjustmentScreen, public CachedScreen<JERK_SCREEN_CACHE> {
  418. public:
  419. static void onRedraw(draw_mode_t);
  420. static bool onTouchHeld(uint8_t tag);
  421. };
  422. #endif
  423. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  424. class FilamentMenu : public BaseNumericAdjustmentScreen, public CachedScreen<FILAMENT_MENU_CACHE> {
  425. public:
  426. static void onRedraw(draw_mode_t);
  427. static bool onTouchEnd(uint8_t tag);
  428. };
  429. #endif
  430. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  431. class FilamentRunoutScreen : public BaseNumericAdjustmentScreen, public CachedScreen<FILAMENT_RUNOUT_SCREEN_CACHE> {
  432. public:
  433. static void onRedraw(draw_mode_t);
  434. static bool onTouchHeld(uint8_t tag);
  435. };
  436. #endif
  437. #if ENABLED(LIN_ADVANCE)
  438. class LinearAdvanceScreen : public BaseNumericAdjustmentScreen, public CachedScreen<LINEAR_ADVANCE_SCREEN_CACHE> {
  439. public:
  440. static void onRedraw(draw_mode_t);
  441. static bool onTouchHeld(uint8_t tag);
  442. };
  443. #endif
  444. class TemperatureScreen : public BaseNumericAdjustmentScreen, public CachedScreen<TEMPERATURE_SCREEN_CACHE> {
  445. public:
  446. static void onRedraw(draw_mode_t);
  447. static bool onTouchHeld(uint8_t tag);
  448. };
  449. class InterfaceSoundsScreen : public BaseScreen, public CachedScreen<INTERFACE_SOUNDS_SCREEN_CACHE> {
  450. public:
  451. enum event_t {
  452. PRINTING_STARTED = 0,
  453. PRINTING_FINISHED = 1,
  454. PRINTING_FAILED = 2,
  455. NUM_EVENTS
  456. };
  457. private:
  458. friend class InterfaceSettingsScreen;
  459. static uint8_t event_sounds[NUM_EVENTS];
  460. static const char* getSoundSelection(event_t);
  461. static void toggleSoundSelection(event_t);
  462. static void setSoundSelection(event_t, const FTDI::SoundPlayer::sound_t*);
  463. public:
  464. static void playEventSound(event_t, FTDI::play_mode_t = FTDI::PLAY_ASYNCHRONOUS);
  465. static void defaultSettings();
  466. static void onEntry();
  467. static void onRedraw(draw_mode_t);
  468. static bool onTouchStart(uint8_t tag);
  469. static bool onTouchEnd(uint8_t tag);
  470. static void onIdle();
  471. };
  472. class InterfaceSettingsScreen : public BaseScreen, public CachedScreen<INTERFACE_SETTINGS_SCREEN_CACHE> {
  473. private:
  474. struct persistent_data_t {
  475. uint32_t touch_transform_a;
  476. uint32_t touch_transform_b;
  477. uint32_t touch_transform_c;
  478. uint32_t touch_transform_d;
  479. uint32_t touch_transform_e;
  480. uint32_t touch_transform_f;
  481. uint16_t passcode;
  482. uint8_t display_brightness;
  483. int8_t display_h_offset_adj;
  484. int8_t display_v_offset_adj;
  485. uint8_t sound_volume;
  486. uint8_t bit_flags;
  487. uint8_t event_sounds[InterfaceSoundsScreen::NUM_EVENTS];
  488. };
  489. public:
  490. #ifdef LULZBOT_EEPROM_BACKUP_SIZE
  491. static bool backupEEPROM();
  492. #endif
  493. static void saveSettings(char *);
  494. static void loadSettings(const char *);
  495. static void defaultSettings();
  496. static void failSafeSettings();
  497. static void onStartup();
  498. static void onEntry();
  499. static void onRedraw(draw_mode_t);
  500. static bool onTouchStart(uint8_t tag);
  501. static bool onTouchEnd(uint8_t tag);
  502. static void onIdle();
  503. };
  504. class LockScreen : public BaseScreen, public CachedScreen<LOCK_SCREEN_CACHE> {
  505. private:
  506. friend InterfaceSettingsScreen;
  507. static uint16_t passcode;
  508. static char & message_style();
  509. static uint16_t compute_checksum();
  510. static void onPasscodeEntered();
  511. public:
  512. static bool is_enabled();
  513. static void check_passcode();
  514. static void enable();
  515. static void disable();
  516. static void set_hash(uint16_t pass) {passcode = pass;};
  517. static uint16_t get_hash() {return passcode;};
  518. static void onEntry();
  519. static void onRedraw(draw_mode_t);
  520. static bool onTouchEnd(uint8_t tag);
  521. };
  522. class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, FILE_SCREEN_DL_SIZE> {
  523. private:
  524. #ifdef TOUCH_UI_PORTRAIT
  525. static constexpr uint8_t header_h = 2;
  526. static constexpr uint8_t footer_h = 2;
  527. static constexpr uint8_t files_per_page = 11;
  528. #else
  529. static constexpr uint8_t header_h = 1;
  530. static constexpr uint8_t footer_h = 1;
  531. static constexpr uint8_t files_per_page = 6;
  532. #endif
  533. static uint8_t getTagForLine(uint8_t line) {return line + 2;}
  534. static uint8_t getLineForTag(uint8_t tag) {return tag - 2;}
  535. static uint16_t getFileForTag(uint8_t tag);
  536. static const char *getSelectedShortFilename();
  537. static const char *getSelectedLongFilename();
  538. static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted);
  539. static void drawFileList();
  540. static void drawHeader();
  541. static void drawFooter();
  542. static void drawSelectedFile();
  543. static void gotoPage(uint8_t);
  544. public:
  545. static void onEntry();
  546. static void onRedraw(draw_mode_t);
  547. static bool onTouchEnd(uint8_t tag);
  548. static void onIdle();
  549. };
  550. class EndstopStatesScreen : public BaseScreen, public UncachedScreen {
  551. public:
  552. static void onEntry();
  553. static void onExit();
  554. static void onRedraw(draw_mode_t);
  555. static bool onTouchEnd(uint8_t tag);
  556. static void onIdle();
  557. };
  558. class DisplayTuningScreen : public BaseNumericAdjustmentScreen, public CachedScreen<DISPLAY_TIMINGS_SCREEN_CACHE> {
  559. public:
  560. static void onRedraw(draw_mode_t);
  561. static bool onTouchHeld(uint8_t tag);
  562. };
  563. #if ENABLED(DEVELOPER_SCREENS)
  564. class DeveloperMenu : public BaseScreen, public UncachedScreen {
  565. public:
  566. static void onRedraw(draw_mode_t);
  567. static bool onTouchEnd(uint8_t tag);
  568. };
  569. class ConfirmEraseFlashDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  570. public:
  571. static void onRedraw(draw_mode_t);
  572. static bool onTouchEnd(uint8_t tag);
  573. };
  574. class WidgetsScreen : public BaseScreen, public UncachedScreen {
  575. public:
  576. static void onEntry();
  577. static void onRedraw(draw_mode_t);
  578. static bool onTouchStart(uint8_t tag);
  579. static void onIdle();
  580. };
  581. class StressTestScreen : public BaseScreen, public UncachedScreen {
  582. private:
  583. static void drawDots(uint16_t x, uint16_t y, uint16_t h, uint16_t v);
  584. static bool watchDogTestNow();
  585. static void recursiveLockup();
  586. static void iterativeLockup();
  587. static void runTestOnBootup(bool enable);
  588. public:
  589. static void startupCheck();
  590. static void onEntry();
  591. static void onRedraw(draw_mode_t);
  592. static bool onTouchEnd(uint8_t tag);
  593. static void onIdle();
  594. };
  595. #endif
  596. class MediaPlayerScreen : public BaseScreen, public UncachedScreen {
  597. private:
  598. typedef int16_t media_streamer_func_t(void *obj, void *buff, size_t bytes);
  599. public:
  600. static bool playCardMedia();
  601. static bool playBootMedia();
  602. static void onEntry();
  603. static void onRedraw(draw_mode_t);
  604. static void playStream(void *obj, media_streamer_func_t*);
  605. };
  606. #if ENABLED(TOUCH_UI_LANGUAGE_MENU)
  607. class LanguageMenu : public BaseScreen, public UncachedScreen {
  608. public:
  609. static void onRedraw(draw_mode_t);
  610. static bool onTouchEnd(uint8_t tag);
  611. };
  612. #endif