Pārlūkot izejas kodu

Two strategies to address a stuck buzzer

Scott Lahteine 8 gadus atpakaļ
vecāks
revīzija
71674059c3
2 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 1
    1
      Marlin/buzzer.h
  2. 3
    1
      Marlin/ultralcd.cpp

+ 1
- 1
Marlin/buzzer.h Parādīt failu

@@ -124,7 +124,7 @@ class Buzzer {
124 124
         this->state.timestamp = millis() + this->state.tone.duration;
125 125
         if (this->state.tone.frequency > 0) this->on();
126 126
       }
127
-      else if (millis() >= this->state.timestamp) this->reset();
127
+      else if (ELAPSED(millis(), this->state.timestamp)) this->reset();
128 128
     }
129 129
 };
130 130
 

+ 3
- 1
Marlin/ultralcd.cpp Parādīt failu

@@ -2334,12 +2334,14 @@ void kill_screen(const char* lcd_msg) {
2334 2334
     lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
2335 2335
     next_button_update_ms = millis() + 500;
2336 2336
 
2337
+    // Buzz and wait. The delay is needed for buttons to settle!
2337 2338
     #if ENABLED(LCD_USE_I2C_BUZZER)
2338 2339
       lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
2340
+      delay(10);
2339 2341
     #elif PIN_EXISTS(BEEPER)
2340 2342
       buzzer.tone(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
2343
+      for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); }
2341 2344
     #endif
2342
-    delay(10); // needed for buttons to settle
2343 2345
   }
2344 2346
 
2345 2347
   /**

Notiek ielāde…
Atcelt
Saglabāt