Merge pull request #24 from arendst/development

sync with tasmota repo
This commit is contained in:
Adrian 2018-04-02 13:40:48 -03:00 committed by GitHub
commit 28d91eec53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View File

@ -2,13 +2,16 @@
* Add 16 timers using commands Timer and Timers (#1091)
* Add commands Timer 0 to clear timer and Timer 1..16 to copy timer
* Add optional Timer configuration webpage to be enabled in user_config.h with define USE_TIMERS_WEB
* Add hexadecimal Data entry to command IrSend using 0x notation (#1290, #2314)
* Add Domoticz Battery and RSSI Quality (#1604)
* Add Home Assistant MQTT Discovery for Buttons and change SetOption19 response (#2277)
* Add support for SGP30 gas and air quality sensor (#2307)
* Add multiple color entry support for command Led like Led2 120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue (#2303)
* Add hexadecimal RGB color entry on RGBCW leds (#2304)
* Change webpage parameter communication
* Change Timer parameter Device to more obvious Output
* Change max number of commands in Backlog from 15 to 30 and ignore commands overflowing
* Change user_config_override usage by providing user_config_override_sample.h (#2228)
* Change MQTT response topic for Energy changes from ENERGY to SENSOR (#2229, #2251)
* Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
*

View File

@ -991,11 +991,10 @@ boolean LightColorEntry(char *buffer, uint8_t buffer_length)
light_entry_color[i++] = atoi(str);
}
}
// entry_type = (light_subtype == i) ? 2 : 0; // Decimal
entry_type = 2; // Decimal
}
else if ((2 * light_subtype) == buffer_length) { // Hexadecimal entry
for (byte i = 0; i < light_subtype; i++) {
else if (((2 * light_subtype) == buffer_length) || (buffer_length > 3)) { // Hexadecimal entry
for (byte i = 0; i < buffer_length / 2; i++) {
strlcpy(scolor, buffer + (i *2), 3);
light_entry_color[i] = (uint8_t)strtol(scolor, &p, 16);
}

View File

@ -284,26 +284,25 @@ boolean IrSendCommand()
uint32_t bits = 0;
uint32_t data = 0;
for (uint16_t i = 0; i <= sizeof(dataBufUc); i++) {
dataBufUc[i] = toupper(XdrvMailbox.data[i]);
}
UpperCase(dataBufUc, XdrvMailbox.data);
if (!strcasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_IRSEND))) {
if (XdrvMailbox.data_len) {
StaticJsonBuffer<128> jsonBuf;
JsonObject &ir_json = jsonBuf.parseObject(dataBufUc);
if (!ir_json.success()) {
JsonObject &root = jsonBuf.parseObject(dataBufUc);
if (!root.success()) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_INVALID_JSON "\"}")); // JSON decode failed
}
else {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_DONE "\"}"));
protocol = ir_json[D_JSON_IR_PROTOCOL];
bits = ir_json[D_JSON_IR_BITS];
data = ir_json[D_JSON_IR_DATA];
char parm_uc[10];
protocol = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_PROTOCOL))];
bits = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_BITS))];
data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_DATA))], NULL, 0);
if (protocol && bits && data) {
int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols);
snprintf_P(log_data, sizeof(log_data), PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %d, protocol_code %d"),
protocol_text, protocol, bits, data, protocol_code);
snprintf_P(log_data, sizeof(log_data), PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %u (0x%lX), protocol_code %d"),
protocol_text, protocol, bits, data, data, protocol_code);
AddLog(LOG_LEVEL_DEBUG);
switch (protocol_code) {