Skip to content

Commit 7a115e8

Browse files
committed
1 parent 9a4ea59 commit 7a115e8

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

src/IRReceive.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,12 @@ void IRReceiveTimerInterruptHandler() {
227227
* After resume(), decodedIRData.rawDataPtr->initialGapTicks and decodedIRData.rawDataPtr->rawlen are
228228
* the first variables, which are overwritten by the next received frame.
229229
* since 4.3.0.
230+
* For backward compatibility, there are the same 2 statements in decode() if IrReceiver is not used.
230231
*/
231232
IrReceiver.decodedIRData.initialGapTicks = irparams.initialGapTicks;
232233
IrReceiver.decodedIRData.rawlen = irparams.rawlen;
233-
irparams.StateForISR = IR_REC_STATE_STOP;
234+
235+
irparams.StateForISR = IR_REC_STATE_STOP; // This signals the decode(), that a complete frame was received
234236
#if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
235237
/*
236238
* Call callback if registered (not NULL)
@@ -419,7 +421,7 @@ void IRrecv::restartTimerWithTicksToAdd(uint16_t aTicksToAddToGapCounter) {
419421
#ifdef _IR_MEASURE_TIMING
420422
pinModeFast(_IR_TIMING_TEST_PIN, OUTPUT);
421423
#endif
422-
}
424+
}
423425
#if defined(ESP8266) || defined(ESP32)
424426
#pragma GCC diagnostic push
425427
#endif
@@ -540,6 +542,14 @@ bool IRrecv::decode() {
540542
return false;
541543
}
542544

545+
/*
546+
* Support for old examples, which do not use the default IrReceiver instance
547+
*/
548+
if (this != &IrReceiver) {
549+
decodedIRData.initialGapTicks = irparams.initialGapTicks;
550+
decodedIRData.rawlen = irparams.rawlen;
551+
}
552+
543553
initDecodedIRData(); // sets IRDATA_FLAGS_WAS_OVERFLOW
544554

545555
if (decodedIRData.flags & IRDATA_FLAGS_WAS_OVERFLOW) {

src/IRremoteInt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ class IRrecv {
203203
public:
204204

205205
IRrecv();
206-
IRrecv(uint_fast8_t aReceivePin);
207-
IRrecv(uint_fast8_t aReceivePin, uint_fast8_t aFeedbackLEDPin);
206+
IRrecv(uint_fast8_t aReceivePin) __attribute__ ((deprecated ("Please use the default IRrecv instance \"IrReceiver\" and IrReceiver.begin(), and not your own IRrecv instance.")));
207+
IRrecv(uint_fast8_t aReceivePin, uint_fast8_t aFeedbackLEDPin) __attribute__ ((deprecated ("Please use the default IRrecv instance \"IrReceiver\" and IrReceiver.begin(), and not your own IRrecv instance..")));
208208
void setReceivePin(uint_fast8_t aReceivePinNumber);
209209
#if !defined(IR_REMOTE_DISABLE_RECEIVE_COMPLETE_CALLBACK)
210210
void registerReceiveCompleteCallback(void (*aReceiveCompleteCallbackFunction)(void));

src/digitalWriteFast.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
#include <Arduino.h> // declarations for the fallback to digitalWrite(), digitalRead() etc.
3131

32+
#if defined(MEGATINYCORE)
33+
#error Do not use "#include digitalWriteFast.h" because megaTinyCore has it own digitalWriteFast function set, except digitalToggleFast().
34+
#endif
35+
3236
// --- Arduino Mega and ATmega128x/256x based boards ---
3337
#if (defined(ARDUINO_AVR_MEGA) || \
3438
defined(ARDUINO_AVR_MEGA1280) || \

src/ir_Lego.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ bool IRrecv::decodeLegoPowerFunctions() {
132132
}
133133

134134
// Check we have enough data - +4 for initial gap, start bit mark and space + stop bit mark
135-
if (decodedIRData.rawDataPtr->rawlen != (2 * LEGO_BITS) + 4) {
135+
if (decodedIRData.rawlen != (2 * LEGO_BITS) + 4) {
136136
IR_DEBUG_PRINT(F("LEGO: "));
137137
IR_DEBUG_PRINT(F("Data length="));
138138
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);

0 commit comments

Comments
 (0)