From 79a332b57ea4a1ddb0e6b06d8dabae34268ed3bd Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Thu, 7 Jul 2022 21:43:56 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20LCD=5FBACKLIGHT=5FTIMEOUT?= =?UTF-8?q?=20compile=20(#24463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/gcode.h | 2 +- Marlin/src/gcode/lcd/M255.cpp | 2 +- Marlin/src/inc/Conditionals_adv.h | 4 ++++ Marlin/src/lcd/marlinui.h | 8 ++------ buildroot/tests/mega2560 | 9 +++++---- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 1efcb1cf93..a6b530a268 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -886,7 +886,7 @@ private: static void M250_report(const bool forReplay=true); #endif - #if HAS_DISPLAY_SLEEP + #if HAS_GCODE_M255 static void M255(); static void M255_report(const bool forReplay=true); #endif diff --git a/Marlin/src/gcode/lcd/M255.cpp b/Marlin/src/gcode/lcd/M255.cpp index cfdf27b8a1..4a9049ab2c 100644 --- a/Marlin/src/gcode/lcd/M255.cpp +++ b/Marlin/src/gcode/lcd/M255.cpp @@ -36,7 +36,7 @@ void GcodeSuite::M255() { const int m = parser.value_int(); ui.sleep_timeout_minutes = constrain(m, SLEEP_TIMEOUT_MIN, SLEEP_TIMEOUT_MAX); #else - const int s = parser.value_int() * 60; + const unsigned int s = parser.value_ushort() * 60; ui.lcd_backlight_timeout = constrain(s, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX); #endif } diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 9931409976..0cc1556a83 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -591,6 +591,10 @@ #define HAS_PRINT_PROGRESS 1 #endif +#if ANY(HAS_MARLINUI_MENU, ULTIPANEL_FEEDMULTIPLY, SOFT_RESET_ON_KILL) + #define HAS_ENCODER_ACTION 1 +#endif + #if STATUS_MESSAGE_TIMEOUT_SEC > 0 #define HAS_STATUS_MESSAGE_TIMEOUT 1 #endif diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 82b8d78a02..3e7a9ca1b1 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -32,10 +32,6 @@ #include "tft_io/touch_calibration.h" #endif -#if ANY(HAS_MARLINUI_MENU, ULTIPANEL_FEEDMULTIPLY, SOFT_RESET_ON_KILL) - #define HAS_ENCODER_ACTION 1 -#endif - #if E_MANUAL > 1 #define MULTI_E_MANUAL 1 #endif @@ -271,8 +267,8 @@ public: #endif #if LCD_BACKLIGHT_TIMEOUT - #define LCD_BKL_TIMEOUT_MIN 1 - #define LCD_BKL_TIMEOUT_MAX (60*60*18) // 18 hours max within uint16_t + #define LCD_BKL_TIMEOUT_MIN 1u + #define LCD_BKL_TIMEOUT_MAX UINT16_MAX // Slightly more than 18 hours static uint16_t lcd_backlight_timeout; static millis_t backlight_off_ms; static void refresh_backlight_timeout(); diff --git a/buildroot/tests/mega2560 b/buildroot/tests/mega2560 index 969b3b14cc..aa425564fc 100755 --- a/buildroot/tests/mega2560 +++ b/buildroot/tests/mega2560 @@ -206,16 +206,17 @@ opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS EEPROM_BOO exec_test $1 $2 "MEGA2560 RAMPS | Laser Feature | Air Evacuation | Air Assist | Cooler | Laser Safety Timeout | Flowmeter | 44780 LCD " "$3" # -# Test redundant temperature sensors + MAX TC +# Test redundant temperature sensors + MAX TC + Backlight Timeout # restore_configs opt_set MOTHERBOARD BOARD_RAMPS_14_EFB EXTRUDERS 1 \ TEMP_SENSOR_0 -2 TEMP_SENSOR_REDUNDANT -2 \ TEMP_SENSOR_REDUNDANT_SOURCE E1 TEMP_SENSOR_REDUNDANT_TARGET E0 \ - TEMP_0_CS_PIN 11 TEMP_1_CS_PIN 12 -opt_enable MPCTEMP + TEMP_0_CS_PIN 11 TEMP_1_CS_PIN 12 \ + LCD_BACKLIGHT_TIMEOUT 30 +opt_enable MPCTEMP MINIPANEL opt_disable PIDTEMP -exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675" "$3" +exec_test $1 $2 "MEGA2560 RAMPS | Redundant temperature sensor | 2x MAX6675 | BL Timeout" "$3" # # Polargraph Config