Browse Source

Enable revert state mode

fastled
Ly Minh Phuong 8 years ago
committed by Xose Pérez
parent
commit
c7e9074510
4 changed files with 13 additions and 2 deletions
  1. +1
    -0
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +11
    -2
      code/espurna/relay.ino
  4. +1
    -0
      code/html/index.html

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

@ -14,6 +14,7 @@
#define RELAY_MODE_OFF 0
#define RELAY_MODE_ON 1
#define RELAY_MODE_SAME 2
#define RELAY_MODE_TOOGLE 3
#define RELAY_SYNC_ANY 0
#define RELAY_SYNC_NONE_OR_ONE 1


BIN
code/espurna/data/index.html.gz View File


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

@ -212,14 +212,17 @@ void relaySave() {
EEPROM.commit();
}
void relayRetrieve() {
void relayRetrieve(bool invert) {
recursive = true;
unsigned char bit = 1;
unsigned char mask = EEPROM.read(0);
unsigned char mask = invert ? ~EEPROM.read(0) : EEPROM.read(0);
for (unsigned int i=0; i < _relays.size(); i++) {
relayStatus(i, ((mask & bit) == bit));
bit += bit;
}
if (invert) {
relaySave();
}
recursive = false;
}
@ -454,7 +457,13 @@ void relaySetup() {
if (relayMode == RELAY_MODE_OFF) relayStatus(i, false);
if (relayMode == RELAY_MODE_ON) relayStatus(i, true);
}
<<<<<<< HEAD
if (relayMode == RELAY_MODE_SAME) relayRetrieve();
=======
if (relayMode == RELAY_MODE_SAME) relayRetrieve(false);
if (relayMode == RELAY_MODE_TOOGLE) relayRetrieve(true);
>>>>>>> Enable revert state mode
relaySetupAPI();
relaySetupMQTT();


+ 1
- 0
code/html/index.html View File

@ -201,6 +201,7 @@
<option value="0">Always OFF</a>
<option value="1">Always ON</a>
<option value="2">Same as before</a>
<option value="3">Toogle before</a>
</select>
</div>
<div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>


Loading…
Cancel
Save