Browse Source

Delayed relay state saving into EEPROM

fastled
Xose Pérez 7 years ago
parent
commit
6ccd000280
2 changed files with 5 additions and 1 deletions
  1. +3
    -0
      code/espurna/config/general.h
  2. +2
    -1
      code/espurna/relay.ino

+ 3
- 0
code/espurna/config/general.h View File

@ -196,6 +196,9 @@ PROGMEM const char* const custom_reset_string[] = {
// Pulse with in milliseconds for a latched relay
#define RELAY_LATCHING_PULSE 10
// Do not save relay state after these many milliseconds
#define RELAY_SAVE_DELAY 1000
//------------------------------------------------------------------------------
// I18N
//------------------------------------------------------------------------------


+ 2
- 1
code/espurna/relay.ino View File

@ -29,6 +29,7 @@ typedef struct {
} relay_t;
std::vector<relay_t> _relays;
bool recursive = false;
Ticker _relaySaveTicker;
#if RELAY_PROVIDER == RELAY_PROVIDER_DUAL
unsigned char _dual_status = 0;
@ -528,7 +529,7 @@ void relayLoop(void) {
if (!recursive) {
relayPulse(id);
relaySync(id);
relaySave();
_relaySaveTicker.once_ms(RELAY_SAVE_DELAY, relaySave);
#if WEB_SUPPORT
relayWS();
#endif


Loading…
Cancel
Save