|
@@ -502,19 +502,16 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
502
|
502
|
#endif
|
503
|
503
|
|
504
|
504
|
#if HAS_HOME
|
505
|
|
- // Check to see if we have to home, use poor man's debouncer
|
506
|
|
- // ---------------------------------------------------------
|
507
|
|
- static int homeDebounceCount = 0; // poor man's debouncing count
|
508
|
|
- const int HOME_DEBOUNCE_DELAY = 2500;
|
509
|
|
- if (!IS_SD_PRINTING() && !READ(HOME_PIN)) {
|
510
|
|
- if (!homeDebounceCount) {
|
511
|
|
- queue.inject_P(PSTR("G28"));
|
|
505
|
+ // Handle a standalone HOME button
|
|
506
|
+ constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL;
|
|
507
|
+ static millis_t next_home_key_ms; // = 0
|
|
508
|
+ if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed
|
|
509
|
+ const millis_t ms = millis();
|
|
510
|
+ if (ELAPSED(ms, next_home_key_ms)) {
|
|
511
|
+ next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
|
512
|
512
|
LCD_MESSAGEPGM(MSG_AUTO_HOME);
|
|
513
|
+ queue.enqueue_now_P(PSTR("G28"));
|
513
|
514
|
}
|
514
|
|
- if (homeDebounceCount < HOME_DEBOUNCE_DELAY)
|
515
|
|
- homeDebounceCount++;
|
516
|
|
- else
|
517
|
|
- homeDebounceCount = 0;
|
518
|
515
|
}
|
519
|
516
|
#endif
|
520
|
517
|
|