v5.8.0a - Fix GPIOx JSON response

5.8.0a
 * Add translations to I2Cscan
 * Add translation to BH1750 unit
lx
 * Set default WS2812 pixel count to WS2812_LEDS
 * Fix command GPIOx
JSON response (#897)
This commit is contained in:
Theo Arends 2017-09-23 11:12:16 +02:00
parent 9bad9e18c6
commit 33e116ccb9
8 changed files with 37 additions and 43 deletions

View File

@ -1,7 +1,7 @@
## Sonoff-Tasmota ## Sonoff-Tasmota
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
Current version is **5.7.1j** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. Current version is **5.8.0a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
### ATTENTION All versions ### ATTENTION All versions

View File

@ -1,47 +1,34 @@
/* 5.7.1j /* 5.8.0a
* Add translations to I2Cscan
* Add translation to BH1750 unit lx
* Set default WS2812 pixel count to WS2812_LEDS
* Fix GPIOx JSON response (#897)
*
* 5.8.0 20170918
* Remove the need for NeoPixelBus library for Hue support * Remove the need for NeoPixelBus library for Hue support
* Reintroduce xdrv_ws2812 for flexible future library changes * Consolidate WS2812 into Sonoff Led for flexible future led strip library changes
* Fix basic On, Off, Toggle, Blink and BlinkOff commands when other language is selected (#874)
*
* 5.7.1i
* Add blink to WS2812 and Sonoff Led (#643)
*
* 5.7.1h
* Consolidate WS2812 (xdrv_ws2812) into Sonoff Led (xdrv_snfled)
* Invert WS2812 fade speed to align with Sonoff led (Speed 1 = fast, Speed 8 = slow) * Invert WS2812 fade speed to align with Sonoff led (Speed 1 = fast, Speed 8 = slow)
* Remove upper case MQTT receive buffer * Remove upper case MQTT receive buffer
*
* 5.7.1g
* Add option WIFI_WAIT (5) to command WifiConfig to allow connection retry to same AP without restart or update flash (#772, #869)
*
* 5.7.1f
* Reduce code and string length for output of commands Modules and GPIOs * Reduce code and string length for output of commands Modules and GPIOs
* Add optional dimmer parameter to command Wakeup for AiLight, Sonoff B1, Led and BN-SZ01 (#867)
*
* 5.7.1e
* Add Sonoff SC debug information * Add Sonoff SC debug information
* Change syslog service * Change syslog service
*
* 5.7.1d
* Fix watchdog timeout caused by lack of stack space by now using global buffers (#853)
* Removed webserver syslog disable as now no longer needed * Removed webserver syslog disable as now no longer needed
* Increased default MQTT message size from 368 to 405 bytes while keeping MQTT_MAX_PACKET_SIZE = 512 (because we can) * Increased default MQTT message size from 368 to 405 bytes while keeping MQTT_MAX_PACKET_SIZE = 512 (because we can)
* Fix MQTT Offline or Remove MQTT retained topic code * Fix MQTT Offline or Remove MQTT retained topic code
* Allow command SwitchTopic in group mode (#861)
* Allow command SwitchMode if no switches are defined (#861)
*
* 5.7.1c
* Allow LogPort and MqttPort up to 65535 and add LogPort tot Status 3 (#859)
*
* 5.7.1b
* Add timeout to DHT and DS18B20 sensors (#852)
*
* 5.7.1a
* Fix Domoticz loop when Emulation is selected * Fix Domoticz loop when Emulation is selected
* Add GPIO14 to Sonoff Dual (#797, #839) * Add blink to WS2812 and Sonoff Led (#643)
* Add option WIFI_WAIT (5) to command WifiConfig to allow connection retry to same AP without restart or update flash (#772, #869)
* Add support for Witty Cloud (#794) * Add support for Witty Cloud (#794)
* Add GPIO14 to Sonoff Dual (#797, #839)
* Add support for Yunshan Wifi Relay (#802) * Add support for Yunshan Wifi Relay (#802)
* Add GPIO16 input pulldown (#827) * Add GPIO16 input pulldown (#827)
* Add timeout to DHT and DS18B20 sensors (#852)
* Fix watchdog timeout caused by lack of stack space by moving to heap (#853)
* Allow LogPort and MqttPort up to 65535 and add LogPort tot Status 3 (#859)
* Allow command SwitchTopic in group mode (#861)
* Allow command SwitchMode if no switches are defined (#861)
* Add optional dimmer parameter to command Wakeup for WS2812, AiLight, Sonoff B1, Led and BN-SZ01 (#867)
* Fix basic On, Off, Toggle, Blink and BlinkOff commands when other language is selected (#874)
* *
* 5.7.1 20170909 * 5.7.1 20170909
* Remove leading spaces from MQTT data * Remove leading spaces from MQTT data

View File

@ -459,11 +459,15 @@
#define D_SENSOR_LED "Led" // Suffix "1I" #define D_SENSOR_LED "Led" // Suffix "1I"
#define D_SENSOR_PWM "PWM" // Suffix "1" #define D_SENSOR_PWM "PWM" // Suffix "1"
#define D_SENSOR_COUNTER "Counter" // Suffix "1" #define D_SENSOR_COUNTER "Counter" // Suffix "1"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BLight"
// Units // Units
#define D_UNIT_AMPERE "A" #define D_UNIT_AMPERE "A"
#define D_UNIT_HOUR "Hr" #define D_UNIT_HOUR "Hr"
#define D_UNIT_KILOWATTHOUR "kWh" #define D_UNIT_KILOWATTHOUR "kWh"
#define D_UNIT_LUX "lx"
#define D_UNIT_MICROSECOND "us" #define D_UNIT_MICROSECOND "us"
#define D_UNIT_MILLIAMPERE "mA" #define D_UNIT_MILLIAMPERE "mA"
#define D_UNIT_MILLISECOND "ms" #define D_UNIT_MILLISECOND "ms"
@ -491,11 +495,11 @@
#define D_LOG_MQTT "MQT: " #define D_LOG_MQTT "MQT: "
#define D_LOG_OTHER "OTH: " #define D_LOG_OTHER "OTH: "
#define D_LOG_RESULT "RSL: " #define D_LOG_RESULT "RSL: "
#define D_LOG_SERIAL "SER: "
#define D_LOG_SHT1 "SHT: " #define D_LOG_SHT1 "SHT: "
#define D_LOG_UPLOAD "UPL: " #define D_LOG_UPLOAD "UPL: "
#define D_LOG_UPNP "UPP: " #define D_LOG_UPNP "UPP: "
#define D_LOG_WIFI "WIF: " #define D_LOG_WIFI "WIF: "
#define D_LOG_SERIAL "SER: "
// Result // Result
#define D_RSLT_RESULT "RESULT" #define D_RSLT_RESULT "RESULT"

View File

@ -459,11 +459,15 @@
#define D_SENSOR_LED "Led" // Suffix "1I" #define D_SENSOR_LED "Led" // Suffix "1I"
#define D_SENSOR_PWM "PWM" // Suffix "1" #define D_SENSOR_PWM "PWM" // Suffix "1"
#define D_SENSOR_COUNTER "Teller" // Suffix "1" #define D_SENSOR_COUNTER "Teller" // Suffix "1"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BLight"
// Units // Units
#define D_UNIT_AMPERE "A" #define D_UNIT_AMPERE "A"
#define D_UNIT_HOUR "Hr" #define D_UNIT_HOUR "Hr"
#define D_UNIT_KILOWATTHOUR "kWh" #define D_UNIT_KILOWATTHOUR "kWh"
#define D_UNIT_LUX "lx"
#define D_UNIT_MICROSECOND "us" #define D_UNIT_MICROSECOND "us"
#define D_UNIT_MILLIAMPERE "mA" #define D_UNIT_MILLIAMPERE "mA"
#define D_UNIT_MILLISECOND "ms" #define D_UNIT_MILLISECOND "ms"
@ -491,11 +495,11 @@
#define D_LOG_MQTT "MQT: " #define D_LOG_MQTT "MQT: "
#define D_LOG_OTHER "OTH: " #define D_LOG_OTHER "OTH: "
#define D_LOG_RESULT "RSL: " #define D_LOG_RESULT "RSL: "
#define D_LOG_SERIAL "SER: "
#define D_LOG_SHT1 "SHT: " #define D_LOG_SHT1 "SHT: "
#define D_LOG_UPLOAD "UPL: " #define D_LOG_UPLOAD "UPL: "
#define D_LOG_UPNP "UPP: " #define D_LOG_UPNP "UPP: "
#define D_LOG_WIFI "WIF: " #define D_LOG_WIFI "WIF: "
#define D_LOG_SERIAL "SER: "
// Result // Result
#define D_RSLT_RESULT "RESULTAAT" #define D_RSLT_RESULT "RESULTAAT"

View File

@ -500,9 +500,8 @@ void CFG_DefaultSet2()
// 5.4.1 // 5.4.1
memcpy_P(sysCfg.sfb_code[0], sfb_codeDefault, 9); memcpy_P(sysCfg.sfb_code[0], sfb_codeDefault, 9);
// 5.7.1g // 5.8.0
sysCfg.led_pixels = WS2812_LEDS; sysCfg.led_pixels = WS2812_LEDS;
} }
/********************************************************************************************/ /********************************************************************************************/
@ -711,7 +710,7 @@ void CFG_Delta()
} }
memcpy_P(sysCfg.sfb_code[0], sfb_codeDefault, 9); memcpy_P(sysCfg.sfb_code[0], sfb_codeDefault, 9);
} }
if (sysCfg.version < 0x05070108) { if (sysCfg.version < 0x05080000) {
uint8_t cfg_wsflg = 0; uint8_t cfg_wsflg = 0;
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < MAX_GPIO_PIN; i++) {
if (GPIO_WS2812 == sysCfg.my_module.gp.io[i]) { if (GPIO_WS2812 == sysCfg.my_module.gp.io[i]) {

View File

@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)" - Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/ ====================================================*/
#define VERSION 0x0507010A // 5.7.1j #define VERSION 0x05080001 // 5.8.0a
enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL}; enum log_t {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL};
enum week_t {Last, First, Second, Third, Fourth}; enum week_t {Last, First, Second, Third, Fourth};
@ -1213,7 +1213,7 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len)
} }
jsflg = 1; jsflg = 1;
snprintf_P(stemp1, sizeof(stemp1), sensors[sysCfg.my_module.gp.io[i]]); snprintf_P(stemp1, sizeof(stemp1), sensors[sysCfg.my_module.gp.io[i]]);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_GPIO "%d\":%d (%s)"), mqtt_data, i, sysCfg.my_module.gp.io[i], stemp1); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_GPIO "%d\":\"%d (%s)\""), mqtt_data, i, sysCfg.my_module.gp.io[i], stemp1);
} }
} }
if (jsflg) { if (jsflg) {

View File

@ -790,7 +790,7 @@ void i2c_scan(char *devs, unsigned int devs_len)
byte any = 0; byte any = 0;
char tstr[10]; char tstr[10];
snprintf_P(devs, devs_len, PSTR("{\"I2Cscan\":\"Device(s) found at")); snprintf_P(devs, devs_len, PSTR("{\"" D_CMND_I2CSCAN "\":\"" D_I2CSCAN_DEVICES_FOUND_AT));
for (address = 1; address <= 127; address++) { for (address = 1; address <= 127; address++) {
Wire.beginTransmission(address); Wire.beginTransmission(address);
error = Wire.endTransmission(); error = Wire.endTransmission();
@ -800,13 +800,13 @@ void i2c_scan(char *devs, unsigned int devs_len)
any = 1; any = 1;
} }
else if (4 == error) { else if (4 == error) {
snprintf_P(devs, devs_len, PSTR("{\"I2Cscan\":\"Unknown error at 0x%2x\"}"), address); snprintf_P(devs, devs_len, PSTR("{\"" D_CMND_I2CSCAN "\":\"" D_I2CSCAN_UNKNOWN_ERROR_AT " 0x%2x\"}"), address);
} }
} }
if (any) { if (any) {
strncat(devs, "\"}", devs_len); strncat(devs, "\"}", devs_len);
} else { } else {
snprintf_P(devs, devs_len, PSTR("{\"I2Cscan\":\"No devices found\"}")); snprintf_P(devs, devs_len, PSTR("{\"" D_CMND_I2CSCAN "\":\"" D_I2CSCAN_NO_DEVICES_FOUND "\"}"));
} }
} }
#endif // USE_I2C #endif // USE_I2C

View File

@ -94,7 +94,7 @@ void bh1750_mqttPresent(uint8_t* djson)
#ifdef USE_WEBSERVER #ifdef USE_WEBSERVER
const char HTTP_SNS_ILLUMINANCE[] PROGMEM = const char HTTP_SNS_ILLUMINANCE[] PROGMEM =
"<tr><th>BH1750 " D_ILLUMINANCE "</th><td>%d lx</td></tr>"; "<tr><th>BH1750 " D_ILLUMINANCE "</th><td>%d " D_UNIT_LUX "</td></tr>";
String bh1750_webPresent() String bh1750_webPresent()
{ {