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 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. //
  23. // LED Menu
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if HAS_LCD_MENU && EITHER(LED_CONTROL_MENU, CASE_LIGHT_MENU)
  27. #include "menu_item.h"
  28. #if ENABLED(LED_CONTROL_MENU)
  29. #include "../../feature/leds/leds.h"
  30. #if ENABLED(LED_COLOR_PRESETS)
  31. void menu_led_presets() {
  32. START_MENU();
  33. #if LCD_HEIGHT > 2
  34. STATIC_ITEM(MSG_LED_PRESETS, SS_DEFAULT|SS_INVERT);
  35. #endif
  36. BACK_ITEM(MSG_LED_CONTROL);
  37. ACTION_ITEM(MSG_SET_LEDS_WHITE, leds.set_white);
  38. ACTION_ITEM(MSG_SET_LEDS_RED, leds.set_red);
  39. ACTION_ITEM(MSG_SET_LEDS_ORANGE, leds.set_orange);
  40. ACTION_ITEM(MSG_SET_LEDS_YELLOW, leds.set_yellow);
  41. ACTION_ITEM(MSG_SET_LEDS_GREEN, leds.set_green);
  42. ACTION_ITEM(MSG_SET_LEDS_BLUE, leds.set_blue);
  43. ACTION_ITEM(MSG_SET_LEDS_INDIGO, leds.set_indigo);
  44. ACTION_ITEM(MSG_SET_LEDS_VIOLET, leds.set_violet);
  45. END_MENU();
  46. }
  47. #endif
  48. void menu_led_custom() {
  49. START_MENU();
  50. BACK_ITEM(MSG_LED_CONTROL);
  51. EDIT_ITEM(uint8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true);
  52. EDIT_ITEM(uint8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true);
  53. EDIT_ITEM(uint8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true);
  54. #if EITHER(RGBW_LED, NEOPIXEL_LED)
  55. EDIT_ITEM(uint8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true);
  56. #if ENABLED(NEOPIXEL_LED)
  57. EDIT_ITEM(uint8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true);
  58. #endif
  59. #endif
  60. END_MENU();
  61. }
  62. #endif
  63. #if ENABLED(CASE_LIGHT_MENU)
  64. #include "../../feature/caselight.h"
  65. #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
  66. void menu_case_light() {
  67. START_MENU();
  68. BACK_ITEM(MSG_CONFIGURATION);
  69. EDIT_ITEM(percent, MSG_CASE_LIGHT_BRIGHTNESS, &caselight.brightness, 0, 255, caselight.update_brightness, true);
  70. EDIT_ITEM(bool, MSG_CASE_LIGHT, (bool*)&caselight.on, caselight.update_enabled);
  71. END_MENU();
  72. }
  73. #endif
  74. #endif
  75. void menu_led() {
  76. START_MENU();
  77. BACK_ITEM(MSG_MAIN);
  78. #if ENABLED(LED_CONTROL_MENU)
  79. bool led_on = leds.lights_on;
  80. EDIT_ITEM(bool, MSG_LEDS, &led_on, leds.toggle);
  81. ACTION_ITEM(MSG_SET_LEDS_DEFAULT, leds.set_default);
  82. #if ENABLED(LED_COLOR_PRESETS)
  83. SUBMENU(MSG_LED_PRESETS, menu_led_presets);
  84. #endif
  85. SUBMENU(MSG_CUSTOM_LEDS, menu_led_custom);
  86. #endif
  87. //
  88. // Set Case light on/off/brightness
  89. //
  90. #if ENABLED(CASE_LIGHT_MENU)
  91. #if DISABLED(CASE_LIGHT_NO_BRIGHTNESS)
  92. if (TERN1(CASE_LIGHT_USE_NEOPIXEL, PWM_PIN(CASE_LIGHT_PIN)))
  93. SUBMENU(MSG_CASE_LIGHT, menu_case_light);
  94. else
  95. #endif
  96. EDIT_ITEM(bool, MSG_CASE_LIGHT, (bool*)&caselight.on, caselight.update_enabled);
  97. #endif
  98. END_MENU();
  99. }
  100. #endif // HAS_LCD_MENU && LED_CONTROL_MENU