1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 22:08:02 +00:00

🎨 Call millis() once in manage_inactivity (#22363)

This commit is contained in:
Katelyn Schiesser 2021-07-14 16:56:02 -07:00 committed by GitHub
parent 3bc1d2dd85
commit 972b1e2f00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -514,7 +514,6 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL; constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL;
static millis_t next_home_key_ms; // = 0 static millis_t next_home_key_ms; // = 0
if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed
const millis_t ms = millis();
if (ELAPSED(ms, next_home_key_ms)) { if (ELAPSED(ms, next_home_key_ms)) {
next_home_key_ms = ms + HOME_DEBOUNCE_DELAY; next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
LCD_MESSAGEPGM(MSG_AUTO_HOME); LCD_MESSAGEPGM(MSG_AUTO_HOME);
@ -526,7 +525,6 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
#if ENABLED(CUSTOM_USER_BUTTONS) #if ENABLED(CUSTOM_USER_BUTTONS)
// Handle a custom user button if defined // Handle a custom user button if defined
const bool printer_not_busy = !printingIsActive(); const bool printer_not_busy = !printingIsActive();
const millis_t ms = millis();
#define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(BUTTON##N) && defined(BUTTON##N##_HIT_STATE) && defined(BUTTON##N##_GCODE)) #define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(BUTTON##N) && defined(BUTTON##N##_HIT_STATE) && defined(BUTTON##N##_GCODE))
#define HAS_BETTER_USER_BUTTON(N) HAS_CUSTOM_USER_BUTTON(N) && defined(BUTTON##N##_DESC) #define HAS_BETTER_USER_BUTTON(N) HAS_CUSTOM_USER_BUTTON(N) && defined(BUTTON##N##_DESC)
#define _CHECK_CUSTOM_USER_BUTTON(N, CODE) do{ \ #define _CHECK_CUSTOM_USER_BUTTON(N, CODE) do{ \