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.

boot_screen.cpp 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*******************
  2. * boot_screen.cpp *
  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. #include "../config.h"
  22. #if ENABLED(LULZBOT_TOUCH_UI)
  23. #include "screens.h"
  24. #include "../ftdi_eve_lib/extras/poly_ui.h"
  25. #include "../archim2-flash/flash_storage.h"
  26. #ifdef TOUCH_UI_PORTRAIT
  27. #include "../theme/bootscreen_logo_portrait.h"
  28. #else
  29. #include "../theme/bootscreen_logo_landscape.h"
  30. #endif
  31. using namespace FTDI;
  32. void BootScreen::onRedraw(draw_mode_t) {
  33. CommandProcessor cmd;
  34. cmd.cmd(CLEAR_COLOR_RGB(0x000000));
  35. cmd.cmd(CLEAR(true,true,true));
  36. CLCD::turn_on_backlight();
  37. SoundPlayer::set_volume(255);
  38. }
  39. void BootScreen::onIdle() {
  40. if (CLCD::is_touching()) {
  41. // If the user is touching the screen at startup, then
  42. // assume the user wants to re-calibrate the screen.
  43. // This gives the user the ability to recover a
  44. // miscalibration that has been stored to EEPROM.
  45. // Also reset display parameters to defaults, just
  46. // in case the display is borked.
  47. InterfaceSettingsScreen::failSafeSettings();
  48. StatusScreen::loadBitmaps();
  49. GOTO_SCREEN(TouchCalibrationScreen);
  50. current_screen.forget();
  51. PUSH_SCREEN(StatusScreen);
  52. } else {
  53. if (!UIFlashStorage::is_valid()) {
  54. StatusScreen::loadBitmaps();
  55. SpinnerDialogBox::show(GET_TEXTF(PLEASE_WAIT));
  56. UIFlashStorage::format_flash();
  57. SpinnerDialogBox::hide();
  58. }
  59. if (UIData::animations_enabled()) {
  60. // If there is a startup video in the flash SPI, play
  61. // that, otherwise show a static splash screen.
  62. if (!MediaPlayerScreen::playBootMedia())
  63. showSplashScreen();
  64. }
  65. StatusScreen::loadBitmaps();
  66. #ifdef LULZBOT_USE_BIOPRINTER_UI
  67. GOTO_SCREEN(BioConfirmHomeXYZ);
  68. current_screen.forget();
  69. PUSH_SCREEN(StatusScreen);
  70. PUSH_SCREEN(BioConfirmHomeE);
  71. #elif defined(TOUCH_UI_LANGUAGE_MENU)
  72. StatusScreen::setStatusMessage(F(WELCOME_MSG));
  73. GOTO_SCREEN(LanguageMenu);
  74. #else
  75. StatusScreen::setStatusMessage(F(WELCOME_MSG));
  76. GOTO_SCREEN(StatusScreen);
  77. #endif
  78. }
  79. }
  80. void BootScreen::showSplashScreen() {
  81. CommandProcessor cmd;
  82. cmd.cmd(CMD_DLSTART);
  83. cmd.cmd(CLEAR_COLOR_RGB(0xDEEA5C));
  84. cmd.cmd(CLEAR(true,true,true));
  85. #define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0]))
  86. PolyUI ui(cmd);
  87. cmd.cmd(COLOR_RGB(0xC1D82F));
  88. ui.fill(POLY(logo_green));
  89. cmd.cmd(COLOR_RGB(0x000000));
  90. ui.fill(POLY(logo_black));
  91. ui.fill(POLY(logo_type));
  92. ui.fill(POLY(logo_mark));
  93. cmd.cmd(COLOR_RGB(0xFFFFFF));
  94. ui.fill(POLY(logo_white));
  95. cmd.cmd(DL::DL_DISPLAY);
  96. cmd.cmd(CMD_SWAP);
  97. cmd.execute();
  98. ExtUI::delay_ms(2500);
  99. }
  100. #endif // LULZBOT_TOUCH_UI