mirror of https://github.com/arendst/Tasmota.git
Add hexadecimal Data entry to command IrSend
5.12.0i * Add hexadecimal Data entry to command IrSend using 0x notation (#1290, #2314)
This commit is contained in:
parent
f3c553f3da
commit
883fa4ce8d
|
@ -2,6 +2,7 @@
|
||||||
* Add 16 timers using commands Timer and Timers (#1091)
|
* Add 16 timers using commands Timer and Timers (#1091)
|
||||||
* Add commands Timer 0 to clear timer and Timer 1..16 to copy timer
|
* 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 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 Domoticz Battery and RSSI Quality (#1604)
|
||||||
* Add Home Assistant MQTT Discovery for Buttons and change SetOption19 response (#2277)
|
* Add Home Assistant MQTT Discovery for Buttons and change SetOption19 response (#2277)
|
||||||
* Add support for SGP30 gas and air quality sensor (#2307)
|
* Add support for SGP30 gas and air quality sensor (#2307)
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
* Change webpage parameter communication
|
* Change webpage parameter communication
|
||||||
* Change Timer parameter Device to more obvious Output
|
* Change Timer parameter Device to more obvious Output
|
||||||
* Change max number of commands in Backlog from 15 to 30 and ignore commands overflowing
|
* 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 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)
|
* Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
|
||||||
*
|
*
|
||||||
|
|
|
@ -284,26 +284,25 @@ boolean IrSendCommand()
|
||||||
uint32_t bits = 0;
|
uint32_t bits = 0;
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
|
|
||||||
for (uint16_t i = 0; i <= sizeof(dataBufUc); i++) {
|
UpperCase(dataBufUc, XdrvMailbox.data);
|
||||||
dataBufUc[i] = toupper(XdrvMailbox.data[i]);
|
|
||||||
}
|
|
||||||
if (!strcasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_IRSEND))) {
|
if (!strcasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_IRSEND))) {
|
||||||
if (XdrvMailbox.data_len) {
|
if (XdrvMailbox.data_len) {
|
||||||
StaticJsonBuffer<128> jsonBuf;
|
StaticJsonBuffer<128> jsonBuf;
|
||||||
JsonObject &ir_json = jsonBuf.parseObject(dataBufUc);
|
JsonObject &root = jsonBuf.parseObject(dataBufUc);
|
||||||
if (!ir_json.success()) {
|
if (!root.success()) {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_INVALID_JSON "\"}")); // JSON decode failed
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_INVALID_JSON "\"}")); // JSON decode failed
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_DONE "\"}"));
|
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_DONE "\"}"));
|
||||||
protocol = ir_json[D_JSON_IR_PROTOCOL];
|
char parm_uc[10];
|
||||||
bits = ir_json[D_JSON_IR_BITS];
|
protocol = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_PROTOCOL))];
|
||||||
data = ir_json[D_JSON_IR_DATA];
|
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) {
|
if (protocol && bits && data) {
|
||||||
int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols);
|
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"),
|
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, protocol_code);
|
protocol_text, protocol, bits, data, data, protocol_code);
|
||||||
AddLog(LOG_LEVEL_DEBUG);
|
AddLog(LOG_LEVEL_DEBUG);
|
||||||
|
|
||||||
switch (protocol_code) {
|
switch (protocol_code) {
|
||||||
|
|
Loading…
Reference in New Issue