Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep decoding for Whirlpool A/C #572

Merged
merged 16 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/IRrecvDumpV2/IRrecvDumpV2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#include <ir_Panasonic.h>
#include <ir_Samsung.h>
#include <ir_Toshiba.h>
#include <ir_Whirlpool.h>


// ==================== start of TUNEABLE PARAMETERS ====================
// An IR detector/demodulator is connected to GPIO pin 14
Expand Down Expand Up @@ -206,6 +208,13 @@ void dumpACInfo(decode_results *results) {
description = ac.toString();
}
#endif // DECODE_HITACHI_AC
#if DECODE_WHIRLPOOL_AC
if (results->decode_type == WHIRLPOOL_AC) {
IRWhirlpoolAc ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_WHIRLPOOL_AC
// If we got a human-readable description of the message, display it.
if (description != "") Serial.println("Mesg Desc.: " + description);
}
Expand Down
7 changes: 7 additions & 0 deletions src/IRutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,13 @@ uint8_t sumBytes(uint8_t *start, const uint16_t length, const uint8_t init) {
return checksum;
}

uint8_t xorBytes(uint8_t *start, const uint16_t length, const uint8_t init) {
uint8_t checksum = init;
uint8_t *ptr;
for (ptr = start; ptr - start < length; ptr++) checksum ^= *ptr;
return checksum;
}

uint64_t invertBits(const uint64_t data, const uint16_t nbits) {
// No change if we are asked to invert no bits.
if (nbits == 0) return data;
Expand Down
1 change: 1 addition & 0 deletions src/IRutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ std::string resultToHexidecimal(const decode_results *result);
bool hasACState(const decode_type_t protocol);
uint16_t getCorrectedRawLength(const decode_results *results);
uint8_t sumBytes(uint8_t *start, const uint16_t length, const uint8_t init = 0);
uint8_t xorBytes(uint8_t *start, const uint16_t length, const uint8_t init = 0);
uint64_t invertBits(const uint64_t data, const uint16_t nbits);

#endif // IRUTILS_H_
Loading