-
-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Menu entry for toggling case light #5243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d8500f9
169572c
6faf69a
74474f7
95e0c2a
d96efff
3a690bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -524,6 +524,16 @@ static uint8_t target_extruder; | |
| ; | ||
| #endif | ||
|
|
||
| #if ENABLED(ULTIPANEL) && HAS_CASE_LIGHT | ||
| bool caselight = | ||
| #if ENABLED(CASE_LIGHT_DEFAULT_ON) | ||
| true | ||
| #else | ||
| false | ||
| #endif | ||
| ; | ||
| #endif | ||
|
|
||
| #if ENABLED(DELTA) | ||
|
|
||
| #define SIN_60 0.8660254037844386 | ||
|
|
@@ -7221,14 +7231,16 @@ inline void gcode_M907() { | |
| inline void gcode_M355() { | ||
| static bool case_light_on | ||
| #if ENABLED(CASE_LIGHT_DEFAULT_ON) | ||
| = true | ||
| = true; | ||
| #else | ||
| ; | ||
| ; | ||
| #endif | ||
| static uint8_t case_light_brightness = 255; | ||
| if (code_seen('P')) case_light_brightness = code_value_byte(); | ||
| if (code_seen('S')) { | ||
| case_light_on = code_value_bool(); | ||
| if (case_light_on == 0) caselight = false; | ||
| if (case_light_on == 1) caselight = true; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This instead: caselight = case_light_on = code_value_bool();…or actually, just make |
||
| digitalWrite(CASE_LIGHT_PIN, case_light_on ? HIGH : LOW); | ||
| analogWrite(CASE_LIGHT_PIN, case_light_on ? case_light_brightness : 0); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,9 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to | |
| #if HAS_POWER_SWITCH | ||
| extern bool powersupply; | ||
| #endif | ||
| #if HAS_CASE_LIGHT | ||
| extern bool caselight; | ||
| #endif | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of two flags for the same thing, just use |
||
| const float manual_feedrate_mm_m[] = MANUAL_FEEDRATE; | ||
| static void lcd_main_menu(); | ||
| static void lcd_tune_menu(); | ||
|
|
@@ -580,7 +583,15 @@ void kill_screen(const char* lcd_msg) { | |
| static void lcd_main_menu() { | ||
| START_MENU(); | ||
| MENU_BACK(MSG_WATCH); | ||
|
|
||
| // | ||
| // Switch case light on/off | ||
| // | ||
| #if HAS_CASE_LIGHT && ENABLED(MENU_ITEM_CASE_LIGHT) | ||
| if (caselight) | ||
| MENU_ITEM(gcode, MSG_LIGHTS_OFF, PSTR("M355 S0")); | ||
| else | ||
| MENU_ITEM(gcode, MSG_LIGHTS_ON, PSTR("M355 S1")); | ||
| #endif | ||
| #if ENABLED(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))); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Already patched this region.