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.

filament_runout_screen.cpp 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /******************************
  2. * filament_runout_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 BOTH(TOUCH_UI_FTDI_EVE, FILAMENT_RUNOUT_SENSOR)
  23. #include "screens.h"
  24. using namespace FTDI;
  25. using namespace ExtUI;
  26. using namespace Theme;
  27. void FilamentRunoutScreen::onRedraw(draw_mode_t what) {
  28. widgets_t w(what);
  29. w.heading( GET_TEXT_F(MSG_FILAMENT));
  30. w.toggle( 2, GET_TEXT_F(MSG_RUNOUT_SENSOR), getFilamentRunoutEnabled());
  31. #ifdef FILAMENT_RUNOUT_DISTANCE_MM
  32. extern const char NUL_STR[];
  33. w.heading(GET_TEXT_F(MSG_RUNOUT_DISTANCE_MM));
  34. w.units(GET_TEXT_F(MSG_UNITS_MM));
  35. w.precision(0);
  36. w.color(e_axis);
  37. w.adjuster( 10, NUL_STR, getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
  38. w.increments();
  39. #endif
  40. }
  41. bool FilamentRunoutScreen::onTouchHeld(uint8_t tag) {
  42. using namespace ExtUI;
  43. const float increment = getIncrement();
  44. switch (tag) {
  45. case 2: setFilamentRunoutEnabled(!getFilamentRunoutEnabled()); break;
  46. #ifdef FILAMENT_RUNOUT_DISTANCE_MM
  47. case 10: UI_DECREMENT(FilamentRunoutDistance_mm); break;
  48. case 11: UI_INCREMENT(FilamentRunoutDistance_mm); break;
  49. #endif
  50. default:
  51. return false;
  52. }
  53. SaveSettingsDialogBox::settingsChanged();
  54. return true;
  55. }
  56. #endif // TOUCH_UI_FTDI_EVE