From 22f0b9b0d3095bbf5461f4d47ea32f83bc5654d6 Mon Sep 17 00:00:00 2001 From: "Alex. Tircovnicu" Date: Fri, 14 Aug 2020 19:48:46 +0200 Subject: [PATCH 1/2] ha: fix swapped device model and manufacturer fields in the discovery --- code/espurna/homeassistant.cpp | 4 ++-- code/espurna/ir.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/espurna/homeassistant.cpp b/code/espurna/homeassistant.cpp index 31033a42..d96d6318 100644 --- a/code/espurna/homeassistant.cpp +++ b/code/espurna/homeassistant.cpp @@ -82,8 +82,8 @@ struct ha_config_t { deviceConfig.createNestedArray("identifiers").add(identifier.c_str()); deviceConfig["name"] = name.c_str(); deviceConfig["sw_version"] = version.c_str(); - deviceConfig["manufacturer"] = getDevice().c_str(); - deviceConfig["model"] = getManufacturer().c_str(); + deviceConfig["manufacturer"] = getManufacturer().c_str(); + deviceConfig["model"] = getDevice().c_str(); } ha_config_t() : ha_config_t(DEFAULT_BUFFER_SIZE) {} diff --git a/code/espurna/ir.cpp b/code/espurna/ir.cpp index 50433228..b363532d 100644 --- a/code/espurna/ir.cpp +++ b/code/espurna/ir.cpp @@ -247,7 +247,7 @@ void _irTXLoop() { #if IR_USE_RAW _ir_sender.sendRaw(_ir_raw, _ir_repeat_size, _ir_freq); #else - _ir_sender.send(_ir_type, _ir_code, _ir_bits); + _ir_sender.send((decode_type_t)_ir_type, _ir_code, _ir_bits); #endif // Update repeat count From e8b80845bc1320a0084ee77e6d9d5b9c5d226d10 Mon Sep 17 00:00:00 2001 From: "Alex. Tircovnicu" Date: Fri, 14 Aug 2020 21:14:44 +0200 Subject: [PATCH 2/2] ir: fixed build error in case IR TX is not used in raw mode --- code/espurna/ir.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/espurna/ir.cpp b/code/espurna/ir.cpp index b363532d..7422e297 100644 --- a/code/espurna/ir.cpp +++ b/code/espurna/ir.cpp @@ -67,9 +67,9 @@ Raw messages: uint8_t _ir_repeat_size = 0; // size of repeat array uint16_t * _ir_raw; // array for sending codes and repeat codes #else - uint8_t _ir_type = 0; // Type of encoding - uint64_t _ir_code = 0; // Code to transmit - uint16_t _ir_bits = 0; // Code bits + decode_type_t _ir_type = UNUSED; // Type of encoding + uint64_t _ir_code = 0; // Code to transmit + uint16_t _ir_bits = 0; // Code bits #endif uint8_t _ir_repeat = 0; // count of times repeating of repeat_code @@ -208,7 +208,7 @@ void _irMqttCallback(unsigned int type, const char * topic, const char * payload if (col > 0) { - _ir_type = data.toInt(); + _ir_type = static_cast(data.toInt()); _ir_code = strtoul(data.substring(col+1).c_str(), NULL, 10); col = data.indexOf(":", col+1); @@ -247,7 +247,7 @@ void _irTXLoop() { #if IR_USE_RAW _ir_sender.sendRaw(_ir_raw, _ir_repeat_size, _ir_freq); #else - _ir_sender.send((decode_type_t)_ir_type, _ir_code, _ir_bits); + _ir_sender.send(_ir_type, _ir_code, _ir_bits); #endif // Update repeat count