Fix PWM software watchdogs

Fix PWM software watchdogs by correctly initializing variables (#8721)
This commit is contained in:
Theo Arends 2020-06-23 17:28:15 +02:00
parent 7784156376
commit 6e8928b8a1
2 changed files with 6 additions and 6 deletions

View File

@ -133,9 +133,9 @@ constexpr int maxPWMs = 8;
// PWM machine state
typedef struct PWMState {
uint32_t mask; // Bitmask of active pins
uint32_t cnt; // How many entries
uint32_t idx; // Where the state machine is along the list
uint32_t mask = 0; // Bitmask of active pins
uint32_t cnt = 0; // How many entries
uint32_t idx = 0; // Where the state machine is along the list
uint8_t pin[maxPWMs + 1];
uint32_t delta[maxPWMs + 1];
uint32_t nextServiceCycle; // Clock cycle for next step
@ -528,7 +528,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
// Done, remove!
if (i == 16) {
GP16O = 0;
}
}
GPOC = mask;
wvfState.waveformEnabled &= ~mask;
continue;

View File

@ -153,8 +153,8 @@ void ICACHE_RAM_ATTR interrupt_handler(void*)
while(!(changedbits & (1 << i))) i++;
changedbits &= ~(1 << i);
interrupt_handler_t *handler = &interrupt_handlers[i];
if (handler->fn &&
(handler->mode == CHANGE ||
if (handler->fn &&
(handler->mode == CHANGE ||
(handler->mode & 1) == !!(levels & (1 << i)))) {
// to make ISR compatible to Arduino AVR model where interrupts are disabled
// we disable them before we call the client ISR