diff --git a/src/ir_Mirage.cpp b/src/ir_Mirage.cpp index 2737c4d8d..8a573a8dc 100644 --- a/src/ir_Mirage.cpp +++ b/src/ir_Mirage.cpp @@ -23,10 +23,8 @@ const uint16_t kMirageFreq = 38000; ///< Hz. (Just a guess) #if SEND_MIRAGE /// Send a Mirage formatted message. -/// Status: BETA / Probably works. +/// Status: STABLE / Reported as working. /// @param[in] data An array of bytes containing the IR command. -/// It is assumed to be in MSB order for this code. -/// @todo Confirm the bit ordering of the data. /// @param[in] nbytes Nr. of bytes of data in the array. (>=kMirageStateLength) /// @param[in] repeat Nr. of times the message is to be repeated. void IRsend::sendMirage(const uint8_t data[], const uint16_t nbytes, @@ -35,16 +33,15 @@ void IRsend::sendMirage(const uint8_t data[], const uint16_t nbytes, kMirageBitMark, kMirageOneSpace, kMirageBitMark, kMirageZeroSpace, kMirageBitMark, kMirageGap, - data, nbytes, - kMirageFreq, true, repeat, kDutyDefault); + data, nbytes, kMirageFreq, false, // LSB + repeat, kDutyDefault); } #endif // SEND_MIRAGE #if DECODE_MIRAGE /// Decode the supplied Mirage message. -/// Status: BETA / Probably works. +/// Status: STABLE / Reported as working. /// @param[in,out] results Ptr to the data to decode & where to store the decode -/// @todo Confirm the bit ordering of the result data. /// @param[in] offset The starting index to use when attempting to decode the /// raw data. Typically/Defaults to kStartOffset. /// @param[in] nbits The number of data bits to expect. @@ -59,7 +56,8 @@ bool IRrecv::decodeMirage(decode_results *results, uint16_t offset, kMirageHdrMark, kMirageHdrSpace, kMirageBitMark, kMirageOneSpace, kMirageBitMark, kMirageZeroSpace, - kMirageBitMark, kMirageGap, true)) return false; + kMirageBitMark, kMirageGap, true, + kUseDefTol, kMarkExcess, false)) return false; // Success results->decode_type = decode_type_t::MIRAGE; diff --git a/test/ir_Mirage_test.cpp b/test/ir_Mirage_test.cpp index 5cf7be3a3..2530afc5c 100644 --- a/test/ir_Mirage_test.cpp +++ b/test/ir_Mirage_test.cpp @@ -43,8 +43,8 @@ TEST(TestDecodeMirage, RealExample) { 1600, 556, 542, 560, 542, 532, 568, 558, 542, 610, 1538, 504, 1646, 582, 518, 528, 572, 528, 1612, 556, 544, 528, 580, 554}; // UNKNOWN 28DACDC4 const uint8_t expected[kMirageStateLength] = { - 0x6A, 0xAE, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x68, 0x28, 0x64}; + 0x56, 0x75, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x16, 0x14, 0x26}; irsend.begin(); irsend.reset(); irsend.sendRaw(rawData, 243, 38); @@ -63,8 +63,8 @@ TEST(TestDecodeMirage, SyntheticExample) { IRsendTest irsend(kGpioUnused); IRrecv irrecv(kGpioUnused); const uint8_t expected[kMirageStateLength] = { - 0x6A, 0xAE, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x68, 0x28, 0x64}; + 0x56, 0x75, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x16, 0x14, 0x26}; irsend.begin(); irsend.reset(); irsend.sendMirage(expected); @@ -106,8 +106,8 @@ TEST(TestDecodeMirage, RealExampleWithDodgyHardwareCapture) { 558, 542, 610, 1538, 504, 1646, 582, 518, 528, 572, 528, 1612, 556, 544, 528, 580, 554}; // UNKNOWN 28DACDC4 const uint8_t expected[kMirageStateLength] = { - 0x6A, 0xAE, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x68, 0x28, 0x64}; + 0x56, 0x75, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x16, 0x14, 0x26}; irrecv.setTolerance(kTolerance + 10); // Bump tolerance to match poor data. irsend.begin(); irsend.reset();