My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. #define ROUND(val) uint16_t((val)+0.5)
  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. };
  131. class AlertDialogBox : public DialogBoxBaseClass, public CachedScreen<ALERT_BOX_CACHE,ALERT_BOX_DL_SIZE> {
  132. public:
  133. static void onEntry();
  134. static void onRedraw(draw_mode_t);
  135. template<typename T> static void show(T);
  136. template<typename T> static void showError(T);
  137. static void hide();
  138. };
  139. class RestoreFailsafeDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  140. public:
  141. static void onRedraw(draw_mode_t);
  142. static bool onTouchEnd(uint8_t tag);
  143. };
  144. class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  145. private:
  146. static bool needs_save;
  147. public:
  148. static void onRedraw(draw_mode_t);
  149. static bool onTouchEnd(uint8_t tag);
  150. static void promptToSaveSettings();
  151. static void settingsChanged() {needs_save = true;}
  152. };
  153. class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  154. public:
  155. static void onRedraw(draw_mode_t);
  156. static bool onTouchEnd(uint8_t tag);
  157. };
  158. #if ENABLED(CALIBRATION_GCODE)
  159. class ConfirmAutoCalibrationDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  160. public:
  161. static void onRedraw(draw_mode_t);
  162. static bool onTouchEnd(uint8_t tag);
  163. };
  164. #endif
  165. class ConfirmUserRequestAlertBox : public AlertDialogBox {
  166. public:
  167. static void onRedraw(draw_mode_t);
  168. static bool onTouchEnd(uint8_t);
  169. static void hide();
  170. static void show(const char*);
  171. };
  172. class SpinnerDialogBox : public DialogBoxBaseClass, public CachedScreen<SPINNER_CACHE,SPINNER_DL_SIZE> {
  173. public:
  174. static void onRedraw(draw_mode_t);
  175. static void onIdle();
  176. static void show(const progmem_str);
  177. static void hide();
  178. static void enqueueAndWait_P(const progmem_str commands);
  179. static void enqueueAndWait_P(const progmem_str message, const progmem_str commands);
  180. };
  181. #ifndef LULZBOT_USE_BIOPRINTER_UI
  182. class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,STATUS_SCREEN_DL_SIZE> {
  183. private:
  184. static void draw_axis_position(draw_mode_t);
  185. static void draw_temperature(draw_mode_t);
  186. static void draw_progress(draw_mode_t);
  187. static void draw_interaction_buttons(draw_mode_t);
  188. static void draw_status_message(draw_mode_t, const char * const);
  189. public:
  190. static void loadBitmaps();
  191. static void setStatusMessage(const char *);
  192. static void setStatusMessage(progmem_str);
  193. static void onRedraw(draw_mode_t);
  194. static void onStartup();
  195. static void onEntry();
  196. static void onIdle();
  197. static bool onTouchEnd(uint8_t tag);
  198. };
  199. #else
  200. class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE> {
  201. private:
  202. static float increment;
  203. static bool jog_xy;
  204. static bool fine_motion;
  205. static void draw_temperature(draw_mode_t what);
  206. static void draw_syringe(draw_mode_t what);
  207. static void draw_arrows(draw_mode_t what);
  208. static void draw_overlay_icons(draw_mode_t what);
  209. static void draw_fine_motion(draw_mode_t what);
  210. static void draw_buttons(draw_mode_t what);
  211. public:
  212. static void unlockMotors();
  213. static void setStatusMessage(const char *);
  214. static void setStatusMessage(progmem_str);
  215. static void onStartup();
  216. static void onRedraw(draw_mode_t);
  217. static bool onTouchStart(uint8_t tag);
  218. static bool onTouchHeld(uint8_t tag);
  219. static bool onTouchEnd(uint8_t tag);
  220. static void onIdle();
  221. };
  222. class BioPrintingDialogBox : public BaseScreen, public CachedScreen<PRINTING_SCREEN_CACHE,PRINTING_SCREEN_DL_SIZE> {
  223. private:
  224. static void draw_status_message(draw_mode_t, const char * const);
  225. static void draw_progress(draw_mode_t);
  226. static void draw_time_remaining(draw_mode_t);
  227. static void draw_interaction_buttons(draw_mode_t);
  228. public:
  229. static void onRedraw(draw_mode_t);
  230. static void show();
  231. static void setStatusMessage(const char *);
  232. static void setStatusMessage(progmem_str);
  233. static void onIdle();
  234. static bool onTouchEnd(uint8_t tag);
  235. };
  236. class BioConfirmHomeXYZ : public DialogBoxBaseClass, public UncachedScreen {
  237. public:
  238. static void onRedraw(draw_mode_t);
  239. static bool onTouchEnd(uint8_t tag);
  240. };
  241. class BioConfirmHomeE : public DialogBoxBaseClass, public UncachedScreen {
  242. public:
  243. static void onRedraw(draw_mode_t);
  244. static bool onTouchEnd(uint8_t tag);
  245. };
  246. #endif
  247. class MainMenu : public BaseScreen, public CachedScreen<MENU_SCREEN_CACHE> {
  248. public:
  249. static void onRedraw(draw_mode_t);
  250. static bool onTouchEnd(uint8_t tag);
  251. };
  252. class TuneMenu : public BaseScreen, public CachedScreen<TUNE_SCREEN_CACHE> {
  253. public:
  254. static void onRedraw(draw_mode_t);
  255. static bool onTouchEnd(uint8_t tag);
  256. };
  257. class TouchCalibrationScreen : public BaseScreen, public UncachedScreen {
  258. public:
  259. static void onRefresh();
  260. static void onEntry();
  261. static void onRedraw(draw_mode_t);
  262. static void onIdle();
  263. };
  264. class TouchRegistersScreen : public BaseScreen, public UncachedScreen {
  265. public:
  266. static void onRedraw(draw_mode_t);
  267. static bool onTouchEnd(uint8_t tag);
  268. };
  269. class AdvancedSettingsMenu : public BaseScreen, public CachedScreen<ADVANCED_SETTINGS_SCREEN_CACHE> {
  270. public:
  271. static void onRedraw(draw_mode_t);
  272. static bool onTouchEnd(uint8_t tag);
  273. };
  274. class ChangeFilamentScreen : public BaseScreen, public CachedScreen<CHANGE_FILAMENT_SCREEN_CACHE> {
  275. private:
  276. static uint8_t getSoftenTemp();
  277. static ExtUI::extruder_t getExtruder();
  278. static void drawTempGradient(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  279. static uint32_t getTempColor(uint32_t temp);
  280. public:
  281. static void onEntry();
  282. static void onExit();
  283. static void onRedraw(draw_mode_t);
  284. static bool onTouchStart(uint8_t tag);
  285. static bool onTouchEnd(uint8_t tag);
  286. static bool onTouchHeld(uint8_t tag);
  287. static void onIdle();
  288. };
  289. class BaseNumericAdjustmentScreen : public BaseScreen {
  290. public:
  291. enum precision_default_t {
  292. DEFAULT_LOWEST,
  293. DEFAULT_MIDRANGE,
  294. DEFAULT_HIGHEST
  295. };
  296. protected:
  297. class widgets_t {
  298. private:
  299. draw_mode_t _what;
  300. uint8_t _line;
  301. uint32_t _color;
  302. uint8_t _decimals;
  303. progmem_str _units;
  304. protected:
  305. void _draw_increment_btn(uint8_t line, const uint8_t tag);
  306. public:
  307. widgets_t(draw_mode_t);
  308. widgets_t &color(uint32_t color) {_color = color; return *this;}
  309. widgets_t &units(progmem_str units) {_units = units; return *this;}
  310. widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;}
  311. widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST);
  312. void heading (progmem_str label);
  313. void adjuster_sram_val (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  314. void adjuster (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  315. void adjuster (uint8_t tag, progmem_str label, float value=0, bool is_enabled = true);
  316. void button (uint8_t tag, progmem_str label, bool is_enabled = true);
  317. void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  318. void two_buttons (uint8_t tag1, progmem_str label1,
  319. uint8_t tag2, progmem_str label2, bool is_enabled = true);
  320. void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true);
  321. void home_buttons (uint8_t tag);
  322. void increments ();
  323. };
  324. static float getIncrement();
  325. public:
  326. static void onEntry();
  327. static bool onTouchEnd(uint8_t tag);
  328. };
  329. class MoveAxisScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MOVE_AXIS_SCREEN_CACHE> {
  330. private:
  331. static float getManualFeedrate(uint8_t axis, float increment_mm);
  332. public:
  333. static void setManualFeedrate(ExtUI::axis_t, float increment_mm);
  334. static void setManualFeedrate(ExtUI::extruder_t, float increment_mm);
  335. static void onEntry();
  336. static void onRedraw(draw_mode_t);
  337. static bool onTouchHeld(uint8_t tag);
  338. static void onIdle();
  339. };
  340. class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPS_SCREEN_CACHE> {
  341. public:
  342. static void onRedraw(draw_mode_t);
  343. static bool onTouchHeld(uint8_t tag);
  344. };
  345. #if HAS_TRINAMIC
  346. class StepperCurrentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_CURRENT_SCREEN_CACHE> {
  347. public:
  348. static void onRedraw(draw_mode_t);
  349. static bool onTouchHeld(uint8_t tag);
  350. };
  351. class StepperBumpSensitivityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE> {
  352. public:
  353. static void onRedraw(draw_mode_t);
  354. static bool onTouchHeld(uint8_t tag);
  355. };
  356. #endif
  357. #if HAS_BED_PROBE
  358. class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ZOFFSET_SCREEN_CACHE> {
  359. public:
  360. static void onRedraw(draw_mode_t);
  361. static bool onTouchHeld(uint8_t tag);
  362. };
  363. #endif
  364. #if HOTENDS > 1
  365. class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<NOZZLE_OFFSET_SCREEN_CACHE> {
  366. public:
  367. static void onEntry();
  368. static void onRedraw(draw_mode_t);
  369. static bool onTouchHeld(uint8_t tag);
  370. };
  371. #endif
  372. #if ENABLED(BABYSTEPPING)
  373. class NudgeNozzleScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ADJUST_OFFSETS_SCREEN_CACHE> {
  374. public:
  375. static void onEntry();
  376. static void onRedraw(draw_mode_t);
  377. static bool onTouchEnd(uint8_t tag);
  378. static bool onTouchHeld(uint8_t tag);
  379. static void onIdle();
  380. };
  381. #endif
  382. #if ENABLED(BACKLASH_GCODE)
  383. class BacklashCompensationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<BACKLASH_COMPENSATION_SCREEN_CACHE> {
  384. public:
  385. static void onRedraw(draw_mode_t);
  386. static bool onTouchHeld(uint8_t tag);
  387. };
  388. #endif
  389. class FeedratePercentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_FEEDRATE_SCREEN_CACHE> {
  390. public:
  391. static void onRedraw(draw_mode_t);
  392. static bool onTouchHeld(uint8_t tag);
  393. };
  394. class MaxVelocityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_VELOCITY_SCREEN_CACHE> {
  395. public:
  396. static void onRedraw(draw_mode_t);
  397. static bool onTouchHeld(uint8_t tag);
  398. };
  399. class MaxAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_ACCELERATION_SCREEN_CACHE> {
  400. public:
  401. static void onRedraw(draw_mode_t);
  402. static bool onTouchHeld(uint8_t tag);
  403. };
  404. class DefaultAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<DEFAULT_ACCELERATION_SCREEN_CACHE> {
  405. public:
  406. static void onRedraw(draw_mode_t);
  407. static bool onTouchHeld(uint8_t tag);
  408. };
  409. #if ENABLED(JUNCTION_DEVIATION)
  410. class JunctionDeviationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<JUNC_DEV_SCREEN_CACHE> {
  411. public:
  412. static void onRedraw(draw_mode_t);
  413. static bool onTouchHeld(uint8_t tag);
  414. };
  415. #else
  416. class JerkScreen : public BaseNumericAdjustmentScreen, public CachedScreen<JERK_SCREEN_CACHE> {
  417. public:
  418. static void onRedraw(draw_mode_t);
  419. static bool onTouchHeld(uint8_t tag);
  420. };
  421. #endif
  422. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  423. class FilamentMenu : public BaseNumericAdjustmentScreen, public CachedScreen<FILAMENT_MENU_CACHE> {
  424. public:
  425. static void onRedraw(draw_mode_t);
  426. static bool onTouchEnd(uint8_t tag);
  427. };
  428. #endif
  429. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  430. class FilamentRunoutScreen : public BaseNumericAdjustmentScreen, public CachedScreen<FILAMENT_RUNOUT_SCREEN_CACHE> {
  431. public:
  432. static void onRedraw(draw_mode_t);
  433. static bool onTouchHeld(uint8_t tag);
  434. };
  435. #endif
  436. #if ENABLED(LIN_ADVANCE)
  437. class LinearAdvanceScreen : public BaseNumericAdjustmentScreen, public CachedScreen<LINEAR_ADVANCE_SCREEN_CACHE> {
  438. public:
  439. static void onRedraw(draw_mode_t);
  440. static bool onTouchHeld(uint8_t tag);
  441. };
  442. #endif
  443. class TemperatureScreen : public BaseNumericAdjustmentScreen, public CachedScreen<TEMPERATURE_SCREEN_CACHE> {
  444. public:
  445. static void onRedraw(draw_mode_t);
  446. static bool onTouchHeld(uint8_t tag);
  447. };
  448. class InterfaceSoundsScreen : public BaseScreen, public CachedScreen<INTERFACE_SOUNDS_SCREEN_CACHE> {
  449. public:
  450. enum event_t {
  451. PRINTING_STARTED = 0,
  452. PRINTING_FINISHED = 1,
  453. PRINTING_FAILED = 2,
  454. NUM_EVENTS
  455. };
  456. private:
  457. friend class InterfaceSettingsScreen;
  458. static uint8_t event_sounds[NUM_EVENTS];
  459. static const char* getSoundSelection(event_t);
  460. static void toggleSoundSelection(event_t);
  461. static void setSoundSelection(event_t, const FTDI::SoundPlayer::sound_t*);
  462. public:
  463. static void playEventSound(event_t, FTDI::play_mode_t = FTDI::PLAY_ASYNCHRONOUS);
  464. static void defaultSettings();
  465. static void onEntry();
  466. static void onRedraw(draw_mode_t);
  467. static bool onTouchStart(uint8_t tag);
  468. static bool onTouchEnd(uint8_t tag);
  469. static void onIdle();
  470. };
  471. class InterfaceSettingsScreen : public BaseScreen, public CachedScreen<INTERFACE_SETTINGS_SCREEN_CACHE> {
  472. private:
  473. struct persistent_data_t {
  474. uint32_t touch_transform_a;
  475. uint32_t touch_transform_b;
  476. uint32_t touch_transform_c;
  477. uint32_t touch_transform_d;
  478. uint32_t touch_transform_e;
  479. uint32_t touch_transform_f;
  480. uint16_t passcode;
  481. uint8_t display_brightness;
  482. int8_t display_h_offset_adj;
  483. int8_t display_v_offset_adj;
  484. uint8_t sound_volume;
  485. uint8_t bit_flags;
  486. uint8_t event_sounds[InterfaceSoundsScreen::NUM_EVENTS];
  487. };
  488. public:
  489. #ifdef LULZBOT_EEPROM_BACKUP_SIZE
  490. static bool backupEEPROM();
  491. #endif
  492. static void saveSettings(char *);
  493. static void loadSettings(const char *);
  494. static void defaultSettings();
  495. static void failSafeSettings();
  496. static void onStartup();
  497. static void onEntry();
  498. static void onRedraw(draw_mode_t);
  499. static bool onTouchStart(uint8_t tag);
  500. static bool onTouchEnd(uint8_t tag);
  501. static void onIdle();
  502. };
  503. class LockScreen : public BaseScreen, public CachedScreen<LOCK_SCREEN_CACHE> {
  504. private:
  505. friend InterfaceSettingsScreen;
  506. static uint16_t passcode;
  507. static char & message_style();
  508. static uint16_t compute_checksum();
  509. static void onPasscodeEntered();
  510. public:
  511. static bool is_enabled();
  512. static void check_passcode();
  513. static void enable();
  514. static void disable();
  515. static void set_hash(uint16_t pass) {passcode = pass;};
  516. static uint16_t get_hash() {return passcode;};
  517. static void onEntry();
  518. static void onRedraw(draw_mode_t);
  519. static bool onTouchEnd(uint8_t tag);
  520. };
  521. class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, FILE_SCREEN_DL_SIZE> {
  522. private:
  523. #ifdef TOUCH_UI_PORTRAIT
  524. static constexpr uint8_t header_h = 2;
  525. static constexpr uint8_t footer_h = 2;
  526. static constexpr uint8_t files_per_page = 11;
  527. #else
  528. static constexpr uint8_t header_h = 1;
  529. static constexpr uint8_t footer_h = 1;
  530. static constexpr uint8_t files_per_page = 6;
  531. #endif
  532. static uint8_t getTagForLine(uint8_t line) {return line + 2;}
  533. static uint8_t getLineForTag(uint8_t tag) {return tag - 2;}
  534. static uint16_t getFileForTag(uint8_t tag);
  535. static const char *getSelectedShortFilename();
  536. static const char *getSelectedLongFilename();
  537. static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted);
  538. static void drawFileList();
  539. static void drawHeader();
  540. static void drawFooter();
  541. static void drawSelectedFile();
  542. static void gotoPage(uint8_t);
  543. public:
  544. static void onEntry();
  545. static void onRedraw(draw_mode_t);
  546. static bool onTouchEnd(uint8_t tag);
  547. static void onIdle();
  548. };
  549. class EndstopStatesScreen : public BaseScreen, public UncachedScreen {
  550. public:
  551. static void onEntry();
  552. static void onExit();
  553. static void onRedraw(draw_mode_t);
  554. static bool onTouchEnd(uint8_t tag);
  555. static void onIdle();
  556. };
  557. class DisplayTuningScreen : public BaseNumericAdjustmentScreen, public CachedScreen<DISPLAY_TIMINGS_SCREEN_CACHE> {
  558. public:
  559. static void onRedraw(draw_mode_t);
  560. static bool onTouchHeld(uint8_t tag);
  561. };
  562. #if ENABLED(DEVELOPER_SCREENS)
  563. class DeveloperMenu : public BaseScreen, public UncachedScreen {
  564. public:
  565. static void onRedraw(draw_mode_t);
  566. static bool onTouchEnd(uint8_t tag);
  567. };
  568. class ConfirmEraseFlashDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  569. public:
  570. static void onRedraw(draw_mode_t);
  571. static bool onTouchEnd(uint8_t tag);
  572. };
  573. class WidgetsScreen : public BaseScreen, public UncachedScreen {
  574. public:
  575. static void onEntry();
  576. static void onRedraw(draw_mode_t);
  577. static bool onTouchStart(uint8_t tag);
  578. static void onIdle();
  579. };
  580. class StressTestScreen : public BaseScreen, public UncachedScreen {
  581. private:
  582. static void drawDots(uint16_t x, uint16_t y, uint16_t h, uint16_t v);
  583. static bool watchDogTestNow();
  584. static void recursiveLockup();
  585. static void iterativeLockup();
  586. static void runTestOnBootup(bool enable);
  587. public:
  588. static void startupCheck();
  589. static void onEntry();
  590. static void onRedraw(draw_mode_t);
  591. static bool onTouchEnd(uint8_t tag);
  592. static void onIdle();
  593. };
  594. #endif
  595. class MediaPlayerScreen : public BaseScreen, public UncachedScreen {
  596. private:
  597. typedef int16_t media_streamer_func_t(void *obj, void *buff, size_t bytes);
  598. public:
  599. static bool playCardMedia();
  600. static bool playBootMedia();
  601. static void onEntry();
  602. static void onRedraw(draw_mode_t);
  603. static void playStream(void *obj, media_streamer_func_t*);
  604. };
  605. #if ENABLED(TOUCH_UI_LANGUAGE_MENU)
  606. class LanguageMenu : public BaseScreen, public UncachedScreen {
  607. public:
  608. static void onRedraw(draw_mode_t);
  609. static bool onTouchEnd(uint8_t tag);
  610. };
  611. #endif