Skip to content

Commit a5c6902

Browse files
Added support for Bluestar Heavy AC (#2120)
Added basic support for Bluestar Heavy AC Bit ordering confirmed.
1 parent c00a919 commit a5c6902

9 files changed

+112
-3
lines changed

src/IRrecv.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,10 @@ bool IRrecv::decode(decode_results *results, irparams_t *save,
11851185
DPRINTLN("Attempting York decode");
11861186
if (decodeYork(results, offset, kYorkBits)) return true;
11871187
#endif // DECODE_YORK
1188+
#if DECODE_BLUESTARHEAVY
1189+
DPRINTLN("Attempting BluestarHeavy decode");
1190+
if (decodeBluestarHeavy(results, offset, kBluestarHeavyBits)) return true;
1191+
#endif // DECODE_BLUESTARHEAVY
11881192
// Typically new protocols are added above this line.
11891193
}
11901194
#if DECODE_HASH

src/IRrecv.h

+6
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,12 @@ class IRrecv {
883883
const uint16_t nbits = kYorkBits,
884884
const bool strict = true);
885885
#endif // DECODE_YORK
886+
#if DECODE_BLUESTARHEAVY
887+
bool decodeBluestarHeavy(decode_results *results,
888+
uint16_t offset = kStartOffset,
889+
const uint16_t nbits = kBluestarHeavyBits,
890+
const bool strict = true);
891+
#endif // DECODE_BLUESTARHEAVY
886892
};
887893

888894
#endif // IRRECV_H_

src/IRremoteESP8266.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,13 @@
952952
#define SEND_YORK _IR_ENABLE_DEFAULT_
953953
#endif // SEND_YORK
954954

955+
#ifndef DECODE_BLUESTARHEAVY
956+
#define DECODE_BLUESTARHEAVY _IR_ENABLE_DEFAULT_
957+
#endif // DECODE_BLUESTARHEAVY
958+
#ifndef SEND_BLUESTARHEAVY
959+
#define SEND_BLUESTARHEAVY _IR_ENABLE_DEFAULT_
960+
#endif // SEND_BLUESTARHEAVY
961+
955962
#if (DECODE_ARGO || DECODE_DAIKIN || DECODE_FUJITSU_AC || DECODE_GREE || \
956963
DECODE_KELVINATOR || DECODE_MITSUBISHI_AC || DECODE_TOSHIBA_AC || \
957964
DECODE_TROTEC || DECODE_HAIER_AC || DECODE_HITACHI_AC || \
@@ -970,7 +977,7 @@
970977
DECODE_KELON168 || DECODE_HITACHI_AC296 || DECODE_CARRIER_AC128 || \
971978
DECODE_DAIKIN200 || DECODE_HAIER_AC160 || DECODE_TCL96AC || \
972979
DECODE_BOSCH144 || DECODE_SANYO_AC152 || DECODE_DAIKIN312 || \
973-
DECODE_CARRIER_AC84 || DECODE_YORK || \
980+
DECODE_CARRIER_AC84 || DECODE_YORK || DECODE_BLUESTARHEAVY || \
974981
false)
975982
// Add any DECODE to the above if it uses result->state (see kStateSizeMax)
976983
// you might also want to add the protocol to hasACState function
@@ -1137,8 +1144,9 @@ enum decode_type_t {
11371144
WOWWEE,
11381145
CARRIER_AC84, // 125
11391146
YORK,
1147+
BLUESTARHEAVY,
11401148
// Add new entries before this one, and update it to point to the last entry.
1141-
kLastDecodeType = YORK,
1149+
kLastDecodeType = BLUESTARHEAVY,
11421150
};
11431151

