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.

menu_led.cpp 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  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. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. //
  23. // LED Menu
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if HAS_LCD_MENU && ENABLED(LED_CONTROL_MENU)
  27. #include "menu.h"
  28. #include "../../feature/leds/leds.h"
  29. #if ENABLED(LED_COLOR_PRESETS)
  30. void menu_led_presets() {
  31. START_MENU();
  32. #if LCD_HEIGHT > 2
  33. STATIC_ITEM(MSG_LED_PRESETS, SS_CENTER|SS_INVERT);
  34. #endif
  35. MENU_BACK(MSG_LED_CONTROL);
  36. MENU_ITEM(function, MSG_SET_LEDS_WHITE, leds.set_white);
  37. MENU_ITEM(function, MSG_SET_LEDS_RED, leds.set_red);
  38. MENU_ITEM(function, MSG_SET_LEDS_ORANGE, leds.set_orange);
  39. MENU_ITEM(function, MSG_SET_LEDS_YELLOW,leds.set_yellow);
  40. MENU_ITEM(function, MSG_SET_LEDS_GREEN, leds.set_green);
  41. MENU_ITEM(function, MSG_SET_LEDS_BLUE, leds.set_blue);
  42. MENU_ITEM(function, MSG_SET_LEDS_INDIGO, leds.set_indigo);
  43. MENU_ITEM(function, MSG_SET_LEDS_VIOLET, leds.set_violet);
  44. END_MENU();
  45. }
  46. #endif
  47. void menu_led_custom() {
  48. START_MENU();
  49. MENU_BACK(MSG_LED_CONTROL);
  50. MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true);
  51. MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true);
  52. MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true);
  53. #if EITHER(RGBW_LED, NEOPIXEL_LED)
  54. MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true);
  55. #if ENABLED(NEOPIXEL_LED)
  56. MENU_ITEM_EDIT_CALLBACK(uint8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true);
  57. #endif
  58. #endif
  59. END_MENU();
  60. }
  61. void menu_led() {
  62. START_MENU();
  63. MENU_BACK(MSG_MAIN);
  64. bool led_on = leds.lights_on;
  65. MENU_ITEM_EDIT_CALLBACK(bool, MSG_LEDS, &led_on, leds.toggle);
  66. MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default);
  67. #if ENABLED(LED_COLOR_PRESETS)
  68. MENU_ITEM(submenu, MSG_LED_PRESETS, menu_led_presets);
  69. #endif
  70. MENU_ITEM(submenu, MSG_CUSTOM_LEDS, menu_led_custom);
  71. END_MENU();
  72. }
  73. #endif // HAS_LCD_MENU && LED_CONTROL_MENU