Skip to content

Commit dc9f9b0

Browse files
Changes ready to for PR
1 parent 4d8eef1 commit dc9f9b0

File tree

4 files changed

+61
-52
lines changed

4 files changed

+61
-52
lines changed

src/IRrecv.cpp

Lines changed: 4 additions & 0 deletions
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

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

888894
#endif // IRRECV_H_

src/ir_BluestarHeavy.cpp

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -56,58 +56,58 @@ void IRsend::sendBluestarHeavy(const uint8_t data[], const uint16_t nbytes, cons
5656
}
5757
#endif // SEND_BLUESTARHEAVY
5858

59-
/*
60-
// DANGER: More than 64 bits detected. A uint64_t for 'data' won't work!
61-
#if DECODE_BLUESTARHEAVY
62-
// Function should be safe up to 64 bits.
63-
/// Decode the supplied BluestarHeavy message.
64-
/// Status: ALPHA / Untested.
65-
/// @param[in,out] results Ptr to the data to decode & where to store the decode
66-
/// @param[in] offset The starting index to use when attempting to decode the
67-
/// raw data. Typically/Defaults to kStartOffset.
68-
/// @param[in] nbits The number of data bits to expect.
69-
/// @param[in] strict Flag indicating if we should perform strict matching.
70-
/// @return A boolean. True if it can decode it, false if it can't.
71-
72-
73-
bool IRrecv::decodeBluestarHeavy(decode_results *results, uint16_t offset, const uint16_t nbits, const bool strict) {
74-
if (results->rawlen < 2 * nbits + kBluestarHeavyOverhead - offset)
75-
return false; // Too short a message to match.
76-
if (strict && nbits != kBluestarHeavyBits)
77-
return false;
78-
79-
uint128_t data = 0;
80-
match_result_t data_result;
81-
82-
// Header
83-
if (!matchMark(results->rawbuf[offset++], kBluestarHeavyHdrMark))
84-
return false;
85-
if (!matchSpace(results->rawbuf[offset++], kBluestarHeavyHdrSpace))
86-
return false;
87-
88-
// Data Section #1
89-
// e.g. data_result.data = 0xD5FED74FFA5FFA5FFF7F5CFDDC, nbits = 104
90-
data_result = matchData(&(results->rawbuf[offset]), 104,
91-
kBluestarHeavyBitMark, kBluestarHeavyOneSpace,
92-
kBluestarHeavyBitMark, kBluestarHeavyZeroSpace);
93-
offset += data_result.used;
94-
if (data_result.success == false) return false; // Fail
95-
data <<= 104; // Make room for the new bits of data.
96-
data |= data_result.data;
97-
98-
// Header
99-
if (!matchMark(results->rawbuf[offset++], kBluestarHeavyHdrMark))
100-
return false;
10159

102-
// Success
103-
results->decode_type = decode_type_t::BLUESTARHEAVY;
104-
results->bits = nbits;
105-
results->value = data;
106-
results->command = 0;
107-
results->address = 0;
108-
return true;
109-
}
110-
#endif // DECODE_BLUESTARHEAVY
60+
// DANGER: More than 64 bits detected. A uint64_t for 'data' won't work!
61+
// #if DECODE_BLUESTARHEAVY
62+
// // Function should be safe up to 64 bits.
63+
// /// Decode the supplied BluestarHeavy message.
64+
// /// Status: ALPHA / Untested.
65+
// /// @param[in,out] results Ptr to the data to decode & where to store the decode
66+
// /// @param[in] offset The starting index to use when attempting to decode the
67+
// /// raw data. Typically/Defaults to kStartOffset.
68+
// /// @param[in] nbits The number of data bits to expect.
69+
// /// @param[in] strict Flag indicating if we should perform strict matching.
70+
// /// @return A boolean. True if it can decode it, false if it can't.
71+
72+
73+
// bool IRrecv::decodeBluestarHeavy(decode_results *results, uint16_t offset, const uint16_t nbits, const bool strict) {
74+
// if (results->rawlen < 2 * nbits + kBluestarHeavyOverhead - offset)
75+
// return false; // Too short a message to match.
76+
// if (strict && nbits != kBluestarHeavyBits)
77+
// return false;
78+
79+
// uint64_t data = 0;
80+
// match_result_t data_result;
81+
82+
// // Header
83+
// if (!matchMark(results->rawbuf[offset++], kBluestarHeavyHdrMark))
84+
// return false;
85+
// if (!matchSpace(results->rawbuf[offset++], kBluestarHeavyHdrSpace))
86+
// return false;
87+
88+
// // Data Section #1
89+
// // e.g. data_result.data = 0xD5FED74FFA5FFA5FFF7F5CFDDC, nbits = 104
90+
// data_result = matchData(&(results->rawbuf[offset]), 104,
91+
// kBluestarHeavyBitMark, kBluestarHeavyOneSpace,
92+
// kBluestarHeavyBitMark, kBluestarHeavyZeroSpace);
93+
// offset += data_result.used;
94+
// if (data_result.success == false) return false; // Fail
95+
// data <<= 104; // Make room for the new bits of data.
96+
// data |= data_result.data;
97+
98+
// // Header
99+
// if (!matchMark(results->rawbuf[offset++], kBluestarHeavyHdrMark))
100+
// return false;
101+
102+
// // Success
103+
// results->decode_type = decode_type_t::BLUESTARHEAVY;
104+
// results->bits = nbits;
105+
// results->value = data;
106+
// results->command = 0;
107+
// results->address = 0;
108+
// return true;
109+
// }
110+
// #endif // DECODE_BLUESTARHEAVY
111111

112112
#if DECODE_BLUESTARHEAVY
113113
// Function should be safe over 64 bits.
@@ -148,4 +148,3 @@ bool IRrecv::decodeBluestarHeavy(decode_results *results, uint16_t offset, const
148148
return true;
149149
}
150150
#endif // DECODE_BLUESTARHEAVY
151-
*/

test/ir_BluestarHeavy_test.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)