Merge pull request #5255 from Kaibob2/CaseLightMenu

Case light menu (3rd attempt)
This commit is contained in:
Scott Lahteine 2016-11-23 13:46:33 -06:00 committed by GitHub
commit 7f8133a51f
4 changed files with 33 additions and 7 deletions

View File

@ -530,6 +530,16 @@ static uint8_t target_extruder;
; ;
#endif #endif
#if ENABLED(ULTIPANEL) && HAS_CASE_LIGHT
bool case_light_on =
#if ENABLED(CASE_LIGHT_DEFAULT_ON)
true
#else
false
#endif
;
#endif
#if ENABLED(DELTA) #if ENABLED(DELTA)
#define SIN_60 0.8660254037844386 #define SIN_60 0.8660254037844386
@ -7274,11 +7284,6 @@ inline void gcode_M907() {
* P<byte> Set case light brightness (PWM pin required) * P<byte> Set case light brightness (PWM pin required)
*/ */
inline void gcode_M355() { inline void gcode_M355() {
static bool case_light_on
#if ENABLED(CASE_LIGHT_DEFAULT_ON)
= true
#endif
;
static uint8_t case_light_brightness = 255; static uint8_t case_light_brightness = 255;
if (code_seen('P')) case_light_brightness = code_value_byte(); if (code_seen('P')) case_light_brightness = code_value_byte();
if (code_seen('S')) { if (code_seen('S')) {

View File

@ -184,6 +184,8 @@
#define MSG_INFO_EXTRUDERS "Extruders" #define MSG_INFO_EXTRUDERS "Extruders"
#define MSG_INFO_BAUDRATE "Baud" #define MSG_INFO_BAUDRATE "Baud"
#define MSG_INFO_PROTOCOL "Protokol" #define MSG_INFO_PROTOCOL "Protokol"
#define MSG_LIGHTS_ON "Gehäuse Licht an"
#define MSG_LIGHTS_OFF "Gehäuse Licht aus"
#if LCD_WIDTH >= 20 #if LCD_WIDTH >= 20
#define MSG_INFO_PRINT_COUNT "Gesamte Drucke" #define MSG_INFO_PRINT_COUNT "Gesamte Drucke"

View File

@ -487,6 +487,12 @@
#ifndef MSG_INFO_PROTOCOL #ifndef MSG_INFO_PROTOCOL
#define MSG_INFO_PROTOCOL "Protocol" #define MSG_INFO_PROTOCOL "Protocol"
#endif #endif
#ifndef MSG_LIGHTS_ON
#define MSG_LIGHTS_ON "Case light on"
#endif
#ifndef MSG_LIGHTS_OFF
#define MSG_LIGHTS_OFF "Case light off"
#endif
#if LCD_WIDTH >= 20 #if LCD_WIDTH >= 20
#ifndef MSG_INFO_PRINT_COUNT #ifndef MSG_INFO_PRINT_COUNT

View File

@ -110,6 +110,9 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
extern bool powersupply; extern bool powersupply;
#endif #endif
#if HAS_CASE_LIGHT
extern bool case_light_on;
#endif
const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE; const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE;
static void lcd_main_menu(); static void lcd_main_menu();
static void lcd_tune_menu(); static void lcd_tune_menu();
@ -583,6 +586,16 @@ void kill_screen(const char* lcd_msg) {
START_MENU(); START_MENU();
MENU_BACK(MSG_WATCH); MENU_BACK(MSG_WATCH);
//
// Switch case light on/off
//
#if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT)
if (case_light_on == 0)
MENU_ITEM(gcode, MSG_LIGHTS_ON, PSTR("M355 S1"));
else
MENU_ITEM(gcode, MSG_LIGHTS_OFF, PSTR("M355 S0"));
#endif
#if ENABLED(BLTOUCH) #if ENABLED(BLTOUCH)
if (!endstops.z_probe_enabled && TEST_BLTOUCH()) if (!endstops.z_probe_enabled && TEST_BLTOUCH())
MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_ENDSTOP_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET)));