diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 2c5c80c70..d5fed07f2 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -2,6 +2,7 @@ * 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) @@ -9,6 +10,7 @@ * 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) * diff --git a/sonoff/xdrv_02_irremote.ino b/sonoff/xdrv_02_irremote.ino index 94f57baae..896faa37a 100644 --- a/sonoff/xdrv_02_irremote.ino +++ b/sonoff/xdrv_02_irremote.ino @@ -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) {