My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

boot_screen.cpp 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. * Written By Marcio Teixeira 2019 - Cocoa Press *
  8. * *
  9. * This program is free software: you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation, either version 3 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. * This program is distributed in the hope that it will be useful, *
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  17. * GNU General Public License for more details. *
  18. * *
  19. * To view a copy of the GNU General Public License, go to the following *
  20. * location: <https://www.gnu.org/licenses/>. *
  21. ****************************************************************************/
  22. #include "../config.h"
  23. #if ENABLED(TOUCH_UI_FTDI_EVE)
  24. #include "screens.h"
  25. #include "../ftdi_eve_lib/extras/poly_ui.h"
  26. #include "../archim2-flash/flash_storage.h"
  27. #ifdef SHOW_CUSTOM_BOOTSCREEN
  28. #ifdef TOUCH_UI_PORTRAIT
  29. #include "../theme/_bootscreen_portrait.h"
  30. #else
  31. #include "../theme/_bootscreen_landscape.h"
  32. #endif
  33. #else
  34. #ifdef TOUCH_UI_PORTRAIT
  35. #include "../theme/marlin_bootscreen_portrait.h"
  36. #else
  37. #include "../theme/marlin_bootscreen_landscape.h"
  38. #endif
  39. #endif
  40. using namespace FTDI;
  41. using namespace Theme;
  42. void BootScreen::onRedraw(draw_mode_t) {
  43. CommandProcessor cmd;
  44. cmd.cmd(CLEAR_COLOR_RGB(0x000000));
  45. cmd.cmd(CLEAR(true,true,true));
  46. CLCD::turn_on_backlight();
  47. SoundPlayer::set_volume(255);
  48. }
  49. void BootScreen::onIdle() {
  50. if (CLCD::is_touching()) {
  51. // If the user is touching the screen at startup, then
  52. // assume the user wants to re-calibrate the screen.
  53. // This gives the user the ability to recover a
  54. // miscalibration that has been stored to EEPROM.
  55. // Also reset display parameters to defaults, just
  56. // in case the display is borked.
  57. InterfaceSettingsScreen::failSafeSettings();
  58. StatusScreen::loadBitmaps();
  59. StatusScreen::setStatusMessage(GET_TEXT_F(WELCOME_MSG));
  60. GOTO_SCREEN(TouchCalibrationScreen);
  61. current_screen.forget();
  62. PUSH_SCREEN(StatusScreen);
  63. } else {
  64. if (!UIFlashStorage::is_valid()) {
  65. StatusScreen::loadBitmaps();
  66. SpinnerDialogBox::show(GET_TEXT_F(MSG_PLEASE_WAIT));
  67. UIFlashStorage::format_flash();
  68. SpinnerDialogBox::hide();
  69. }
  70. #if DISABLED(TOUCH_UI_NO_BOOTSCREEN)
  71. if (UIData::animations_enabled()) {
  72. // If there is a startup video in the flash SPI, play
  73. // that, otherwise show a static splash screen.
  74. if (!MediaPlayerScreen::playBootMedia())
  75. showSplashScreen();
  76. }
  77. #endif
  78. StatusScreen::loadBitmaps();
  79. #ifdef TOUCH_UI_LULZBOT_BIO
  80. GOTO_SCREEN(BioConfirmHomeXYZ);
  81. current_screen.forget();
  82. PUSH_SCREEN(StatusScreen);
  83. PUSH_SCREEN(BioConfirmHomeE);
  84. #elif NUM_LANGUAGES > 1
  85. StatusScreen::setStatusMessage(GET_TEXT_F(WELCOME_MSG));
  86. GOTO_SCREEN(LanguageMenu);
  87. #else
  88. StatusScreen::setStatusMessage(GET_TEXT_F(WELCOME_MSG));
  89. GOTO_SCREEN(StatusScreen);
  90. #endif
  91. }
  92. }
  93. void BootScreen::showSplashScreen() {
  94. CommandProcessor cmd;
  95. cmd.cmd(CMD_DLSTART);
  96. cmd.cmd(CLEAR_COLOR_RGB(LOGO_BACKGROUND));
  97. cmd.cmd(CLEAR(true,true,true));
  98. #define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0]))
  99. #define LOGO_PAINT_PATH(rgb, path) cmd.cmd(COLOR_RGB(rgb)); ui.fill(POLY(path));
  100. PolyUI ui(cmd);
  101. LOGO_PAINT_PATHS
  102. cmd.cmd(DL::DL_DISPLAY);
  103. cmd.cmd(CMD_SWAP);
  104. cmd.execute();
  105. ExtUI::delay_ms(2500);
  106. }
  107. #endif // TOUCH_UI_FTDI_EVE