mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 20:56:35 +00:00
Fix PWM software watchdogs
Fix PWM software watchdogs by correctly initializing variables (#8721)
This commit is contained in:
parent
7784156376
commit
6e8928b8a1
@ -133,9 +133,9 @@ constexpr int maxPWMs = 8;
|
|||||||
|
|
||||||
// PWM machine state
|
// PWM machine state
|
||||||
typedef struct PWMState {
|
typedef struct PWMState {
|
||||||
uint32_t mask; // Bitmask of active pins
|
uint32_t mask = 0; // Bitmask of active pins
|
||||||
uint32_t cnt; // How many entries
|
uint32_t cnt = 0; // How many entries
|
||||||
uint32_t idx; // Where the state machine is along the list
|
uint32_t idx = 0; // Where the state machine is along the list
|
||||||
uint8_t pin[maxPWMs + 1];
|
uint8_t pin[maxPWMs + 1];
|
||||||
uint32_t delta[maxPWMs + 1];
|
uint32_t delta[maxPWMs + 1];
|
||||||
uint32_t nextServiceCycle; // Clock cycle for next step
|
uint32_t nextServiceCycle; // Clock cycle for next step
|
||||||
@ -528,7 +528,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
|
|||||||
// Done, remove!
|
// Done, remove!
|
||||||
if (i == 16) {
|
if (i == 16) {
|
||||||
GP16O = 0;
|
GP16O = 0;
|
||||||
}
|
}
|
||||||
GPOC = mask;
|
GPOC = mask;
|
||||||
wvfState.waveformEnabled &= ~mask;
|
wvfState.waveformEnabled &= ~mask;
|
||||||
continue;
|
continue;
|
||||||
|
@ -153,8 +153,8 @@ void ICACHE_RAM_ATTR interrupt_handler(void*)
|
|||||||
while(!(changedbits & (1 << i))) i++;
|
while(!(changedbits & (1 << i))) i++;
|
||||||
changedbits &= ~(1 << i);
|
changedbits &= ~(1 << i);
|
||||||
interrupt_handler_t *handler = &interrupt_handlers[i];
|
interrupt_handler_t *handler = &interrupt_handlers[i];
|
||||||
if (handler->fn &&
|
if (handler->fn &&
|
||||||
(handler->mode == CHANGE ||
|
(handler->mode == CHANGE ||
|
||||||
(handler->mode & 1) == !!(levels & (1 << i)))) {
|
(handler->mode & 1) == !!(levels & (1 << i)))) {
|
||||||
// to make ISR compatible to Arduino AVR model where interrupts are disabled
|
// to make ISR compatible to Arduino AVR model where interrupts are disabled
|
||||||
// we disable them before we call the client ISR
|
// we disable them before we call the client ISR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user