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.

case_light_screen.cpp 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*************************
  2. * case_light_screen.cpp *
  3. *************************/
  4. /****************************************************************************
  5. * Written By Marcio Teixeira 2019 - Cocoa Press *
  6. * *
  7. * This program is free software: you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * To view a copy of the GNU General Public License, go to the following *
  18. * location: <https://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #include "../config.h"
  21. #include "../screens.h"
  22. #ifdef FTDI_CASE_LIGHT_SCREEN
  23. using namespace FTDI;
  24. using namespace ExtUI;
  25. using namespace Theme;
  26. void CaseLightScreen::onRedraw(draw_mode_t what) {
  27. widgets_t w(what);
  28. w.heading( GET_TEXT_F(MSG_CASE_LIGHT));
  29. w.toggle( 2, GET_TEXT_F(MSG_LEDS), getCaseLightState());
  30. #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
  31. w.precision(0).units(GET_TEXT_F(MSG_UNITS_PERCENT))
  32. .adjuster(10, GET_TEXT_F(MSG_CASE_LIGHT_BRIGHTNESS), getCaseLightBrightness_percent());
  33. w.precision(0).increments();
  34. #endif
  35. }
  36. bool CaseLightScreen::onTouchHeld(uint8_t tag) {
  37. using namespace ExtUI;
  38. #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
  39. const float increment = getIncrement();
  40. #endif
  41. switch (tag) {
  42. case 2: setCaseLightState(!getCaseLightState()); break;
  43. #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
  44. case 10: UI_DECREMENT(CaseLightBrightness_percent); break;
  45. case 11: UI_INCREMENT(CaseLightBrightness_percent); break;
  46. #endif
  47. default:
  48. return false;
  49. }
  50. SaveSettingsDialogBox::settingsChanged();
  51. return true;
  52. }
  53. #endif // FTDI_CASE_LIGHT_SCREEN