Merge upstream changes from Marlin 2.1.2

This commit is contained in:
Stefan Kalscheuer
2022-12-19 15:23:45 +01:00
parent fe9ea826a5
commit 67c7ce7b79
427 changed files with 10732 additions and 7834 deletions

View File

@@ -25,7 +25,6 @@
#include "../sd/cardreader.h"
#include "../module/motion.h"
#include "../libs/buzzer.h"
#include "buttons.h"
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
@@ -36,7 +35,7 @@
#define MULTI_E_MANUAL 1
#endif
#if HAS_DISPLAY
#if HAS_PRINT_PROGRESS
#include "../module/printcounter.h"
#endif
@@ -86,6 +85,7 @@ typedef bool (*statusResetFunc_t)();
#endif // HAS_WIRED_LCD
#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
#define LCD_WITH_BLINK 1
#define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100)
#endif
@@ -270,20 +270,19 @@ public:
FORCE_INLINE static void refresh_brightness() { set_brightness(brightness); }
#endif
#if LCD_BACKLIGHT_TIMEOUT
#define LCD_BKL_TIMEOUT_MIN 1u
#define LCD_BKL_TIMEOUT_MAX UINT16_MAX // Slightly more than 18 hours
static uint16_t lcd_backlight_timeout;
#if LCD_BACKLIGHT_TIMEOUT_MINS
static constexpr uint8_t backlight_timeout_min = 0;
static constexpr uint8_t backlight_timeout_max = 99;
static uint8_t backlight_timeout_minutes;
static millis_t backlight_off_ms;
static void refresh_backlight_timeout();
#elif HAS_DISPLAY_SLEEP
#define SLEEP_TIMEOUT_MIN 0
#define SLEEP_TIMEOUT_MAX 99
static constexpr uint8_t sleep_timeout_min = 0;
static constexpr uint8_t sleep_timeout_max = 99;
static uint8_t sleep_timeout_minutes;
static millis_t screen_timeout_millis;
static void refresh_screen_timeout();
static void sleep_on();
static void sleep_off();
static void sleep_display(const bool sleep=true);
#endif
#if HAS_DWIN_E3V2_BASIC
@@ -304,19 +303,19 @@ public:
#define PROGRESS_SCALE 1U
#define PROGRESS_MASK 0x7F
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
#if ENABLED(SET_PROGRESS_PERCENT)
static progress_t progress_override;
static void set_progress(const progress_t p) { progress_override = _MIN(p, 100U * (PROGRESS_SCALE)); }
static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); }
static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); }
#endif
#if ENABLED(SHOW_REMAINING_TIME)
#if EITHER(SHOW_REMAINING_TIME, SET_PROGRESS_MANUALLY)
static uint32_t _calculated_remaining_time() {
const duration_t elapsed = print_job_timer.duration();
const progress_t progress = _get_progress();
return progress ? elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress : 0;
}
#if ENABLED(USE_M73_REMAINING_TIME)
#if ENABLED(SET_REMAINING_TIME)
static uint32_t remaining_time;
FORCE_INLINE static void set_remaining_time(const uint32_t r) { remaining_time = r; }
FORCE_INLINE static uint32_t get_remaining_time() { return remaining_time ?: _calculated_remaining_time(); }
@@ -324,12 +323,32 @@ public:
#else
FORCE_INLINE static uint32_t get_remaining_time() { return _calculated_remaining_time(); }
#endif
#if ENABLED(SET_INTERACTION_TIME)
static uint32_t interaction_time;
FORCE_INLINE static void set_interaction_time(const uint32_t r) { interaction_time = r; }
FORCE_INLINE static void reset_interaction_time() { set_interaction_time(0); }
#endif
#endif
static progress_t _get_progress();
#if HAS_PRINT_PROGRESS_PERMYRIAD
FORCE_INLINE static uint16_t get_progress_permyriad() { return _get_progress(); }
#endif
static uint8_t get_progress_percent() { return uint8_t(_get_progress() / (PROGRESS_SCALE)); }
#if LCD_WITH_BLINK
#if ENABLED(SHOW_PROGRESS_PERCENT)
static void drawPercent();
#endif
#if ENABLED(SHOW_ELAPSED_TIME)
static void drawElapsed();
#endif
#if ENABLED(SHOW_REMAINING_TIME)
static void drawRemain();
#endif
#if ENABLED(SHOW_INTERACTION_TIME)
static void drawInter();
#endif
static void rotate_progress();
#endif
#else
static constexpr uint8_t get_progress_percent() { return 0; }
#endif
@@ -391,7 +410,7 @@ public:
static void poweroff();
#endif
#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
#if LCD_WITH_BLINK
static bool get_blink();
#endif
@@ -526,7 +545,7 @@ public:
#endif
static void reset_status_timeout(const millis_t ms) {
TERN(SCREENS_CAN_TIME_OUT, return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS, UNUSED(ms));
TERN(HAS_SCREEN_TIMEOUT, return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS, UNUSED(ms));
}
#if HAS_MARLINUI_MENU
@@ -577,11 +596,11 @@ public:
#endif
FORCE_INLINE static bool screen_is_sticky() {
return TERN1(SCREENS_CAN_TIME_OUT, defer_return_to_status);
return TERN1(HAS_SCREEN_TIMEOUT, defer_return_to_status);
}
FORCE_INLINE static void defer_status_screen(const bool defer=true) {
TERN(SCREENS_CAN_TIME_OUT, defer_return_to_status = defer, UNUSED(defer));
TERN(HAS_SCREEN_TIMEOUT, defer_return_to_status = defer, UNUSED(defer));
}
static void goto_previous_screen_no_defer() {
@@ -759,7 +778,7 @@ public:
private:
#if SCREENS_CAN_TIME_OUT
#if HAS_SCREEN_TIMEOUT
static millis_t return_to_status_ms;
static bool defer_return_to_status;
#else