Skip to content

Commit dc540bb

Browse files
✨ EDITABLE_DISPLAY_TIMEOUT (MarlinFirmware#26517)
Co-authored-by: Scott Lahteine <[email protected]>
1 parent ff7649b commit dc540bb

File tree

21 files changed

+102
-82
lines changed

21 files changed

+102
-82
lines changed

Marlin/Configuration_adv.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,11 +1471,6 @@
14711471
#define FEEDRATE_CHANGE_BEEP_FREQUENCY 440
14721472
#endif
14731473

1474-
//
1475-
// LCD Backlight Timeout
1476-
//
1477-
//#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight
1478-
14791474
#if HAS_BED_PROBE && ANY(HAS_MARLINUI_MENU, HAS_TFT_LVGL_UI)
14801475
//#define PROBE_OFFSET_WIZARD // Add a Probe Z Offset calibration option to the LCD menu
14811476
#if ENABLED(PROBE_OFFSET_WIZARD)
@@ -2206,6 +2201,15 @@
22062201
//#define TFT_BTOKMENU_COLOR 0x145F // 00010 100010 11111 Cyan
22072202
#endif
22082203

2204+
//
2205+
// LCD Backlight Timeout
2206+
// Requires a display with a controllable backlight
2207+
//
2208+
//#define LCD_BACKLIGHT_TIMEOUT_MINS 1 // (minutes) Timeout before turning off the backlight
2209+
#if defined(DISPLAY_SLEEP_MINUTES) || defined(LCD_BACKLIGHT_TIMEOUT_MINS)
2210+
#define EDITABLE_DISPLAY_TIMEOUT // Edit timeout with M255 S<minutes> and a menu item
2211+
#endif
2212+
22092213
//
22102214
// ADC Button Debounce
22112215
//

Marlin/src/core/types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ typedef Flags<8> flags_8_t;
198198
typedef Flags<16> flags_16_t;
199199

200200
// Flags for some axis states, with per-axis aliases xyzijkuvwe
201-
typedef struct AxisFlags {
201+
typedef struct {
202202
union {
203203
struct Flags<LOGICAL_AXES> flags;
204204
struct { bool LOGICAL_AXIS_LIST(e:1, x:1, y:1, z:1, i:1, j:1, k:1, u:1, v:1, w:1); };
@@ -212,7 +212,7 @@ typedef struct AxisFlags {
212212
FI bool operator[](const int n) const { return flags[n]; }
213213
FI int size() const { return sizeof(flags); }
214214
FI operator bool() const { return flags; }
215-
} axis_flags_t;
215+
} AxisFlags;
216216

217217
//
218218
// Enumerated axis indices

Marlin/src/feature/bedlevel/bdl/bdl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void BDS_Leveling::process() {
195195
safe_delay(10);
196196
if (config_state == BDS_CALIBRATE_START) {
197197
config_state = BDS_CALIBRATING;
198-
REMEMBER(gsit, gcode.stepper_inactive_time, SEC_TO_MS(60 * 5));
198+
REMEMBER(gsit, gcode.stepper_inactive_time, MIN_TO_MS(5));
199199
SERIAL_ECHOLNPGM("c_z0:", planner.get_axis_position_mm(Z_AXIS), "-", pos_zero_offset);
200200

201201
// Move the z axis instead of enabling the Z axis with M17

Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ void unified_bed_leveling::shift_mesh_height() {
772772
const grid_count_t point_num = (GRID_MAX_POINTS - count) + 1;
773773
SERIAL_ECHOLNPGM("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
774774
TERN_(HAS_STATUS_MESSAGE, ui.status_printf(0, F(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_POINT), point_num, int(GRID_MAX_POINTS)));
775-
TERN_(LCD_BACKLIGHT_TIMEOUT_MINS, ui.refresh_backlight_timeout());
775+
TERN_(HAS_BACKLIGHT_TIMEOUT, ui.refresh_backlight_timeout());
776+
TERN_(DWIN_LCD_PROUI, dwinRedrawScreen());
776777

777778
#if HAS_MARLINUI_MENU
778779
if (ui.button_pressed()) {

Marlin/src/gcode/calibrate/G76_M871.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256

257257
say_waiting_for_probe_heating();
258258
SERIAL_ECHOLNPGM(" Bed:", target_bed, " Probe:", target_probe);
259-
const millis_t probe_timeout_ms = millis() + SEC_TO_MS(900UL);
259+
const millis_t probe_timeout_ms = millis() + MIN_TO_MS(15);
260260
while (thermalManager.degProbe() < target_probe) {
261261
if (report_temps(next_temp_report, probe_timeout_ms)) {
262262
SERIAL_ECHOLNPGM("!Probe heating timed out.");

Marlin/src/gcode/gcode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
793793
case 250: M250(); break; // M250: Set LCD contrast
794794
#endif
795795

796-
#if HAS_GCODE_M255
796+
#if ENABLED(EDITABLE_DISPLAY_TIMEOUT)
797797
case 255: M255(); break; // M255: Set LCD Sleep/Backlight Timeout (Minutes)
798798
#endif
799799

Marlin/src/gcode/gcode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ class GcodeSuite {
909909
static void M250_report(const bool forReplay=true);
910910
#endif
911911

912-
#if HAS_GCODE_M255
912+
#if ENABLED(EDITABLE_DISPLAY_TIMEOUT)
913913
static void M255();
914914
static void M255_report(const bool forReplay=true);
915915
#endif

Marlin/src/gcode/lcd/M255.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
#include "../../inc/MarlinConfig.h"
2323

24-
#if HAS_GCODE_M255
24+
#if ENABLED(EDITABLE_DISPLAY_TIMEOUT)
2525

2626
#include "../gcode.h"
2727
#include "../../lcd/marlinui.h"
@@ -51,4 +51,4 @@ void GcodeSuite::M255_report(const bool forReplay/*=true*/) {
5151
);
5252
}
5353

54-
#endif // HAS_GCODE_M255
54+
#endif // EDITABLE_DISPLAY_TIMEOUT

Marlin/src/inc/Conditionals_adv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,11 @@
893893
#if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, HAS_MEDIA)
894894
#define HAS_LEDS_OFF_FLAG 1
895895
#endif
896-
#if DISPLAY_SLEEP_MINUTES || TOUCH_IDLE_SLEEP_MINS
896+
#if defined(DISPLAY_SLEEP_MINUTES) || defined(TOUCH_IDLE_SLEEP_MINS)
897897
#define HAS_DISPLAY_SLEEP 1
898898
#endif
899-
#if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT_MINS
900-
#define HAS_GCODE_M255 1
899+
#ifdef LCD_BACKLIGHT_TIMEOUT_MINS
900+
#define HAS_BACKLIGHT_TIMEOUT 1
901901
#endif
902902

903903
#if ANY(DIGIPOT_MCP4018, DIGIPOT_MCP4451)

Marlin/src/inc/SanityCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
27622762
#endif
27632763
#endif
27642764

2765-
#if LCD_BACKLIGHT_TIMEOUT_MINS
2765+
#if HAS_BACKLIGHT_TIMEOUT
27662766
#if !HAS_ENCODER_ACTION && DISABLED(HAS_DWIN_E3V2)
27672767
#error "LCD_BACKLIGHT_TIMEOUT_MINS requires an LCD with encoder or keypad."
27682768
#elif ENABLED(NEOPIXEL_BKGD_INDEX_FIRST)

0 commit comments

Comments
 (0)