BUG: Incorrect acknowledgements for some A/C protocols. (#460)

Forgot to update this section of code for other A/C protocols, so using
a standard function to keep it up-to-date in future.

Fixes #459
This commit is contained in:
David Conran
2018-05-15 02:13:36 +10:00
committed by GitHub
parent 3c11f651af
commit 7c06012e37

View File

@@ -1195,35 +1195,33 @@ void sendIRCode(int const ir_type, uint64_t const code, char const * code_str,
// Indicate that we sent the message. // Indicate that we sent the message.
debug("Sent the IR message."); debug("Sent the IR message.");
debug("Type: " + String(ir_type)); debug("Type: " + String(ir_type));
switch (ir_type) { // For "long" codes we basically repeat what we got.
case KELVINATOR: if (hasACState((decode_type_t) ir_type) ||
case PRONTO: ir_type == PRONTO ||
case RAW: ir_type == RAW ||
case GLOBALCACHE: ir_type == GLOBALCACHE) {
debug("Code: "); debug("Code: ");
debug(code_str); debug(code_str);
debug("Repeats: " + String(repeat)); debug("Repeats: " + String(repeat));
// Confirm what we were asked to send was sent. // Confirm what we were asked to send was sent.
#ifdef MQTT_ENABLE
if (ir_type == PRONTO && repeat > 0)
mqtt_client.publish(MQTTack, (String(ir_type) + ",R" +
String(repeat) + "," +
String(code_str)).c_str());
else
mqtt_client.publish(MQTTack, (String(ir_type) + "," +
String(code_str)).c_str());
#endif // MQTT_ENABLE
break;
default:
debug("Code: 0x" + uint64ToString(code, 16));
debug("Bits: " + String(bits));
debug("Repeats: " + String(repeat));
#ifdef MQTT_ENABLE #ifdef MQTT_ENABLE
if (ir_type == PRONTO && repeat > 0)
mqtt_client.publish(MQTTack, (String(ir_type) + ",R" +
String(repeat) + "," +
String(code_str)).c_str());
else
mqtt_client.publish(MQTTack, (String(ir_type) + "," + mqtt_client.publish(MQTTack, (String(ir_type) + "," +
uint64ToString(code, 16) String(code_str)).c_str());
+ "," + String(bits) + "," + #endif // MQTT_ENABLE
String(repeat)).c_str()); } else { // For "short" codes, we break it down a bit more before we report.
debug("Code: 0x" + uint64ToString(code, 16));
debug("Bits: " + String(bits));
debug("Repeats: " + String(repeat));
#ifdef MQTT_ENABLE
mqtt_client.publish(MQTTack, (String(ir_type) + "," +
uint64ToString(code, 16)
+ "," + String(bits) + "," +
String(repeat)).c_str());
#endif // MQTT_ENABLE #endif // MQTT_ENABLE
} }
} }