Browse Source

Two strategies to address a stuck buzzer

Scott Lahteine 8 years ago
parent
commit
71674059c3
2 changed files with 4 additions and 2 deletions
  1. 1
    1
      Marlin/buzzer.h
  2. 3
    1
      Marlin/ultralcd.cpp

+ 1
- 1
Marlin/buzzer.h View File

124
         this->state.timestamp = millis() + this->state.tone.duration;
124
         this->state.timestamp = millis() + this->state.tone.duration;
125
         if (this->state.tone.frequency > 0) this->on();
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 View File

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

Loading…
Cancel
Save