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.

confirm_erase_flash_dialog_box.cpp 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**************************************
  2. * confirm_erase_flash_dialog_box.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: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #include "../screens.h"
  23. #ifdef FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX
  24. #include "../archim2-flash/flash_storage.h"
  25. using namespace FTDI;
  26. void ConfirmEraseFlashDialogBox::onRedraw(draw_mode_t) {
  27. drawMessage(GET_TEXT_F(MSG_ERASE_FLASH_WARNING));
  28. drawYesNoButtons();
  29. }
  30. bool ConfirmEraseFlashDialogBox::onTouchEnd(uint8_t tag) {
  31. switch (tag) {
  32. case 1:
  33. SpinnerDialogBox::show(GET_TEXT_F(MSG_ERASING));
  34. UIFlashStorage::format_flash();
  35. SpinnerDialogBox::hide();
  36. AlertDialogBox::show(GET_TEXT_F(MSG_ERASED));
  37. // Remove ConfirmEraseFlashDialogBox from the stack
  38. // so the alert box doesn't return to me.
  39. current_screen.forget();
  40. return true;
  41. default:
  42. return DialogBoxBaseClass::onTouchEnd(tag);
  43. }
  44. }
  45. #endif // FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX