Browse Source

Fixed error in relay identification from MQTT messages (issue #31)

fastled 1.4.2
Xose Pérez 8 years ago
parent
commit
9ce457fa86
5 changed files with 16 additions and 6 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +1
    -1
      README.md
  3. +1
    -1
      code/espurna/config/version.h
  4. +5
    -2
      code/espurna/led.ino
  5. +5
    -2
      code/espurna/relay.ino

+ 4
- 0
CHANGELOG.md View File

@ -3,6 +3,10 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.4.2] 2017-01-09
### Fixed
- Fixed error in relay identification from MQTT messages (issue #31)
## [1.4.1] 2017-01-05
### Added
- Alexa support by default on all devices


+ 1
- 1
README.md View File

@ -4,7 +4,7 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8266 based smart switch
It was originally developed with the **[IteadStudio Sonoff](https://www.itead.cc/sonoff-wifi-wireless-switch.html)** in mind but now it supports a growing number of ESP8266-based boards.
It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries.
**Current Release Version is 1.4.1**, read the [changelog](CHANGELOG.md).
**Current Release Version is 1.4.2**, read the [changelog](CHANGELOG.md).
## Features


+ 1
- 1
code/espurna/config/version.h View File

@ -1,4 +1,4 @@
#define APP_NAME "ESPurna"
#define APP_VERSION "1.4.1"
#define APP_VERSION "1.4.2"
#define APP_AUTHOR "xose.perez@gmail.com"
#define APP_WEBSITE "http://tinkerman.cat"

+ 5
- 2
code/espurna/led.ino View File

@ -79,8 +79,11 @@ void ledMQTTCallback(unsigned int type, const char * topic, const char * payload
if (!t.endsWith(mqttSetter)) return;
// Get led ID
unsigned int ledID = topic[strlen(MQTT_LED_TOPIC)+1] - '0';
if (ledID >= ledCount()) ledID = 0;
unsigned int ledID = topic[strlen(topic) - mqttSetter.length() - 1] - '0';
if (ledID >= ledCount()) {
DEBUG_MSG("[LED] Wrong ledID (%d)\n", ledID);
return;
}
// get value
unsigned int value = (char)payload[0] - '0';


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

@ -203,8 +203,11 @@ void relayMQTTCallback(unsigned int type, const char * topic, const char * paylo
if (!t.endsWith(mqttSetter)) return;
// Get relay ID
unsigned int relayID = topic[strlen(MQTT_RELAY_TOPIC)+1] - '0';
if (relayID >= relayCount()) relayID = 0;
unsigned int relayID = topic[strlen(topic) - mqttSetter.length() - 1] - '0';
if (relayID >= relayCount()) {
DEBUG_MSG("[RELAY] Wrong relayID (%d)\n", relayID);
return;
}
// Action to perform
unsigned int value = (char)payload[0] - '0';


Loading…
Cancel
Save