Skip to content

Commit

Permalink
BUG: Incorrect acknowledgements for some A/C protocols.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
crankyoldgit committed May 14, 2018
1 parent 3c11f65 commit 560372e
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions examples/IRMQTTServer/IRMQTTServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1195,35 +1195,33 @@ void sendIRCode(int const ir_type, uint64_t const code, char const * code_str,
// Indicate that we sent the message.
debug("Sent the IR message.");
debug("Type: " + String(ir_type));
switch (ir_type) {
case KELVINATOR:
case PRONTO:
case RAW:
case GLOBALCACHE:
debug("Code: ");
debug(code_str);
debug("Repeats: " + String(repeat));
// Confirm what we were asked to send was sent.
// For "long" codes we basically repeat what we got.
if (hasACState((decode_type_t) ir_type) ||
ir_type == PRONTO ||
ir_type == RAW ||
ir_type == GLOBALCACHE) {
debug("Code: ");
debug(code_str);
debug("Repeats: " + String(repeat));
// 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());
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));

} 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());
mqtt_client.publish(MQTTack, (String(ir_type) + "," +
uint64ToString(code, 16)
+ "," + String(bits) + "," +
String(repeat)).c_str());
#endif // MQTT_ENABLE
}
}
Expand Down

0 comments on commit 560372e

Please sign in to comment.