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.

screens.h 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  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: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #pragma once
  22. #include "../ftdi_eve_lib/ftdi_eve_lib.h"
  23. #include "../language/language.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. ALERT_BOX_CACHE,
  36. SPINNER_CACHE,
  37. ADVANCED_SETTINGS_SCREEN_CACHE,
  38. MOVE_AXIS_SCREEN_CACHE,
  39. TEMPERATURE_SCREEN_CACHE,
  40. STEPS_SCREEN_CACHE,
  41. MAX_FEEDRATE_SCREEN_CACHE,
  42. MAX_VELOCITY_SCREEN_CACHE,
  43. MAX_ACCELERATION_SCREEN_CACHE,
  44. DEFAULT_ACCELERATION_SCREEN_CACHE,
  45. #if HAS_LEVELING
  46. LEVELING_SCREEN_CACHE,
  47. #if HAS_BED_PROBE
  48. ZOFFSET_SCREEN_CACHE,
  49. #endif
  50. #if HAS_MESH
  51. BED_MESH_SCREEN_CACHE,
  52. #endif
  53. #endif
  54. #if ENABLED(BABYSTEPPING)
  55. ADJUST_OFFSETS_SCREEN_CACHE,
  56. #endif
  57. #if HAS_TRINAMIC_CONFIG
  58. STEPPER_CURRENT_SCREEN_CACHE,
  59. STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE,
  60. #endif
  61. #if HAS_MULTI_HOTEND
  62. NOZZLE_OFFSET_SCREEN_CACHE,
  63. #endif
  64. #if ENABLED(BACKLASH_GCODE)
  65. BACKLASH_COMPENSATION_SCREEN_CACHE,
  66. #endif
  67. #if HAS_JUNCTION_DEVIATION
  68. JUNC_DEV_SCREEN_CACHE,
  69. #else
  70. JERK_SCREEN_CACHE,
  71. #endif
  72. #if ENABLED(CASE_LIGHT_ENABLE)
  73. CASE_LIGHT_SCREEN_CACHE,
  74. #endif
  75. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  76. FILAMENT_MENU_CACHE,
  77. #endif
  78. #if ENABLED(LIN_ADVANCE)
  79. LINEAR_ADVANCE_SCREEN_CACHE,
  80. #endif
  81. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  82. FILAMENT_RUNOUT_SCREEN_CACHE,
  83. #endif
  84. #if ENABLED(TOUCH_UI_LULZBOT_BIO)
  85. PRINTING_SCREEN_CACHE,
  86. #endif
  87. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  88. PREHEAT_MENU_CACHE,
  89. PREHEAT_TIMER_SCREEN_CACHE,
  90. #endif
  91. #if ENABLED(SDSUPPORT)
  92. FILES_SCREEN_CACHE,
  93. #endif
  94. CHANGE_FILAMENT_SCREEN_CACHE,
  95. INTERFACE_SETTINGS_SCREEN_CACHE,
  96. INTERFACE_SOUNDS_SCREEN_CACHE,
  97. LOCK_SCREEN_CACHE,
  98. DISPLAY_TIMINGS_SCREEN_CACHE
  99. };
  100. // To save MCU RAM, the status message is "baked" in to the status screen
  101. // cache, so we reserve a large chunk of memory for the DL cache
  102. #define STATUS_SCREEN_DL_SIZE 2048
  103. #define ALERT_BOX_DL_SIZE 3072
  104. #define SPINNER_DL_SIZE 3072
  105. #define FILE_SCREEN_DL_SIZE 4160
  106. #define PRINTING_SCREEN_DL_SIZE 2048
  107. /************************* MENU SCREEN DECLARATIONS *************************/
  108. class BaseScreen : public UIScreen {
  109. protected:
  110. #if LCD_TIMEOUT_TO_STATUS > 0
  111. static uint32_t last_interaction;
  112. #endif
  113. static bool buttonIsPressed(uint8_t tag);
  114. public:
  115. static bool buttonStyleCallback(CommandProcessor &, uint8_t, uint8_t &, uint16_t &, bool);
  116. static void reset_menu_timeout();
  117. static void onEntry();
  118. static void onIdle();
  119. };
  120. class BootScreen : public BaseScreen, public UncachedScreen {
  121. private:
  122. static void showSplashScreen();
  123. public:
  124. static void onRedraw(draw_mode_t);
  125. static void onIdle();
  126. };
  127. class AboutScreen : public BaseScreen, public UncachedScreen {
  128. public:
  129. static void onEntry();
  130. static void onRedraw(draw_mode_t);
  131. static bool onTouchEnd(uint8_t tag);
  132. };
  133. #if ENABLED(PRINTCOUNTER)
  134. class StatisticsScreen : public BaseScreen, public UncachedScreen {
  135. public:
  136. static void onRedraw(draw_mode_t);
  137. static bool onTouchEnd(uint8_t tag);
  138. };
  139. #endif
  140. class KillScreen {
  141. // The KillScreen is behaves differently than the
  142. // others, so we do not bother extending UIScreen.
  143. public:
  144. static void show(const char*);
  145. };
  146. class DialogBoxBaseClass : public BaseScreen {
  147. protected:
  148. template<typename T> static void drawMessage(const T, int16_t font = 0);
  149. static void drawYesNoButtons(uint8_t default_btn = 0);
  150. static void drawOkayButton();
  151. static void drawSpinner();
  152. static void drawButton(const progmem_str);
  153. static void onRedraw(draw_mode_t) {};
  154. public:
  155. static bool onTouchEnd(uint8_t tag);
  156. static void onIdle();
  157. };
  158. class AlertDialogBox : public DialogBoxBaseClass, public CachedScreen<ALERT_BOX_CACHE,ALERT_BOX_DL_SIZE> {
  159. public:
  160. static void onEntry();
  161. static void onRedraw(draw_mode_t);
  162. template<typename T> static void show(T);
  163. template<typename T> static void showError(T);
  164. static void hide();
  165. };
  166. class RestoreFailsafeDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  167. public:
  168. static void onRedraw(draw_mode_t);
  169. static bool onTouchEnd(uint8_t tag);
  170. };
  171. class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  172. private:
  173. static bool needs_save;
  174. public:
  175. static void onRedraw(draw_mode_t);
  176. static bool onTouchEnd(uint8_t tag);
  177. static void promptToSaveSettings();
  178. static void settingsChanged() {needs_save = true;}
  179. };
  180. class ConfirmStartPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  181. private:
  182. inline static const char *getShortFilename() {return getFilename(false);}
  183. inline static const char *getLongFilename() {return getFilename(true);}
  184. static const char *getFilename(bool longName);
  185. public:
  186. static void onRedraw(draw_mode_t);
  187. static bool onTouchEnd(uint8_t);
  188. static void show(uint8_t file_index);
  189. };
  190. class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  191. public:
  192. static void onRedraw(draw_mode_t);
  193. static bool onTouchEnd(uint8_t tag);
  194. };
  195. #if ENABLED(CALIBRATION_GCODE)
  196. class ConfirmAutoCalibrationDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  197. public:
  198. static void onRedraw(draw_mode_t);
  199. static bool onTouchEnd(uint8_t tag);
  200. };
  201. #endif
  202. class ConfirmUserRequestAlertBox : public AlertDialogBox {
  203. public:
  204. static void onRedraw(draw_mode_t);
  205. static bool onTouchEnd(uint8_t);
  206. static void hide();
  207. static void show(const char*);
  208. };
  209. class SpinnerDialogBox : public DialogBoxBaseClass, public CachedScreen<SPINNER_CACHE,SPINNER_DL_SIZE> {
  210. public:
  211. static void onRedraw(draw_mode_t);
  212. static void onIdle();
  213. static void show(const progmem_str);
  214. static void hide();
  215. static void enqueueAndWait_P(const progmem_str commands);
  216. static void enqueueAndWait_P(const progmem_str message, const progmem_str commands);
  217. };
  218. #if NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS)
  219. class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,STATUS_SCREEN_DL_SIZE> {
  220. private:
  221. static void draw_axis_position(draw_mode_t);
  222. static void draw_temperature(draw_mode_t);
  223. static void draw_progress(draw_mode_t);
  224. static void draw_interaction_buttons(draw_mode_t);
  225. static void draw_status_message(draw_mode_t, const char * const);
  226. public:
  227. static void loadBitmaps();
  228. static void setStatusMessage(const char *);
  229. static void setStatusMessage(progmem_str);
  230. static void onRedraw(draw_mode_t);
  231. static void onStartup();
  232. static void onEntry();
  233. static void onIdle();
  234. static bool onTouchEnd(uint8_t tag);
  235. };
  236. #else
  237. class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE> {
  238. private:
  239. static float increment;
  240. static bool jog_xy;
  241. static bool fine_motion;
  242. static void draw_temperature(draw_mode_t what);
  243. static void draw_syringe(draw_mode_t what);
  244. static void draw_arrows(draw_mode_t what);
  245. static void draw_overlay_icons(draw_mode_t what);
  246. static void draw_fine_motion(draw_mode_t what);
  247. static void draw_buttons(draw_mode_t what);
  248. public:
  249. static void loadBitmaps();
  250. static void unlockMotors();
  251. static void setStatusMessage(const char *);
  252. static void setStatusMessage(progmem_str);
  253. static void onRedraw(draw_mode_t);
  254. static bool onTouchStart(uint8_t tag);
  255. static bool onTouchHeld(uint8_t tag);
  256. static bool onTouchEnd(uint8_t tag);
  257. static void onIdle();
  258. };
  259. #endif
  260. #if ENABLED(TOUCH_UI_LULZBOT_BIO)
  261. class BioPrintingDialogBox : public BaseScreen, public CachedScreen<PRINTING_SCREEN_CACHE,PRINTING_SCREEN_DL_SIZE> {
  262. private:
  263. static void draw_status_message(draw_mode_t, const char * const);
  264. static void draw_progress(draw_mode_t);
  265. static void draw_time_remaining(draw_mode_t);
  266. static void draw_interaction_buttons(draw_mode_t);
  267. public:
  268. static void onRedraw(draw_mode_t);
  269. static void show();
  270. static void setStatusMessage(const char *);
  271. static void setStatusMessage(progmem_str);
  272. static void onIdle();
  273. static bool onTouchEnd(uint8_t tag);
  274. };
  275. class BioConfirmHomeXYZ : public DialogBoxBaseClass, public UncachedScreen {
  276. public:
  277. static void onRedraw(draw_mode_t);
  278. static bool onTouchEnd(uint8_t tag);
  279. };
  280. class BioConfirmHomeE : public DialogBoxBaseClass, public UncachedScreen {
  281. public:
  282. static void onRedraw(draw_mode_t);
  283. static bool onTouchEnd(uint8_t tag);
  284. };
  285. #endif
  286. #if ENABLED(TOUCH_UI_COCOA_PRESS)
  287. class PreheatMenu : public BaseScreen, public CachedScreen<PREHEAT_MENU_CACHE> {
  288. public:
  289. static void onRedraw(draw_mode_t);
  290. static bool onTouchEnd(uint8_t tag);
  291. };
  292. class PreheatTimerScreen : public BaseScreen, public CachedScreen<PREHEAT_TIMER_SCREEN_CACHE> {
  293. private:
  294. static uint16_t secondsRemaining();
  295. static void draw_message(draw_mode_t);
  296. static void draw_time_remaining(draw_mode_t);
  297. static void draw_interaction_buttons(draw_mode_t);
  298. public:
  299. static void onRedraw(draw_mode_t);
  300. static void onEntry();
  301. static void onIdle();
  302. static bool onTouchEnd(uint8_t tag);
  303. };
  304. #endif
  305. class MainMenu : public BaseScreen, public CachedScreen<MENU_SCREEN_CACHE> {
  306. public:
  307. static void onRedraw(draw_mode_t);
  308. static bool onTouchEnd(uint8_t tag);
  309. };
  310. class TuneMenu : public BaseScreen, public CachedScreen<TUNE_SCREEN_CACHE> {
  311. public:
  312. static void onRedraw(draw_mode_t);
  313. static bool onTouchEnd(uint8_t tag);
  314. };
  315. class TouchCalibrationScreen : public BaseScreen, public UncachedScreen {
  316. public:
  317. static void onRefresh();
  318. static void onEntry();
  319. static void onRedraw(draw_mode_t);
  320. static void onIdle();
  321. };
  322. class TouchRegistersScreen : public BaseScreen, public UncachedScreen {
  323. public:
  324. static void onRedraw(draw_mode_t);
  325. static bool onTouchEnd(uint8_t tag);
  326. };
  327. class AdvancedSettingsMenu : public BaseScreen, public CachedScreen<ADVANCED_SETTINGS_SCREEN_CACHE> {
  328. public:
  329. static void onRedraw(draw_mode_t);
  330. static bool onTouchEnd(uint8_t tag);
  331. };
  332. class ChangeFilamentScreen : public BaseScreen, public CachedScreen<CHANGE_FILAMENT_SCREEN_CACHE> {
  333. private:
  334. static uint8_t getSoftenTemp();
  335. static ExtUI::extruder_t getExtruder();
  336. static void drawTempGradient(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
  337. static uint32_t getTempColor(uint32_t temp);
  338. static void doPurge();
  339. public:
  340. static void onEntry();
  341. static void onExit();
  342. static void onRedraw(draw_mode_t);
  343. static bool onTouchStart(uint8_t tag);
  344. static bool onTouchEnd(uint8_t tag);
  345. static bool onTouchHeld(uint8_t tag);
  346. static void onIdle();
  347. };
  348. class BaseNumericAdjustmentScreen : public BaseScreen {
  349. public:
  350. enum precision_default_t {
  351. DEFAULT_LOWEST,
  352. DEFAULT_MIDRANGE,
  353. DEFAULT_HIGHEST
  354. };
  355. protected:
  356. class widgets_t {
  357. private:
  358. draw_mode_t _what;
  359. uint8_t _line;
  360. uint32_t _color;
  361. uint8_t _decimals;
  362. progmem_str _units;
  363. enum style_t {
  364. BTN_NORMAL,
  365. BTN_ACTION,
  366. BTN_TOGGLE,
  367. BTN_DISABLED,
  368. TEXT_AREA,
  369. TEXT_LABEL
  370. } _style;
  371. protected:
  372. void _draw_increment_btn(CommandProcessor &, uint8_t line, const uint8_t tag);
  373. void _button(CommandProcessor &, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, progmem_str, bool enabled = true, bool highlight = false);
  374. void _button_style(CommandProcessor &cmd, style_t style);
  375. public:
  376. widgets_t(draw_mode_t);
  377. widgets_t &color(uint32_t color) {_color = color; return *this;}
  378. widgets_t &units(progmem_str units) {_units = units; return *this;}
  379. widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;}
  380. widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST);
  381. void heading (progmem_str label);
  382. void adjuster_sram_val (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  383. void adjuster (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  384. void adjuster (uint8_t tag, progmem_str label, float value=0, bool is_enabled = true);
  385. void button (uint8_t tag, progmem_str label, bool is_enabled = true);
  386. void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
  387. void two_buttons (uint8_t tag1, progmem_str label1,
  388. uint8_t tag2, progmem_str label2, bool is_enabled = true);
  389. void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true);
  390. void home_buttons (uint8_t tag);
  391. void increments ();
  392. };
  393. static float getIncrement();
  394. public:
  395. static void onEntry();
  396. static bool onTouchEnd(uint8_t tag);
  397. };
  398. class MoveAxisScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MOVE_AXIS_SCREEN_CACHE> {
  399. private:
  400. static float getManualFeedrate(uint8_t axis, float increment_mm);
  401. public:
  402. static void setManualFeedrate(ExtUI::axis_t, float increment_mm);
  403. static void setManualFeedrate(ExtUI::extruder_t, float increment_mm);
  404. static void onEntry();
  405. static void onRedraw(draw_mode_t);
  406. static bool onTouchHeld(uint8_t tag);
  407. static void onIdle();
  408. };
  409. class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPS_SCREEN_CACHE> {
  410. public:
  411. static void onRedraw(draw_mode_t);
  412. static bool onTouchHeld(uint8_t tag);
  413. };
  414. #if HAS_TRINAMIC_CONFIG
  415. class StepperCurrentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_CURRENT_SCREEN_CACHE> {
  416. public:
  417. static void onRedraw(draw_mode_t);
  418. static bool onTouchHeld(uint8_t tag);
  419. };
  420. class StepperBumpSensitivityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE> {
  421. public:
  422. static void onRedraw(draw_mode_t);
  423. static bool onTouchHeld(uint8_t tag);
  424. };
  425. #endif
  426. #if HAS_MULTI_HOTEND
  427. class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<NOZZLE_OFFSET_SCREEN_CACHE> {
  428. public:
  429. static void onEntry();
  430. static void onRedraw(draw_mode_t);
  431. static bool onTouchHeld(uint8_t tag);
  432. };
  433. #endif
  434. #if HAS_LEVELING
  435. class LevelingMenu : public BaseScreen, public CachedScreen<LEVELING_SCREEN_CACHE> {
  436. public:
  437. static void onRedraw(draw_mode_t);
  438. static bool onTouchEnd(uint8_t tag);
  439. };
  440. #if HAS_BED_PROBE
  441. class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ZOFFSET_SCREEN_CACHE> {
  442. public:
  443. static void onRedraw(draw_mode_t);
  444. static bool onTouchHeld(uint8_t tag);
  445. };
  446. #endif
  447. #if HAS_MESH
  448. class BedMeshScreen : public BaseScreen, public CachedScreen<BED_MESH_SCREEN_CACHE> {
  449. private:
  450. enum MeshOpts {
  451. USE_POINTS = 0x01,
  452. USE_COLORS = 0x02,
  453. USE_TAGS = 0x04,
  454. USE_HIGHLIGHT = 0x08,
  455. USE_AUTOSCALE = 0x10
  456. };
  457. static uint8_t pointToTag(uint8_t x, uint8_t y);
  458. static bool tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y);
  459. static float getHightlightedValue();
  460. static void drawHighlightedPointValue();
  461. static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1);
  462. public:
  463. static void onMeshUpdate(const int8_t x, const int8_t y, const float val);
  464. static void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t);
  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 startMeshProbe();
  470. };
  471. #endif
  472. #endif
  473. #if ENABLED(BABYSTEPPING)
  474. class NudgeNozzleScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ADJUST_OFFSETS_SCREEN_CACHE> {
  475. public:
  476. static void onEntry();
  477. static void onRedraw(draw_mode_t);
  478. static bool onTouchEnd(uint8_t tag);
  479. static bool onTouchHeld(uint8_t tag);
  480. static void onIdle();
  481. };
  482. #endif
  483. #if ENABLED(BACKLASH_GCODE)
  484. class BacklashCompensationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<BACKLASH_COMPENSATION_SCREEN_CACHE> {
  485. public:
  486. static void onRedraw(draw_mode_t);
  487. static bool onTouchHeld(uint8_t tag);
  488. };
  489. #endif
  490. class FeedratePercentScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_FEEDRATE_SCREEN_CACHE> {
  491. public:
  492. static void onRedraw(draw_mode_t);
  493. static bool onTouchHeld(uint8_t tag);
  494. };
  495. class MaxVelocityScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_VELOCITY_SCREEN_CACHE> {
  496. public:
  497. static void onRedraw(draw_mode_t);
  498. static bool onTouchHeld(uint8_t tag);
  499. };
  500. class MaxAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<MAX_ACCELERATION_SCREEN_CACHE> {
  501. public:
  502. static void onRedraw(draw_mode_t);
  503. static bool onTouchHeld(uint8_t tag);
  504. };
  505. class DefaultAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<DEFAULT_ACCELERATION_SCREEN_CACHE> {
  506. public:
  507. static void onRedraw(draw_mode_t);
  508. static bool onTouchHeld(uint8_t tag);
  509. };
  510. #if HAS_JUNCTION_DEVIATION
  511. class JunctionDeviationScreen : public BaseNumericAdjustmentScreen, public CachedScreen<JUNC_DEV_SCREEN_CACHE> {
  512. public:
  513. static void onRedraw(draw_mode_t);
  514. static bool onTouchHeld(uint8_t tag);
  515. };
  516. #else
  517. class JerkScreen : public BaseNumericAdjustmentScreen, public CachedScreen<JERK_SCREEN_CACHE> {
  518. public:
  519. static void onRedraw(draw_mode_t);
  520. static bool onTouchHeld(uint8_t tag);
  521. };
  522. #endif
  523. #if ENABLED(CASE_LIGHT_ENABLE)
  524. class CaseLightScreen : public BaseNumericAdjustmentScreen, public CachedScreen<CASE_LIGHT_SCREEN_CACHE> {
  525. public:
  526. static void onRedraw(draw_mode_t);
  527. static bool onTouchHeld(uint8_t tag);
  528. };
  529. #endif
  530. #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
  531. class FilamentMenu : public BaseNumericAdjustmentScreen, public CachedScreen<FILAMENT_MENU_CACHE> {
  532. public:
  533. static void onRedraw(draw_mode_t);
  534. static bool onTouchEnd(uint8_t tag);
  535. };
  536. #endif
  537. #if ENABLED(FILAMENT_RUNOUT_SENSOR)
  538. class FilamentRunoutScreen : public BaseNumericAdjustmentScreen, public CachedScreen<FILAMENT_RUNOUT_SCREEN_CACHE> {
  539. public:
  540. static void onRedraw(draw_mode_t);
  541. static bool onTouchHeld(uint8_t tag);
  542. };
  543. #endif
  544. #if ENABLED(LIN_ADVANCE)
  545. class LinearAdvanceScreen : public BaseNumericAdjustmentScreen, public CachedScreen<LINEAR_ADVANCE_SCREEN_CACHE> {
  546. public:
  547. static void onRedraw(draw_mode_t);
  548. static bool onTouchHeld(uint8_t tag);
  549. };
  550. #endif
  551. class TemperatureScreen : public BaseNumericAdjustmentScreen, public CachedScreen<TEMPERATURE_SCREEN_CACHE> {
  552. public:
  553. static void onRedraw(draw_mode_t);
  554. static bool onTouchHeld(uint8_t tag);
  555. };
  556. class InterfaceSoundsScreen : public BaseScreen, public CachedScreen<INTERFACE_SOUNDS_SCREEN_CACHE> {
  557. public:
  558. enum event_t {
  559. PRINTING_STARTED = 0,
  560. PRINTING_FINISHED = 1,
  561. PRINTING_FAILED = 2,
  562. NUM_EVENTS
  563. };
  564. private:
  565. friend class InterfaceSettingsScreen;
  566. static uint8_t event_sounds[NUM_EVENTS];
  567. static const char* getSoundSelection(event_t);
  568. static void toggleSoundSelection(event_t);
  569. static void setSoundSelection(event_t, const FTDI::SoundPlayer::sound_t*);
  570. public:
  571. static void playEventSound(event_t, FTDI::play_mode_t = FTDI::PLAY_ASYNCHRONOUS);
  572. static void defaultSettings();
  573. static void onEntry();
  574. static void onRedraw(draw_mode_t);
  575. static bool onTouchStart(uint8_t tag);
  576. static bool onTouchEnd(uint8_t tag);
  577. static void onIdle();
  578. };
  579. class InterfaceSettingsScreen : public BaseScreen, public CachedScreen<INTERFACE_SETTINGS_SCREEN_CACHE> {
  580. private:
  581. struct persistent_data_t {
  582. uint32_t touch_transform_a;
  583. uint32_t touch_transform_b;
  584. uint32_t touch_transform_c;
  585. uint32_t touch_transform_d;
  586. uint32_t touch_transform_e;
  587. uint32_t touch_transform_f;
  588. uint16_t passcode;
  589. uint8_t display_brightness;
  590. int8_t display_h_offset_adj;
  591. int8_t display_v_offset_adj;
  592. uint8_t sound_volume;
  593. uint8_t bit_flags;
  594. uint8_t event_sounds[InterfaceSoundsScreen::NUM_EVENTS];
  595. };
  596. public:
  597. #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE
  598. static bool backupEEPROM();
  599. #endif
  600. static void saveSettings(char *);
  601. static void loadSettings(const char *);
  602. static void defaultSettings();
  603. static void failSafeSettings();
  604. static void onStartup();
  605. static void onEntry();
  606. static void onRedraw(draw_mode_t);
  607. static bool onTouchStart(uint8_t tag);
  608. static bool onTouchEnd(uint8_t tag);
  609. static void onIdle();
  610. };
  611. class LockScreen : public BaseScreen, public CachedScreen<LOCK_SCREEN_CACHE> {
  612. private:
  613. friend InterfaceSettingsScreen;
  614. static uint16_t passcode;
  615. static char & message_style();
  616. static uint16_t compute_checksum();
  617. static void onPasscodeEntered();
  618. public:
  619. static bool is_enabled();
  620. static void check_passcode();
  621. static void enable();
  622. static void disable();
  623. static void set_hash(uint16_t pass) {passcode = pass;};
  624. static uint16_t get_hash() {return passcode;};
  625. static void onEntry();
  626. static void onRedraw(draw_mode_t);
  627. static bool onTouchEnd(uint8_t tag);
  628. };
  629. #if ENABLED(SDSUPPORT)
  630. class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, FILE_SCREEN_DL_SIZE> {
  631. private:
  632. #ifdef TOUCH_UI_PORTRAIT
  633. static constexpr uint8_t header_h = 2;
  634. static constexpr uint8_t footer_h = 2;
  635. static constexpr uint8_t files_per_page = 11;
  636. #else
  637. static constexpr uint8_t header_h = 1;
  638. static constexpr uint8_t footer_h = 1;
  639. static constexpr uint8_t files_per_page = 6;
  640. #endif
  641. static uint8_t getTagForLine(uint8_t line) {return line + 2;}
  642. static uint8_t getLineForTag(uint8_t tag) {return tag - 2;}
  643. static uint16_t getFileForTag(uint8_t tag);
  644. static uint16_t getSelectedFileIndex();
  645. inline static const char *getSelectedShortFilename() {return getSelectedFilename(false);}
  646. inline static const char *getSelectedLongFilename() {return getSelectedFilename(true);}
  647. static const char *getSelectedFilename(bool longName);
  648. static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted);
  649. static void drawFileList();
  650. static void drawHeader();
  651. static void drawFooter();
  652. static void drawSelectedFile();
  653. static void gotoPage(uint8_t);
  654. public:
  655. static void onEntry();
  656. static void onRedraw(draw_mode_t);
  657. static bool onTouchEnd(uint8_t tag);
  658. static void onIdle();
  659. };
  660. #endif
  661. class EndstopStatesScreen : public BaseScreen, public UncachedScreen {
  662. public:
  663. static void onEntry();
  664. static void onExit();
  665. static void onRedraw(draw_mode_t);
  666. static bool onTouchEnd(uint8_t tag);
  667. static void onIdle();
  668. };
  669. class DisplayTuningScreen : public BaseNumericAdjustmentScreen, public CachedScreen<DISPLAY_TIMINGS_SCREEN_CACHE> {
  670. public:
  671. static void onRedraw(draw_mode_t);
  672. static bool onTouchHeld(uint8_t tag);
  673. };
  674. #if ENABLED(TOUCH_UI_DEVELOPER_MENU)
  675. class DeveloperMenu : public BaseScreen, public UncachedScreen {
  676. public:
  677. static void onRedraw(draw_mode_t);
  678. static bool onTouchEnd(uint8_t tag);
  679. };
  680. class ConfirmEraseFlashDialogBox : public DialogBoxBaseClass, public UncachedScreen {
  681. public:
  682. static void onRedraw(draw_mode_t);
  683. static bool onTouchEnd(uint8_t tag);
  684. };
  685. class WidgetsScreen : public BaseScreen, public UncachedScreen {
  686. public:
  687. static void onEntry();
  688. static void onRedraw(draw_mode_t);
  689. static bool onTouchStart(uint8_t tag);
  690. static void onIdle();
  691. };
  692. class StressTestScreen : public BaseScreen, public UncachedScreen {
  693. private:
  694. static void drawDots(uint16_t x, uint16_t y, uint16_t h, uint16_t v);
  695. static bool watchDogTestNow();
  696. static void recursiveLockup();
  697. static void iterativeLockup();
  698. static void runTestOnBootup(bool enable);
  699. public:
  700. static void startupCheck();
  701. static void onEntry();
  702. static void onRedraw(draw_mode_t);
  703. static bool onTouchEnd(uint8_t tag);
  704. static void onIdle();
  705. };
  706. #endif
  707. class MediaPlayerScreen : public BaseScreen, public UncachedScreen {
  708. private:
  709. typedef int16_t media_streamer_func_t(void *obj, void *buff, size_t bytes);
  710. public:
  711. static bool playCardMedia();
  712. static bool playBootMedia();
  713. static void onEntry();
  714. static void onRedraw(draw_mode_t);
  715. static void playStream(void *obj, media_streamer_func_t*);
  716. };
  717. #if NUM_LANGUAGES > 1
  718. class LanguageMenu : public BaseScreen, public UncachedScreen {
  719. public:
  720. static void onRedraw(draw_mode_t);
  721. static bool onTouchEnd(uint8_t tag);
  722. };
  723. #endif