Bug in last AUDIO optimizations
This commit is contained in:
+1
-20
@@ -161,25 +161,6 @@ void audioDefevent(uint8_t e);
|
|||||||
#define AUDIO_MIX_WARNING_1() audioDefevent(AU_MIX_WARNING_1)
|
#define AUDIO_MIX_WARNING_1() audioDefevent(AU_MIX_WARNING_1)
|
||||||
#define AUDIO_MIX_WARNING_3() audioDefevent(AU_MIX_WARNING_3)
|
#define AUDIO_MIX_WARNING_3() audioDefevent(AU_MIX_WARNING_3)
|
||||||
|
|
||||||
#if defined(PCBSTD)
|
#define AUDIO_HEARTBEAT() audio.heartbeat()
|
||||||
#define AUDIO_HEARTBEAT() \
|
|
||||||
if (audio.toneTimeLeft > 0) { \
|
|
||||||
static uint8_t toneCounter; \
|
|
||||||
toneCounter += audio.toneFreq; \
|
|
||||||
if ((toneCounter & 0x80) == 0x80) \
|
|
||||||
PORTE |= (1 << OUT_E_BUZZER); \
|
|
||||||
else \
|
|
||||||
PORTE &= ~(1 << OUT_E_BUZZER); \
|
|
||||||
} \
|
|
||||||
static uint8_t cnt10ms = 77; \
|
|
||||||
if (cnt10ms-- == 0) \
|
|
||||||
cnt10ms = 77; \
|
|
||||||
else \
|
|
||||||
return; \
|
|
||||||
audio.heartbeat()
|
|
||||||
#else
|
|
||||||
#define AUDIO_HEARTBEAT() \
|
|
||||||
audio.heartbeat()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // audio_h
|
#endif // audio_h
|
||||||
|
|||||||
+21
-1
@@ -1776,7 +1776,23 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
|||||||
|
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
AUDIO_HEARTBEAT();
|
#if defined (PCBSTD) && defined (AUDIO)
|
||||||
|
if (audio.toneTimeLeft > 0) {
|
||||||
|
static uint8_t toneCounter;
|
||||||
|
toneCounter += audio.toneFreq;
|
||||||
|
if ((toneCounter & 0x80) == 0x80)
|
||||||
|
PORTE |= (1 << OUT_E_BUZZER);
|
||||||
|
else
|
||||||
|
PORTE &= ~(1 << OUT_E_BUZZER);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t cnt10ms = 77; // execute 10ms code once every 78 ISRs
|
||||||
|
if (cnt10ms-- == 0) { // BEGIN { ... every 10ms ... }
|
||||||
|
// Begin 10ms event
|
||||||
|
cnt10ms = 77;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
AUDIO_HEARTBEAT();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Record start time from TCNT1 to record excution time
|
// Record start time from TCNT1 to record excution time
|
||||||
@@ -1801,6 +1817,10 @@ ISR(TIMER0_COMP_vect, ISR_NOBLOCK) //10ms timer
|
|||||||
g_time_per10 = dt2 - dt; // NOTE: These spike to nearly 65535 just now and then. Why? :/
|
g_time_per10 = dt2 - dt; // NOTE: These spike to nearly 65535 just now and then. Why? :/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (PCBSTD) && defined (AUDIO)
|
||||||
|
} // end 10ms event
|
||||||
|
#endif
|
||||||
|
|
||||||
cli();
|
cli();
|
||||||
#if defined (PCBV4)
|
#if defined (PCBV4)
|
||||||
TIMSK2 |= (1<<OCIE2A);
|
TIMSK2 |= (1<<OCIE2A);
|
||||||
|
|||||||
Reference in New Issue
Block a user