Browse Source

Each relay has its own pulse ticker. This fixes issue #149

fastled
Lauris 7 years ago
parent
commit
2eed5f4ac2
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      code/espurna/relay.ino

+ 3
- 3
code/espurna/relay.ino View File

@ -21,9 +21,9 @@ typedef struct {
unsigned int scheduledStatusTime; unsigned int scheduledStatusTime;
bool scheduledStatus; bool scheduledStatus;
bool scheduledReport; bool scheduledReport;
Ticker pulseTicker;
} relay_t; } relay_t;
std::vector<relay_t> _relays; std::vector<relay_t> _relays;
Ticker pulseTicker;
bool recursive = false; bool recursive = false;
#if RELAY_PROVIDER == RELAY_PROVIDER_DUAL #if RELAY_PROVIDER == RELAY_PROVIDER_DUAL
@ -105,11 +105,11 @@ void relayPulse(unsigned char id) {
bool status = relayStatus(id); bool status = relayStatus(id);
bool pulseStatus = (relayPulseMode == RELAY_PULSE_ON); bool pulseStatus = (relayPulseMode == RELAY_PULSE_ON);
if (pulseStatus == status) { if (pulseStatus == status) {
pulseTicker.detach();
_relays[id].pulseTicker.detach();
return; return;
} }
pulseTicker.once(
_relays[id].pulseTicker.once(
getSetting("relayPulseTime", RELAY_PULSE_TIME).toInt(), getSetting("relayPulseTime", RELAY_PULSE_TIME).toInt(),
relayToggle, relayToggle,
id id


Loading…
Cancel
Save