Skip to content

Commit 8b9e036

Browse files
committed
Convenience function isIRReceiverAttachedForTinyReceiver() and 3.party
1 parent 7131adf commit 8b9e036

File tree

10 files changed

+215
-39
lines changed

10 files changed

+215
-39
lines changed

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ PROJECT_LOGO =
5858
# entered, it will be relative to the location where doxygen was started. If
5959
# left blank the current directory will be used.
6060

61-
OUTPUT_DIRECTORY = ..\Arduino-IRremote_gh-pages
61+
OUTPUT_DIRECTORY = E:\WORKSPACE_ARDUINO\lib\Arduino-IRremote_gh-pages
6262

6363
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
6464
# directories (in 2 levels) under the output directory of each output format and

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,9 @@ A simple example can be tested online with [WOKWI](https://wokwi.com/projects/33
598598
599599
#### TinyReceiver + TinySender
600600
If **code size** or **timer usage** matters, look at these examples.<br/>
601-
The **[TinyReceiver](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/TinyReceiver/TinyReceiver.ino)** example uses the **TinyIRReceiver** library which can **only receive NEC, Extended NEC, ONKYO and FAST protocols, but does not require any timer**. They use pin change interrupt for on the fly decoding, which is the reason for the restricted protocol choice.<br/>
601+
The **[TinyReceiver](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/TinyReceiver/TinyReceiver.ino)** example uses the **TinyIRReceiver** library
602+
which can **only receive NEC, Extended NEC, ONKYO and FAST protocols, but does not require any timer**.
603+
They use pin change interrupt for on the fly decoding, which is the reason for the restricted protocol choice.<br/>
602604
TinyReceiver can be tested online with [WOKWI](https://wokwi.com/arduino/projects/339264565653013075).
603605
604606
The **[TinySender](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/TinySender/TinySender.ino)** example uses the **TinyIRSender** library which can **only send NEC, ONKYO and FAST protocols**.<br/>
@@ -718,13 +720,15 @@ These next macros for **TinyIRReceiver** must be defined in your program before
718720
| `NO_LED_FEEDBACK_CODE` | disabled | Disables the feedback LED function. Saves 14 bytes program memory. |
719721
| `DISABLE_PARITY_CHECKS` | disabled | Disables the addres and command parity checks. Saves 48 bytes program memory. |
720722
| `USE_EXTENDED_NEC_PROTOCOL` | disabled | Like NEC, but take the 16 bit address as one 16 bit value and not as 8 bit normal and 8 bit inverted value. |
721-
| `USE_ONKYO_PROTOCOL` | disabled | Like NEC, but take both the 16 bit address and command each as one 16 bit value and not as 8 bit normal and 8 bit inverted value. |
723+
| `USE_ONKYO_PROTOCOL` | disabled | Like NEC, but take the 16 bit address and command each as one 16 bit value and not as 8 bit normal and 8 bit inverted value. |
722724
| `USE_FAST_PROTOCOL` | disabled | Use FAST protocol (no address and 16 bit data, interpreted as 8 bit command and 8 bit inverted command) instead of NEC. |
723725
| `ENABLE_NEC2_REPEATS` | disabled | Instead of sending / receiving the NEC special repeat code, send / receive the original frame for repeat. |
724726
| `USE_CALLBACK_FOR_TINY_RECEIVER` | disabled | Call the fixed function `void handleReceivedTinyIRData()` each time a frame or repeat is received. |
725727
726728
The next macro for **IRCommandDispatcher** must be defined in your program before the line `#include <IRCommandDispatcher.hpp>` to take effect.
729+
| `USE_TINY_IR_RECEIVER` | disabled | Use [TinyReceiver](https://github.com/Arduino-IRremote/Arduino-IRremote#tinyreceiver--tinysender) for receiving IR codes. |
727730
| `IR_COMMAND_HAS_MORE_THAN_8_BIT` | disabled | Enables mapping and dispatching of IR commands consisting of more than 8 bits. Saves up to 160 bytes program memory and 4 bytes RAM + 1 byte RAM per mapping entry. |
731+
| `BUZZER_PIN` | | If `USE_TINY_IR_RECEIVER` is enabled, the pin to be used for the optional 50 ms buzzer feedback before executing a command. Other IR libraries than Tiny are not compatible with tone() command. |
728732
729733
### Changing include (*.h) files with Arduino IDE
730734
First, use *Sketch > Show Sketch Folder (Ctrl+K)*.<br/>

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
The latest version may not be released!
33
See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master
44

5+
# 4.2.2
6+
- Added convenience function isIRReceiverAttachedForTinyReceiver().
7+
- Added Extended NEC Protocol to TinyIR by Butzerb
8+
59
# 4.2.1
610
- Fix wrong type of tEnableLEDFeedback in IRSend.hpp and IRReceive.hpp.
711
- TinyReceiver 2.0

examples/AllProtocolsOnLCD/ADCUtils.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,33 @@
8585
#define ADC_TEMPERATURE_CHANNEL_MUX 15
8686
#define ADC_1_1_VOLT_CHANNEL_MUX 12
8787
#define ADC_GND_CHANNEL_MUX 13
88+
#define ADC_CHANNEL_MUX_MASK 0x0F
8889

8990
#elif defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
9091
#define ADC_ISCR_CHANNEL_MUX 3
9192
#define ADC_TEMPERATURE_CHANNEL_MUX 11
9293
#define ADC_1_1_VOLT_CHANNEL_MUX 12
9394
#define ADC_GND_CHANNEL_MUX 14
9495
#define ADC_VCC_4TH_CHANNEL_MUX 13
96+
#define ADC_CHANNEL_MUX_MASK 0x1F
9597

9698
#elif defined(__AVR_ATmega328P__)
9799
#define ADC_TEMPERATURE_CHANNEL_MUX 8
98100
#define ADC_1_1_VOLT_CHANNEL_MUX 14
99101
#define ADC_GND_CHANNEL_MUX 15
102+
#define ADC_CHANNEL_MUX_MASK 0x0F
100103

101104
#elif defined(__AVR_ATmega32U4__)
102105
#define ADC_TEMPERATURE_CHANNEL_MUX 0x27
103106
#define ADC_1_1_VOLT_CHANNEL_MUX 0x1E
104107
#define ADC_GND_CHANNEL_MUX 0x1F
108+
#define ADC_CHANNEL_MUX_MASK 0x3F
105109

106110
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
107111
#define ADC_1_1_VOLT_CHANNEL_MUX 0x1E
108112
#define ADC_GND_CHANNEL_MUX 0x1F
113+
#define ADC_CHANNEL_MUX_MASK 0x1F
114+
109115
#define INTERNAL INTERNAL1V1
110116

111117
#else
@@ -164,7 +170,10 @@ uint16_t waitAndReadADCChannelWithReferenceAndRestoreADMUXAndReference(uint8_t a
164170
uint16_t readADCChannelWithOversample(uint8_t aADCChannelNumber, uint8_t aOversampleExponent);
165171
void setADCChannelAndReferenceForNextConversion(uint8_t aADCChannelNumber, uint8_t aReference);
166172
uint16_t readADCChannelWithReferenceOversampleFast(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aOversampleExponent);
167-
uint16_t readADCChannelWithReferenceMultiSamples(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aNumberOfSamples);
173+
uint32_t readADCChannelMultiSamples(uint8_t aPrescale, uint16_t aNumberOfSamples);
174+
uint16_t readADCChannelMultiSamplesWithReference(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aNumberOfSamples);
175+
uint32_t readADCChannelMultiSamplesWithReferenceAndPrescaler(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aPrescale,
176+
uint16_t aNumberOfSamples);
168177
uint16_t readADCChannelWithReferenceMax(uint8_t aADCChannelNumber, uint8_t aReference, uint16_t aNumberOfSamples);
169178
uint16_t readADCChannelWithReferenceMaxMicros(uint8_t aADCChannelNumber, uint8_t aReference, uint16_t aMicrosecondsToAquire);
170179
uint16_t readUntil4ConsecutiveValuesAreEqual(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aDelay,
@@ -192,7 +201,8 @@ float getCPUTemperatureSimple(void);
192201
float getCPUTemperature(void);
193202
float getTemperature(void) __attribute__ ((deprecated ("Renamed to getCPUTemperature()"))); // deprecated
194203

195-
bool isVCCUSBPowered() ;
204+
bool isVCCUSBPowered();
205+
bool isVCCUSBPowered(Print *aSerial);
196206
bool isVCCUndervoltageMultipleTimes();
197207
void resetCounterForVCCUndervoltageMultipleTimes();
198208
bool isVCCUndervoltage();

examples/AllProtocolsOnLCD/ADCUtils.hpp

Lines changed: 94 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ union WordUnionForADCUtils {
5858
* Enable this to see information on each call.
5959
* Since there should be no library which uses Serial, it should only be enabled for development purposes.
6060
*/
61-
#if defined(DEBUG)
61+
#if defined(DEBUG) && !defined(LOCAL_DEBUG)
6262
#define LOCAL_DEBUG
6363
#else
6464
//#define LOCAL_DEBUG // This enables debug output only for this file
@@ -161,12 +161,15 @@ uint8_t checkAndWaitForReferenceAndChannelToSwitch(uint8_t aADCChannelNumber, ui
161161
if ((tOldADMUX & MASK_FOR_ADC_REFERENCE) != tNewReference && (aReference == INTERNAL || aReference == INTERNAL2V56)) {
162162
#else
163163
if ((tOldADMUX & MASK_FOR_ADC_REFERENCE) != tNewReference && aReference == INTERNAL) {
164+
#endif
165+
#if defined(LOCAL_DEBUG)
166+
Serial.println(F("Switch from DEFAULT to INTERNAL"));
164167
#endif
165168
/*
166169
* Switch reference from DEFAULT to INTERNAL
167170
*/
168171
delayMicroseconds(8000); // experimental value is >= 7600 us for Nano board and 6200 for Uno board
169-
} else if ((tOldADMUX & 0x0F) != aADCChannelNumber) {
172+
} else if ((tOldADMUX & ADC_CHANNEL_MUX_MASK) != aADCChannelNumber) {
170173
if (aADCChannelNumber == ADC_1_1_VOLT_CHANNEL_MUX) {
171174
/*
172175
* Internal 1.1 Volt channel requires <= 200 us for Nano board
@@ -249,9 +252,10 @@ uint16_t readADCChannelWithReferenceOversampleFast(uint8_t aADCChannelNumber, ui
249252

250253
/*
251254
* Returns sum of all sample values
252-
* Conversion time is defined as 0.104 milliseconds for 16 MHz Arduino by ADC_PRESCALE in ADCUtils.h.
255+
* Conversion time is defined as 0.104 milliseconds for 16 MHz Arduino by ADC_PRESCALE (=ADC_PRESCALE128) in ADCUtils.h.
256+
* @ param aNumberOfSamples If > 64 an overflow may occur.
253257
*/
254-
uint16_t readADCChannelWithReferenceMultiSamples(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aNumberOfSamples) {
258+
uint16_t readADCChannelMultiSamplesWithReference(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aNumberOfSamples) {
255259
uint16_t tSumValue = 0;
256260
ADMUX = aADCChannelNumber | (aReference << SHIFT_VALUE_FOR_REFERENCE);
257261

@@ -275,6 +279,65 @@ uint16_t readADCChannelWithReferenceMultiSamples(uint8_t aADCChannelNumber, uint
275279
return tSumValue;
276280
}
277281

282+
/*
283+
* Returns sum of all sample values
284+
* Conversion time is defined as 0.104 milliseconds for 16 MHz Arduino for ADC_PRESCALE128 in ADCUtils.h.
285+
* @ param aPrescale can be one of ADC_PRESCALE2, ADC_PRESCALE4, 8, 16, 32, 64, 128.
286+
* ADC_PRESCALE32 is recommended for excellent linearity and fast readout of 26 microseconds
287+
* @ param aNumberOfSamples If > 16k an overflow may occur.
288+
*/
289+
uint32_t readADCChannelMultiSamplesWithReferenceAndPrescaler(uint8_t aADCChannelNumber, uint8_t aReference, uint8_t aPrescale,
290+
uint16_t aNumberOfSamples) {
291+
uint32_t tSumValue = 0;
292+
ADMUX = aADCChannelNumber | (aReference << SHIFT_VALUE_FOR_REFERENCE);
293+
294+
ADCSRB = 0; // Free running mode. Only active if ADATE is set to 1.
295+
// ADSC-StartConversion ADATE-AutoTriggerEnable ADIF-Reset Interrupt Flag
296+
ADCSRA = (_BV(ADEN) | _BV(ADSC) | _BV(ADATE) | _BV(ADIF) | aPrescale);
297+
298+
for (uint16_t i = 0; i < aNumberOfSamples; i++) {
299+
/*
300+
* wait for free running conversion to finish.
301+
* Do not wait for ADSC here, since ADSC is only low for 1 ADC Clock cycle on free running conversion.
302+
*/
303+
loop_until_bit_is_set(ADCSRA, ADIF);
304+
305+
ADCSRA |= _BV(ADIF); // clear bit to enable recognizing next conversion has finished
306+
// Add value
307+
tSumValue += ADCL | (ADCH << 8); // using WordUnionForADCUtils does not save space here
308+
// tSumValue += (ADCH << 8) | ADCL; // this does NOT work!
309+
}
310+
ADCSRA &= ~_BV(ADATE); // Disable auto-triggering (free running mode)
311+
return tSumValue;
312+
}
313+
314+
/*
315+
* Returns sum of all sample values
316+
* Assumes, that channel and reference are still set to the right values
317+
* @ param aNumberOfSamples If > 16k an overflow may occur.
318+
*/
319+
uint32_t readADCChannelMultiSamples(uint8_t aPrescale, uint16_t aNumberOfSamples) {
320+
uint32_t tSumValue = 0;
321+
322+
ADCSRB = 0; // Free running mode. Only active if ADATE is set to 1.
323+
// ADSC-StartConversion ADATE-AutoTriggerEnable ADIF-Reset Interrupt Flag
324+
ADCSRA = (_BV(ADEN) | _BV(ADSC) | _BV(ADATE) | _BV(ADIF) | aPrescale);
325+
326+
for (uint16_t i = 0; i < aNumberOfSamples; i++) {
327+
/*
328+
* wait for free running conversion to finish.
329+
* Do not wait for ADSC here, since ADSC is only low for 1 ADC Clock cycle on free running conversion.
330+
*/
331+
loop_until_bit_is_set(ADCSRA, ADIF);
332+
333+
ADCSRA |= _BV(ADIF); // clear bit to enable recognizing next conversion has finished
334+
// Add value
335+
tSumValue += ADCL | (ADCH << 8); // using WordUnionForADCUtils does not save space here
336+
// tSumValue += (ADCH << 8) | ADCL; // this does NOT work!
337+
}
338+
ADCSRA &= ~_BV(ADATE); // Disable auto-triggering (free running mode)
339+
return tSumValue;
340+
}
278341
/*
279342
* use ADC_PRESCALE32 which gives 26 us conversion time and good linearity
280343
* @return the maximum value of aNumberOfSamples samples.
@@ -408,7 +471,7 @@ uint16_t readUntil4ConsecutiveValuesAreEqual(uint8_t aADCChannelNumber, uint8_t
408471
*/
409472
float getVCCVoltageSimple(void) {
410473
// use AVCC with (optional) external capacitor at AREF pin as reference
411-
float tVCC = readADCChannelWithReferenceMultiSamples(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
474+
float tVCC = readADCChannelMultiSamplesWithReference(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
412475
return ((1023 * 1.1 * 4) / tVCC);
413476
}
414477

@@ -419,7 +482,7 @@ float getVCCVoltageSimple(void) {
419482
*/
420483
uint16_t getVCCVoltageMillivoltSimple(void) {
421484
// use AVCC with external capacitor at AREF pin as reference
422-
uint16_t tVCC = readADCChannelWithReferenceMultiSamples(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
485+
uint16_t tVCC = readADCChannelMultiSamplesWithReference(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
423486
return ((1023L * ADC_INTERNAL_REFERENCE_MILLIVOLT * 4) / tVCC);
424487
}
425488

@@ -459,6 +522,9 @@ uint16_t getVCCVoltageMillivolt(void) {
459522
return ((1023L * ADC_INTERNAL_REFERENCE_MILLIVOLT) / tVCC);
460523
}
461524

525+
/*
526+
* Does not set sVCCVoltageMillivolt
527+
*/
462528
uint16_t printVCCVoltageMillivolt(Print *aSerial) {
463529
aSerial->print(F("VCC="));
464530
uint16_t tVCCVoltageMillivolt = getVCCVoltageMillivolt();
@@ -480,7 +546,7 @@ void readAndPrintVCCVoltageMillivolt(Print *aSerial) {
480546
*/
481547
void readVCCVoltageSimple(void) {
482548
// use AVCC with (optional) external capacitor at AREF pin as reference
483-
float tVCC = readADCChannelWithReferenceMultiSamples(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
549+
float tVCC = readADCChannelMultiSamplesWithReference(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
484550
sVCCVoltage = (1023 * (((float) ADC_INTERNAL_REFERENCE_MILLIVOLT) / 1000) * 4) / tVCC;
485551
}
486552

@@ -491,7 +557,7 @@ void readVCCVoltageSimple(void) {
491557
*/
492558
void readVCCVoltageMillivoltSimple(void) {
493559
// use AVCC with external capacitor at AREF pin as reference
494-
uint16_t tVCCVoltageMillivoltRaw = readADCChannelWithReferenceMultiSamples(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
560+
uint16_t tVCCVoltageMillivoltRaw = readADCChannelMultiSamplesWithReference(ADC_1_1_VOLT_CHANNEL_MUX, DEFAULT, 4);
495561
sVCCVoltageMillivolt = (1023L * ADC_INTERNAL_REFERENCE_MILLIVOLT * 4) / tVCCVoltageMillivoltRaw;
496562
}
497563

@@ -548,6 +614,25 @@ bool isVCCUSBPowered() {
548614
&& sVCCVoltageMillivolt < VOLTAGE_USB_POWERED_UPPER_THRESHOLD_MILLIVOLT);
549615
}
550616

617+
/*
618+
* Return true if sVCCVoltageMillivolt is > 4.3 V and < 4.95 V
619+
*/
620+
bool isVCCUSBPowered(Print *aSerial) {
621+
readVCCVoltageMillivolt();
622+
aSerial->print(F("USB powered is "));
623+
bool tReturnValue;
624+
if (VOLTAGE_USB_POWERED_LOWER_THRESHOLD_MILLIVOLT
625+
< sVCCVoltageMillivolt&& sVCCVoltageMillivolt < VOLTAGE_USB_POWERED_UPPER_THRESHOLD_MILLIVOLT) {
626+
tReturnValue = true;
627+
aSerial->print(F("true "));
628+
} else {
629+
tReturnValue = false;
630+
aSerial->print(F("false "));
631+
}
632+
printVCCVoltageMillivolt(aSerial);
633+
return tReturnValue;
634+
}
635+
551636
/*
552637
* @ return true only once, when VCC_UNDERVOLTAGE_CHECKS_BEFORE_STOP (6) times voltage too low -> shutdown
553638
*/
@@ -685,7 +770,7 @@ float getCPUTemperature(void) {
685770
}
686771

687772
#else // defined(ADC_UTILS_ARE_AVAILABLE)
688-
// Dummy definition of functions defined in ADCUtils to compile examples without errors
773+
// Dummy definition of functions defined in ADCUtils to compile examples for non AVR platforms without errors
689774
/*
690775
* Persistent storage for VCC value
691776
*/

examples/IRDispatcherDemo/IRCommandDispatcher.h

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*
66
* To run this example you need to install the "IRremote" or "IRMP" library under "Tools -> Manage Libraries..." or "Ctrl+Shift+I"
77
*
8-
* Copyright (C) 2019-2021 Armin Joachimsmeyer
8+
* Copyright (C) 2019-2024 Armin Joachimsmeyer
99
1010
*
1111
* This file is part of ServoEasing https://github.com/ArminJo/ServoEasing.
1212
* This file is part of IRMP https://github.com/IRMP-org/IRMP.
1313
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
1414
*
15-
* ServoEasing is free software: you can redistribute it and/or modify
15+
* IRCommandDispatcher is free software: you can redistribute it and/or modify
1616
* it under the terms of the GNU General Public License as published by
1717
* the Free Software Foundation, either version 3 of the License, or
1818
* (at your option) any later version.
@@ -38,6 +38,22 @@
3838
#define IR_COMMAND_FLAG_REPEATABLE 0x01 // repeat accepted
3939
#define IR_COMMAND_FLAG_NON_BLOCKING 0x02 // Non blocking (short) command that can be processed any time and may interrupt other IR commands - used for stop, set direction etc.
4040
#define IR_COMMAND_FLAG_REPEATABLE_NON_BLOCKING (IR_COMMAND_FLAG_REPEATABLE | IR_COMMAND_FLAG_NON_BLOCKING)
41+
#define IR_COMMAND_FLAG_BEEP 0x04 // Do a single short beep before executing command. May not be useful for short or repeating commands.
42+
#define IR_COMMAND_FLAG_BLOCKING_BEEP (IR_COMMAND_FLAG_BLOCKING | IR_COMMAND_FLAG_BEEP)
43+
44+
45+
#if !defined(IS_STOP_REQUESTED)
46+
#define IS_STOP_REQUESTED IRDispatcher.requestToStopReceived
47+
#endif
48+
#if !defined(RETURN_IF_STOP)
49+
#define RETURN_IF_STOP if (IRDispatcher.requestToStopReceived) return
50+
#endif
51+
#if !defined(BREAK_IF_STOP)
52+
#define BREAK_IF_STOP if (IRDispatcher.requestToStopReceived) break
53+
#endif
54+
#if !defined(DELAY_AND_RETURN_IF_STOP)
55+
#define DELAY_AND_RETURN_IF_STOP(aDurationMillis) if (IRDispatcher.delayAndCheckForStop(aDurationMillis)) return
56+
#endif
4157

4258
// Basic mapping structure
4359
struct IRToCommandMappingStruct {
@@ -72,13 +88,10 @@ struct IRDataForCommandDispatcherStruct {
7288
#define COMMAND_EMPTY 0xFF // code no command
7389
#endif
7490

75-
#define RETURN_IF_STOP if (IRDispatcher.requestToStopReceived) return
76-
#define BREAK_IF_STOP if (IRDispatcher.requestToStopReceived) break
77-
#define DELAY_AND_RETURN_IF_STOP(aDurationMillis) if (IRDispatcher.delayAndCheckForStop(aDurationMillis)) return
78-
7991
class IRCommandDispatcher {
8092
public:
8193
void init();
94+
void printIRInfo(Print *aSerial);
8295

8396
bool checkAndRunNonBlockingCommands();
8497
bool checkAndRunSuspendedBlockingCommands();
@@ -107,7 +120,8 @@ class IRCommandDispatcher {
107120
bool justCalledBlockingCommand = false; // Flag that a blocking command was received and called - is set before call of command
108121
/*
109122
* Flag for running blocking commands to terminate. To check, you can use "if (IRDispatcher.requestToStopReceived) return;" (available as macro RETURN_IF_STOP).
110-
* Is reset by next IR command received. Can be reset by main loop, if command has stopped.
123+
* It is set if a blocking IR command received, which cannot be executed directly. Can be reset by main loop, if command has stopped.
124+
* It is reset before executing a blocking command.
111125
*/
112126
volatile bool requestToStopReceived;
113127
/*

0 commit comments

Comments
 (0)