Browse Source

Fix relay keys

v2
Xose Pérez 6 years ago
parent
commit
c7fd0025e5
2 changed files with 8 additions and 8 deletions
  1. +1
    -1
      README.md
  2. +7
    -7
      code/espurna/relay.ino

+ 1
- 1
README.md View File

@ -3,7 +3,7 @@
ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smart switches, lights and sensors.
It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries.
[![version](https://img.shields.io/badge/version-1.13.1a-brightgreen.svg)](CHANGELOG.md)
[![version](https://img.shields.io/badge/version-1.13.1z-brightgreen.svg)](CHANGELOG.md)
[![branch](https://img.shields.io/badge/branch-softcfg-orange.svg)](https://github.com/xoseperez/espurna/tree/softcfg/)
[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=softcfg)](https://travis-ci.org/xoseperez/espurna)
[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/softcfg.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard)


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

@ -423,9 +423,9 @@ void _relayBackwards() {
float relayPulseTime = getSetting("relayPulseTime", RELAY_PULSE_TIME).toFloat();
if (relayPulseMode == RELAY_PULSE_NONE) relayPulseTime = 0;
for (unsigned int i=0; i<_relays.size(); i++) {
if (!hasSetting("relayBoot", i)) setSetting("rlyBoot", i, relayMode);
if (!hasSetting("relayPulse", i)) setSetting("rlyPulse", i, relayPulseMode);
if (!hasSetting("relayTime", i)) setSetting("rlyTime", i, relayPulseTime);
if (!hasSetting("rlyBoot", i)) setSetting("rlyBoot", i, relayMode);
if (!hasSetting("rlyPulse", i)) setSetting("rlyPulse", i, relayPulseMode);
if (!hasSetting("rlyTime", i)) setSetting("rlyTime", i, relayPulseTime);
}
delSetting("relayMode");
delSetting("relayPulseMode");
@ -435,7 +435,7 @@ void _relayBackwards() {
moveSettings("relayBoot", "rlyBoot");
moveSettings("relayPulse", "rlyPulse");
moveSettings("relayTime", "rlyTime");
moveSetting("relayOnDisc", "rlyOnDisc");
moveSettings("relayOnDisc", "rlyOnDisc");
moveSetting("relaySync", "rlySync");
}
@ -454,7 +454,7 @@ void _relayBoot() {
// Walk the relays
bool status = false;
for (unsigned int i=0; i<_relays.size(); i++) {
unsigned char boot_mode = getSetting("relayBoot", i, RELAY_BOOT_MODE).toInt();
unsigned char boot_mode = getSetting("rlyBoot", i, RELAY_BOOT_MODE).toInt();
DEBUG_MSG_P(PSTR("[RELAY] Relay #%d boot mode %d\n"), i, boot_mode);
switch (boot_mode) {
case RELAY_BOOT_SAME:
@ -511,7 +511,7 @@ void _relayConfigure() {
#if WEB_SUPPORT
bool _relayWebSocketOnReceive(const char * key, JsonVariant& value) {
return (strncmp(key, "relay", 5) == 0);
return (strncmp(key, "rly", 3) == 0);
}
void _relayWebSocketUpdate(JsonObject& root) {
@ -535,7 +535,7 @@ void _relayWebSocketOnStart(JsonObject& root) {
line["gpio"] = _relays[i].pin;
line["type"] = _relays[i].type;
line["reset"] = _relays[i].reset_pin;
line["boot"] = getSetting("relayBoot", i, RELAY_BOOT_MODE).toInt();
line["boot"] = getSetting("rlyBoot", i, RELAY_BOOT_MODE).toInt();
line["pulse"] = _relays[i].pulse;
line["pulse_ms"] = _relays[i].pulse_ms / 1000.0;
#if MQTT_SUPPORT


Loading…
Cancel
Save