Skip to content

Commit

Permalink
Simplify filament_change_beep function
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 15, 2017
1 parent 8289ea1 commit bfe6f71
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7294,18 +7294,12 @@ inline void gcode_M503() {
unsigned long int runout_beep = 0;

void filament_change_beep() {
millis_t ms = millis();
if (ms >= next_buzz) {
if (runout_beep <= FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS ) { // Only beep as long as we are supposed to!
BUZZ(300, 2000);
next_buzz = ms + 2500; // Beep every 2.5s while waiting
runout_beep++;
}
else if (runout_beep > FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS &&
runout_beep <= (FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS + 5)) { // End with a burst of short beeps
BUZZ(200, 2000);
next_buzz = ms + 400; // Beep
runout_beep++;
const millis_t ms = millis();
if (ELAPSED(ms, next_buzz)) {
if (runout_beep <= FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS + 5) { // Only beep as long as we're supposed to
next_buzz = ms + (runout_beep <= FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS ? 2500 : 400);
BUZZ(300, 2000);
runout_beep++;
}
}
}
Expand Down

0 comments on commit bfe6f71

Please sign in to comment.