11441152
// Message lengths & required repeat values
@@ -1165,6 +1173,8 @@ const uint16_t kArgo3TimerStateLength = 9; // Bytes
11651173
const uint16_t kArgo3ConfigStateLength = 4; // Bytes
11661174
const uint16_t kArgoDefaultRepeat = kNoRepeat;
11671175
const uint16_t kArrisBits = 32;
1176+
const uint16_t kBluestarHeavyStateLength = 13;
1177+
const uint16_t kBluestarHeavyBits = kBluestarHeavyStateLength * 8;
11681178
const uint16_t kBosch144StateLength = 18;
11691179
const uint16_t kBosch144Bits = kBosch144StateLength * 8;
11701180
const uint16_t kCoolixBits = 24;
@@ -1436,7 +1446,6 @@ const uint16_t kClimaButlerBits = 52;
14361446
const uint16_t kYorkBits = 136;
14371447
const uint16_t kYorkStateLength = 17;
14381448

1439-
14401449
// Legacy defines. (Deprecated)
14411450
#define AIWA_RC_T501_BITS kAiwaRcT501Bits
14421451
#define ARGO_COMMAND_LENGTH kArgoStateLength

src/IRsend.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,8 @@ uint16_t IRsend::defaultBits(const decode_type_t protocol) {
798798
return kXmpBits;
799799
case YORK:
800800
return kYorkBits;
801+
case BLUESTARHEAVY:
802+
return kBluestarHeavyBits;
801803
// No default amount of bits.
802804
case FUJITSU_AC:
803805
case MWM:
@@ -1434,6 +1436,11 @@ bool IRsend::send(const decode_type_t type, const uint8_t *state,
14341436
sendYork(state, nbytes);
14351437
break;
14361438
#endif // SEND_YORK
1439+
#if SEND_BLUESTARHEAVY
1440+
case BLUESTARHEAVY:
1441+
sendBluestarHeavy(state, nbytes);
1442+
break;
1443+
#endif // SEND_BLUESTARHEAVY
14371444
default:
14381445
return false;
14391446
}

src/IRsend.h

+5
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,11 @@ class IRsend {
892892
const uint16_t nbytes = kYorkStateLength,
893893
const uint16_t repeat = kNoRepeat);
894894
#endif // SEND_YORK
895+
#if SEND_BLUESTARHEAVY
896+
void sendBluestarHeavy(const unsigned char data[],
897+
const uint16_t nbytes = kBluestarHeavyStateLength,
898+
const uint16_t repeat = kNoRepeat);
899+
#endif // SEND_BLUESTARHEAVY
895900

896901
protected:
897902
#ifdef UNIT_TEST

src/IRtext.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ IRTEXT_CONST_BLOB_DECL(kAllProtocolNamesStr) {
559559
D_STR_CARRIER_AC84, D_STR_UNSUPPORTED) "\x0"
560560
COND(DECODE_YORK || SEND_YORK,
561561
D_STR_YORK, D_STR_UNSUPPORTED) "\x0"
562+
COND(DECODE_BLUESTARHEAVY || SEND_BLUESTARHEAVY,
563+
D_STR_BLUESTARHEAVY, D_STR_UNSUPPORTED) "\x0"
562564
///< New protocol (macro) strings should be added just above this line.
563565
"\x0" ///< This string requires double null termination.
564566
};

