Browse Source

Prevent the 'tone(f,d)' function from being interrupted

Scott Lahteine 8 years ago
parent
commit
6110d57c16
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      Marlin/buzzer.h

+ 3
- 0
Marlin/buzzer.h View File

23
 #ifndef __BUZZER_H__
23
 #ifndef __BUZZER_H__
24
 #define __BUZZER_H__
24
 #define __BUZZER_H__
25
 
25
 
26
+#include "types.h"
26
 #include "fastio.h"
27
 #include "fastio.h"
27
 #include "circularqueue.h"
28
 #include "circularqueue.h"
28
 #include "temperature.h"
29
 #include "temperature.h"
127
 
128
 
128
         if (this->state.tone.frequency > 0) {
129
         if (this->state.tone.frequency > 0) {
129
           #if ENABLED(SPEAKER)
130
           #if ENABLED(SPEAKER)
131
+            CRITICAL_SECTION_START;
130
             ::tone(BEEPER_PIN, this->state.tone.frequency, this->state.tone.duration);
132
             ::tone(BEEPER_PIN, this->state.tone.frequency, this->state.tone.duration);
133
+            CRITICAL_SECTION_END;
131
           #else
134
           #else
132
             this->on();
135
             this->on();
133
           #endif
136
           #endif

Loading…
Cancel
Save