diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1c159c3b4..973d4e1e2 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -10097,15 +10097,14 @@ inline void gcode_M907() { #ifndef INVERT_CASE_LIGHT #define INVERT_CASE_LIGHT false #endif - int case_light_brightness; // LCD routine wants INT + uint8_t case_light_brightness; // LCD routine wants INT bool case_light_on; void update_case_light() { pinMode(CASE_LIGHT_PIN, OUTPUT); // digitalWrite doesn't set the port mode - uint8_t case_light_bright = (uint8_t)case_light_brightness; if (case_light_on) { if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) { - analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness ); + analogWrite(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? 255 - case_light_brightness : case_light_brightness); } else WRITE(CASE_LIGHT_PIN, INVERT_CASE_LIGHT ? LOW : HIGH); } @@ -10139,7 +10138,7 @@ inline void gcode_M355() { } else { if (!USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) SERIAL_ECHOLN("Case light: on"); - else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness); + else SERIAL_ECHOLNPAIR("Case light: ", (int)case_light_brightness); } #else diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index ae8371b0a..4db310548 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -752,7 +752,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(MENU_ITEM_CASE_LIGHT) - extern int case_light_brightness; + extern uint8_t case_light_brightness; extern bool case_light_on; extern void update_case_light(); @@ -762,7 +762,7 @@ void kill_screen(const char* lcd_msg) { // ^ Main // MENU_BACK(MSG_MAIN); - MENU_ITEM_EDIT_CALLBACK(int3, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); END_MENU(); }