src/IRutils.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ bool hasACState(const decode_type_t protocol) {
169169
// This is kept sorted by name
170170
case AMCOR:
171171
case ARGO:
172+
case BLUESTARHEAVY:
172173
case BOSCH144:
173174
case CARRIER_AC84:
174175
case CARRIER_AC128:

src/ir_BluestarHeavy.cpp

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2024 Harsh Bhosale (harshbhosale01)
2+
/// @file
3+
/// @brief Support for BluestarHeavy protocol
4+
5+
// Supports:
6+
// Brand: Bluestar, Model: D716LXM0535A2400313 (Remote)
7+
8+
#include "IRrecv.h"
9+
#include "IRsend.h"
10+
#include "IRutils.h"
11+
12+
const uint16_t kBluestarHeavyHdrMark = 4912;
13+
const uint16_t kBluestarHeavyBitMark = 465;
14+
const uint16_t kBluestarHeavyHdrSpace = 5058;
15+
const uint16_t kBluestarHeavyOneSpace = 572;
16+
const uint16_t kBluestarHeavyZeroSpace = 1548;
17+
const uint16_t kBluestarHeavyFreq = 38000;
18+
const uint16_t kBluestarHeavyOverhead = 3;
19+
20+
#if SEND_BLUESTARHEAVY
21+
/// Send a BluestarHeavy formatted message.
22+
/// Status: BETA / Tested.
23+
/// @param[in] data An array of bytes containing the IR command.
24+
/// It is assumed to be in MSB order for this code.
25+
/// e.g.
26+
/// @code
27+
/// uint8_t data[kBluestarHeavyStateLength] =
28+
/// {0x2A,0x00,0x20,0xD0,0x05,0xA0,0x05,0xA0,0x00,0x80,0xBA,0x02,0x23};
29+
/// @endcode
30+
/// @param[in] nbytes Nr. of bytes of data in the array.
31+
/// @param[in] repeat Nr. of times the message is to be repeated.
32+
void IRsend::sendBluestarHeavy(const uint8_t data[], const uint16_t nbytes,
33+
const uint16_t repeat) {
34+
sendGeneric(kBluestarHeavyHdrMark, kBluestarHeavyHdrSpace,
35+
kBluestarHeavyBitMark, kBluestarHeavyOneSpace,
36+
kBluestarHeavyBitMark, kBluestarHeavyZeroSpace,
37+
kBluestarHeavyHdrMark, kDefaultMessageGap,
38+
data, nbytes, // Bytes
39+
kBluestarHeavyFreq, true, repeat, kDutyDefault);
40+
}
41+
#endif // SEND_BLUESTARHEAVY
42+
43+
#if DECODE_BLUESTARHEAVY
44+
/// Decode the supplied BluestarHeavy message.
45+
/// Status: BETA / Tested.
46+
/// @param[in,out] results Ptr to the data to decode & where to store the decode
47+
/// @param[in] offset The starting index to use when attempting to decode the
48+
/// raw data. Typically/Defaults to kStartOffset.
49+
/// @param[in] nbits The number of data bits to expect.
50+
/// @param[in] strict Flag indicating if we should perform strict matching.
51+
/// @return A boolean. True if it can decode it, false if it can't.
52+
bool IRrecv::decodeBluestarHeavy(decode_results *results, uint16_t offset,
53+
const uint16_t nbits, const bool strict) {
54+
if (strict && nbits != kBluestarHeavyBits)
55+
return false;
56+
57+
uint16_t used = 0;
58+
59+
used = matchGeneric(results->rawbuf + offset, results->state,
60+
results->rawlen - offset, nbits,
61+
kBluestarHeavyHdrMark, kBluestarHeavyHdrSpace,
62+
kBluestarHeavyBitMark, kBluestarHeavyOneSpace,
63+
kBluestarHeavyBitMark, kBluestarHeavyZeroSpace,
64+
kBluestarHeavyHdrMark, kDefaultMessageGap, true);
65+
if (used == 0) return false; // We failed to find any data.
66+
67+
// Success
68+
results->decode_type = decode_type_t::BLUESTARHEAVY;
69+
results->bits = nbits;
70+
return true;
71+
}
72+
#endif // DECODE_BLUESTARHEAVY

src/locale/defaults.h

+3
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,9 @@ D_STR_INDIRECT " " D_STR_MODE
751751
#ifndef D_STR_ARRIS
752752
#define D_STR_ARRIS "ARRIS"
753753
#endif // D_STR_ARRIS
754+
#ifndef D_STR_BLUESTARHEACY
755+
#define D_STR_BLUESTARHEAVY "BLUESTARHEAVY"
756+
#endif // D_STR_TESTEXAMPLE
754757
#ifndef D_STR_BOSCH
755758
#define D_STR_BOSCH "BOSCH"
756759
#endif // D_STR_BOSCH

0 commit comments

Comments
 (0)