Skip to content

Commit

Permalink
Add support for Bang & Olufsen protocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielwallner committed Feb 25, 2024
1 parent 3853364 commit 6ea9ebb
Show file tree
Hide file tree
Showing 10 changed files with 713 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/IRrecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
DPRINTLN("Attempting York decode");
if (decodeYork(results, offset, kYorkBits)) return true;
#endif // DECODE_YORK
#if DECODE_BANG_OLUFSEN
DPRINTLN("Attempting Bang & Olufsen decode");
if (decodeBangOlufsen(results, offset)) return true;
#endif // DECODE_BANG_OLUFSEN
// Typically new protocols are added above this line.
}
#if DECODE_HASH
Expand Down
6 changes: 6 additions & 0 deletions src/IRrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,12 @@ class IRrecv {
const uint16_t kYorkBits,
const bool strict = true);
#endif // DECODE_YORK
#if DECODE_BANG_OLUFSEN
bool decodeBangOlufsen(decode_results *results,
uint16_t offset = kStartOffset,
const uint16_t nbits = kBangOlufsenBits,
const bool strict = false);
#endif // DECODE_BANG_OLUFSEN
};

#endif // IRRECV_H_
11 changes: 10 additions & 1 deletion src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,13 @@
#define SEND_YORK _IR_ENABLE_DEFAULT_
#endif // SEND_YORK

#ifndef DECODE_BANG_OLUFSEN
#define DECODE_BANG_OLUFSEN _IR_ENABLE_DEFAULT_
#endif // DECODE_BANG_OLUFSEN
#ifndef SEND_BANG_OLUFSEN
#define SEND_BANG_OLUFSEN _IR_ENABLE_DEFAULT_
#endif // SEND_BANG_OLUFSEN

#if (DECODE_ARGO || DECODE_DAIKIN || DECODE_FUJITSU_AC || DECODE_GREE || \
DECODE_KELVINATOR || DECODE_MITSUBISHI_AC || DECODE_TOSHIBA_AC || \
DECODE_TROTEC || DECODE_HAIER_AC || DECODE_HITACHI_AC || \
Expand Down Expand Up @@ -1137,8 +1144,9 @@ enum decode_type_t {
WOWWEE,
CARRIER_AC84, // 125
YORK,
BANG_OLUFSEN,
// Add new entries before this one, and update it to point to the last entry.
kLastDecodeType = YORK,
kLastDecodeType = BANG_OLUFSEN,
};

// Message lengths & required repeat values
Expand Down Expand Up @@ -1435,6 +1443,7 @@ const uint16_t kRhossDefaultRepeat = 0;
const uint16_t kClimaButlerBits = 52;
const uint16_t kYorkBits = 136;
const uint16_t kYorkStateLength = 17;
const uint16_t kBangOlufsenBits = 16;


// Legacy defines. (Deprecated)
Expand Down
7 changes: 7 additions & 0 deletions src/IRsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,8 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) {
return kXmpBits;
case YORK:
return kYorkBits;
case BANG_OLUFSEN:
return kBangOlufsenBits;
// No default amount of bits.
case FUJITSU_AC:
case MWM:
Expand Down Expand Up @@ -911,6 +913,11 @@ bool IRsend::send(const decode_type_t type, const uint64_t data,
sendArris(data, nbits, min_repeat);
break;
#endif // SEND_ARRIS
#if SEND_BANG_OLUFSEN
case BANG_OLUFSEN:
sendBangOlufsen(data, nbits, min_repeat);
break;
#endif // SEND_BANG_OLUFSEN
#if SEND_BOSE
case BOSE:
sendBose(data, nbits, min_repeat);
Expand Down
9 changes: 9 additions & 0 deletions src/IRsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,15 @@ class IRsend {
const uint16_t nbytes = kYorkStateLength,
const uint16_t repeat = kNoRepeat);
#endif // SEND_YORK
#if SEND_BANG_OLUFSEN
void sendBangOlufsen(const uint64_t data,
const uint16_t nbits = kBangOlufsenBits,
const uint16_t repeat = kNoRepeat);
void sendBangOlufsenRaw(const uint64_t rawData,
const uint16_t bits,
const bool datalink,
const bool backToBack);
#endif // SEND_BANG_OLUFSEN

protected:
#ifdef UNIT_TEST
Expand Down
2 changes: 2 additions & 0 deletions src/IRtext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ IRTEXT_CONST_BLOB_DECL(kAllProtocolNamesStr) {
D_STR_CARRIER_AC84, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_YORK || SEND_YORK,
D_STR_YORK, D_STR_UNSUPPORTED) "\x0"
COND(DECODE_BANG_OLUFSEN || SEND_BANG_OLUFSEN,
D_STR_BANG_OLUFSEN, D_STR_UNSUPPORTED) "\x0"
///< New protocol (macro) strings should be added just above this line.
"\x0" ///< This string requires double null termination.
};
Expand Down
Loading

0 comments on commit 6ea9ebb

Please sign in to comment.