Compare commits

...

3 Commits

37 changed files with 158 additions and 192 deletions

View File

@ -2,6 +2,10 @@
The latest version may not be released!
See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master
# 4.3.1
- Fixed overflow bug for rawlen > 254.
- Removed deprecated sendPulseDistance... functions with parameter aSendStopBit.
# 4.3.0
- Removed default value USE_DEFAULT_FEEDBACK_LED_PIN for last parameter of IRsend::begin(bool aEnableLEDFeedback, uint_fast8_t aFeedbackLEDPin).
Therefore IrSender.begin(DISABLE_LED_FEEDBACK) will not longer work!

View File

@ -241,7 +241,8 @@ void loop() {
) {
// Print more info, but only if we are connected to USB, i.e. VCC is > 4300 mV, because this may take to long to detect some fast repeats
IrReceiver.printIRSendUsage(&Serial);
IrReceiver.printIRResultRawFormatted(&Serial, false); // print ticks, this is faster :-)
// IrReceiver.printIRResultRawFormatted(&Serial, false); // print ticks, this is faster :-)
IrReceiver.printIRResultRawFormatted(&Serial); // print us, this is better to compare :-)
}
// Guarantee at least 5 millis for tone. decode starts 5 millis (RECORD_GAP_MICROS) after end of frame

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -137,13 +137,16 @@ void setup() {
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604. Code does not fit in program memory of ATtiny85 etc.
Serial.println();
Serial.print(F("If you connect debug pin "));
if (digitalRead(DEBUG_BUTTON_PIN) != LOW) {
Serial.print(F("If you connect debug pin "));
# if defined(APPLICATION_PIN_STRING)
Serial.print(APPLICATION_PIN_STRING);
Serial.print(APPLICATION_PIN_STRING);
# else
Serial.print(DEBUG_BUTTON_PIN);
Serial.print(DEBUG_BUTTON_PIN);
# endif
Serial.println(F(" to ground, raw data is always printed"));
Serial.print(F(" to ground, "));
}
Serial.println(F("raw data is always printed"));
// infos for receive
Serial.print(RECORD_GAP_MICROS);
@ -201,9 +204,10 @@ void loop() {
Serial.println(F("Received noise or an unknown (or not yet enabled) protocol"));
}
IrReceiver.printIRResultRawFormatted(&Serial, true);
} else {
}
if (IrReceiver.decodedIRData.protocol != UNKNOWN) {
/*
* This is the info output for a successful receive in normal mode
* The info output for a successful receive
*/
IrReceiver.printIRResultShort(&Serial);
IrReceiver.printIRSendUsage(&Serial);

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -26,7 +26,7 @@
************************************************************************************
* MIT License
*
* Copyright (c) 2022-2023 Armin Joachimsmeyer
* Copyright (c) 2022-2024 Armin Joachimsmeyer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -56,13 +56,17 @@
//#define TRACE // to see the state of the ISR state machine
/*
* Set compile options to modify the generated code.
* Protocol selection
*/
//#define DISABLE_PARITY_CHECKS // Disable parity checks. Saves 48 bytes of program memory.
//#define USE_EXTENDED_NEC_PROTOCOL // Like NEC, but take the 16 bit address as one 16 bit value and not as 8 bit normal and 8 bit inverted value.
//#define USE_ONKYO_PROTOCOL // 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.
//#define USE_FAST_PROTOCOL // Use FAST protocol (no address and 16 bit data, interpreted as 8 bit command and 8 bit inverted command) instead of NEC / ONKYO.
//#define ENABLE_NEC2_REPEATS // Instead of sending / receiving the NEC special repeat code, send / receive the original frame for repeat.
//#define USE_FAST_PROTOCOL // Use FAST protocol instead of NEC / ONKYO.
//#define ENABLE_NEC2_REPEATS // Instead of sending / receiving the NEC special repeat code, send / receive the original frame for repeat.
/*
* Set compile options to modify the generated code.
*/
//#define DISABLE_PARITY_CHECKS // Disable parity checks. Saves 48 bytes of program memory.
//#define USE_CALLBACK_FOR_TINY_RECEIVER // Call the fixed function "void handleReceivedTinyIRData()" each time a frame or repeat is received.
#include "TinyIRReceiver.hpp" // include the code
@ -113,6 +117,9 @@ void loop() {
}
if (TinyIRReceiverData.Flags == IRDATA_FLAGS_PARITY_FAILED) {
Serial.print(F(" Parity failed"));
#if !defined(USE_EXTENDED_NEC_PROTOCOL) && !defined(USE_ONKYO_PROTOCOL)
Serial.print(F(", try USE_EXTENDED_NEC_PROTOCOL or USE_ONKYO_PROTOCOL"));
#endif
}
Serial.println();
}

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -41,9 +41,9 @@
* ATtiny1614 8|PA1 10|PA3 1|PA5 MegaTinyCore
* SAMD21 3 4 5
* ESP8266 14|D5 12|D6 %
* ESP32 15 4 27
* ESP32-C3 6 7
* BluePill PA6 PA7 PA3
* ESP32 15 4 27
* ESP32-C3 6 7 10
* BluePill PA6 PA7 PA3
* APOLLO3 11 12 5
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
*/

View File

@ -9,7 +9,7 @@
************************************************************************************
* MIT License
*
* Copyright (c) 2020-2023 Armin Joachimsmeyer
* Copyright (c) 2020-2024 Armin Joachimsmeyer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/z3t0/Arduino-IRremote.git"
},
"version": "4.3.0",
"version": "4.3.1",
"frameworks": "arduino",
"platforms": ["atmelavr", "atmelmegaavr", "atmelsam", "espressif8266", "espressif32", "ststm32"],
"authors" :

View File

@ -1,5 +1,5 @@
name=IRremote
version=4.3.0
version=4.3.1
author=shirriff, z3t0, ArminJo
maintainer=Armin Joachimsmeyer <armin.arduino@gmail.com>
sentence=Send and receive infrared signals with multiple protocols

View File

@ -118,12 +118,8 @@ struct IRData {
uint16_t numberOfBits; ///< Number of bits received for data (address + command + parity) - to determine protocol length if different length are possible.
uint8_t flags; ///< IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above
//These 2 variables allow to call resume() directly after decode, if no dump is required. Since 4.3.0.
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
uint_fast8_t rawlen; ///< counter of entries in rawbuf
#else
uint_fast16_t rawlen; ///< counter of entries in rawbuf
#endif
// These 2 variables allow to call resume() directly after decode, if no dump is required. Since 4.3.0.
IRRawlenType rawlen; ///< counter of entries in rawbuf
uint16_t initialGap; ///< rawbuf[0] contains the initial gap of the last frame.
irparams_struct *rawDataPtr; ///< Pointer of the raw timing data to be decoded. Mainly the OverflowFlag and the data buffer filled by receiving ISR.
@ -141,12 +137,9 @@ struct PulseDistanceWidthProtocolConstants {
/*
* Definitions for member PulseDistanceWidthProtocolConstants.Flags
*/
#define SUPPRESS_STOP_BIT_FOR_THIS_DATA 0x20
#define SUPPRESS_STOP_BIT_FOR_THIS_DATA 0x20 // Stop bit is otherwise sent for all pulse distance protocols.
#define PROTOCOL_IS_MSB_FIRST IRDATA_FLAGS_IS_MSB_FIRST
#define PROTOCOL_IS_LSB_FIRST IRDATA_FLAGS_IS_LSB_FIRST
// 2 definitions for deprecated parameter bool aSendStopBit
#define SEND_STOP_BIT true
#define SEND_NO_STOP_BIT false
/*
* Carrier frequencies for various protocols

View File

@ -700,7 +700,7 @@ bool IRrecv::decode() {
* @param aMSBfirst If true send Most Significant Bit first, else send Least Significant Bit (lowest bit) first.
* @return true If decoding was successful
*/
bool IRrecv::decodePulseDistanceWidthData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, uint16_t aOneMarkMicros,
bool IRrecv::decodePulseDistanceWidthData(uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset, uint16_t aOneMarkMicros,
uint16_t aZeroMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroSpaceMicros, bool aMSBfirst) {
auto *tRawBufPointer = &decodedIRData.rawDataPtr->rawbuf[aStartOffset];
@ -843,7 +843,7 @@ bool IRrecv::decodePulseDistanceWidthData(uint_fast8_t aNumberOfBits, uint_fast8
* @return true if decoding was successful
*/
bool IRrecv::decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits,
uint_fast8_t aStartOffset) {
IRRawlenType aStartOffset) {
return decodePulseDistanceWidthData(aNumberOfBits, aStartOffset, aProtocolConstants->DistanceWidthTimingInfo.OneMarkMicros,
aProtocolConstants->DistanceWidthTimingInfo.ZeroMarkMicros, aProtocolConstants->DistanceWidthTimingInfo.OneSpaceMicros,
@ -853,9 +853,9 @@ bool IRrecv::decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *a
/*
* Static variables for the getBiphaselevel function
*/
uint_fast8_t sBiphaseDecodeRawbuffOffset; // Index into raw timing array
uint16_t sBiphaseCurrentTimingIntervals; // 1, 2 or 3. Number of aBiphaseTimeUnit intervals of the current rawbuf[sBiphaseDecodeRawbuffOffset] timing.
uint_fast8_t sBiphaseUsedTimingIntervals; // Number of already used intervals of sCurrentTimingIntervals.
uint_fast8_t sBiphaseDecodeRawbuffOffset; // Index into raw timing array
uint16_t sBiphaseCurrentTimingIntervals; // 1, 2 or 3. Number of aBiphaseTimeUnit intervals of the current rawbuf[sBiphaseDecodeRawbuffOffset] timing.
uint_fast8_t sBiphaseUsedTimingIntervals; // Number of already used intervals of sCurrentTimingIntervals.
uint16_t sBiphaseTimeUnit;
void IRrecv::initBiphaselevel(uint_fast8_t aRCDecodeRawbuffOffset, uint16_t aBiphaseTimeUnit) {
@ -967,12 +967,7 @@ bool IRrecv::decodeHash() {
if (decodedIRData.rawlen < 6) {
return false;
}
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
uint_fast8_t i;
#else
unsigned int i;
#endif
for (i = 1; (i + 2) < decodedIRData.rawlen; i++) {
for (IRRawlenType i = 1; (i + 2) < decodedIRData.rawlen; i++) {
// Compare mark with mark and space with space
uint_fast8_t value = compare(decodedIRData.rawDataPtr->rawbuf[i], decodedIRData.rawDataPtr->rawbuf[i + 2]);
// Add value into the hash
@ -1281,7 +1276,8 @@ void IRrecv::printDistanceWidthTimingInfo(Print *aSerial, DistanceWidthTimingInf
uint32_t IRrecv::getTotalDurationOfRawData() {
uint16_t tSumOfDurationTicks = 0;
for (uint_fast8_t i = 1; i < decodedIRData.rawlen; i++) {
for (IRRawlenType i = 1; i < decodedIRData.rawlen; i++) {
tSumOfDurationTicks += decodedIRData.rawDataPtr->rawbuf[i];
}
return tSumOfDurationTicks * (uint32_t) MICROS_PER_TICK;
@ -1473,10 +1469,9 @@ void IRrecv::printIRResultMinimal(Print *aSerial) {
*/
void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsInsteadOfTicks) {
uint8_t tRawlen = decodedIRData.rawlen; // Get it once here in order to print quite consistent data, even if ISR is running
// Print Raw data
aSerial->print(F("rawData["));
aSerial->print(tRawlen, DEC);
aSerial->print(decodedIRData.rawlen, DEC);
aSerial->println(F("]: "));
/*
@ -1488,11 +1483,6 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
} else {
aSerial->println(decodedIRData.initialGap, DEC);
}
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
uint_fast8_t i;
#else
unsigned int i;
#endif
// Newline is printed every 8. value, if tCounterForNewline % 8 == 0
uint_fast8_t tCounterForNewline = 6; // first newline is after the 2 values of the start bit
@ -1513,7 +1503,7 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
uint32_t tDuration;
uint16_t tSumOfDurationTicks = 0;
for (i = 1; i < tRawlen; i++) {
for (IRRawlenType i = 1; i < decodedIRData.rawlen; i++) {
auto tCurrentTicks = decodedIRData.rawDataPtr->rawbuf[i];
if (aOutputMicrosecondsInsteadOfTicks) {
tDuration = tCurrentTicks * MICROS_PER_TICK;
@ -1540,7 +1530,7 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
}
aSerial->print(tDuration, DEC);
if ((i & 1) && (i + 1) < tRawlen) {
if ((i & 1) && (i + 1) < decodedIRData.rawlen) {
aSerial->print(','); //',' not required for last one
}
@ -1582,12 +1572,7 @@ void IRrecv::compensateAndPrintIRResultAsCArray(Print *aSerial, bool aOutputMicr
aSerial->print(F("] = {")); // Start declaration
// Dump data
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
uint_fast8_t i;
#else
unsigned int i;
#endif
for (i = 1; i < decodedIRData.rawlen; i++) {
for (IRRawlenType i = 1; i < decodedIRData.rawlen; i++) {
uint32_t tDuration = decodedIRData.rawDataPtr->rawbuf[i] * MICROS_PER_TICK;
if (i & 1) {
@ -1634,11 +1619,7 @@ void IRrecv::compensateAndPrintIRResultAsCArray(Print *aSerial, bool aOutputMicr
void IRrecv::compensateAndStoreIRResultInArray(uint8_t *aArrayPtr) {
// Store data, skip leading space#
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
uint_fast8_t i;
#else
unsigned int i;
#endif
IRRawlenType i;
for (i = 1; i < decodedIRData.rawlen; i++) {
uint32_t tDuration = decodedIRData.rawDataPtr->rawbuf[i] * MICROS_PER_TICK;
if (i & 1) {

View File

@ -521,21 +521,8 @@ void IRsend::sendRaw_P(const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOf
* For LSB First the LSB of array[0] is sent first then all bits until MSB of array[0]. Next is LSB of array[1] and so on.
* The output always ends with a space
* Stop bit is always sent
* @param aFlags Evaluated flags are PROTOCOL_IS_MSB_FIRST and SUPPRESS_STOP_BIT_FOR_THIS_DATA. Stop bit is otherwise sent for all pulse distance protocols.
*/
void IRsend::sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros,
uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, bool aMSBFirst, bool aSendStopBit,
uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats) {
uint8_t tFlags = 0;
if (aMSBFirst) {
tFlags = PROTOCOL_IS_MSB_FIRST;
}
(void) aSendStopBit;
sendPulseDistanceWidthFromArray(aFrequencyKHz, aHeaderMarkMicros, aHeaderSpaceMicros, aOneMarkMicros, aOneSpaceMicros,
aZeroMarkMicros, aZeroSpaceMicros, aDecodedRawDataArray, aNumberOfBits, tFlags, aRepeatPeriodMillis, aNumberOfRepeats);
}
void IRsend::sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, DistanceWidthTimingInfoStruct *aDistanceWidthTimingInfo,
IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
int_fast8_t aNumberOfRepeats) {
@ -545,7 +532,6 @@ void IRsend::sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, Distanc
aDistanceWidthTimingInfo->ZeroSpaceMicros, aDecodedRawDataArray, aNumberOfBits, aFlags, aRepeatPeriodMillis,
aNumberOfRepeats);
}
void IRsend::sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros,
uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
@ -616,6 +602,9 @@ void IRsend::sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, uint16_
* For LSB First the LSB of array[0] is sent first then all bits until MSB of array[0]. Next is LSB of array[1] and so on.
* The output always ends with a space
* Stop bit is always sent
* @param aNumberOfBits Number of bits from aDecodedRawDataArray to be actually sent.
* @param aNumberOfRepeats If < 0 and a aProtocolConstants->SpecialSendRepeatFunction() is specified
* then it is called without leading and trailing space.
*/
void IRsend::sendPulseDistanceWidthFromArray(PulseDistanceWidthProtocolConstants *aProtocolConstants,
IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats) {
@ -692,7 +681,7 @@ void IRsend::sendPulseDistanceWidthFromArray(PulseDistanceWidthProtocolConstants
}
/**
* Sends PulseDistance frames and repeats and enables receiver again
* Sends PulseDistance frames and repeats
* @param aProtocolConstants The constants to use for sending this protocol.
* @param aData uint32 or uint64 holding the bits to be sent.
* @param aNumberOfBits Number of bits from aData to be actually sent.
@ -761,23 +750,11 @@ void IRsend::sendPulseDistanceWidth(PulseDistanceWidthProtocolConstants *aProtoc
* @param aFrequencyKHz, aHeaderMarkMicros, aHeaderSpaceMicros, aOneMarkMicros, aOneSpaceMicros, aZeroMarkMicros, aZeroSpaceMicros, aFlags, aRepeatPeriodMillis Values to use for sending this protocol, also contained in the PulseDistanceWidthProtocolConstants of this protocol.
* @param aData uint32 or uint64 holding the bits to be sent.
* @param aNumberOfBits Number of bits from aData to be actually sent.
* @param aFlags Evaluated flags are PROTOCOL_IS_MSB_FIRST and SUPPRESS_STOP_BIT_FOR_THIS_DATA. Stop bit is otherwise sent for all pulse distance protocols.
* @param aNumberOfRepeats If < 0 and a aProtocolConstants->SpecialSendRepeatFunction() is specified
* then it is called without leading and trailing space.
* @param aSpecialSendRepeatFunction If NULL, the first frame is repeated completely, otherwise this function is used for sending the repeat frame.
*/
void IRsend::sendPulseDistanceWidth(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros,
uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, IRRawDataType aData,
uint_fast8_t aNumberOfBits, bool aMSBFirst, bool aSendStopBit, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats,
void (*aSpecialSendRepeatFunction)()) {
uint8_t tFlags = 0;
if (aMSBFirst) {
tFlags = PROTOCOL_IS_MSB_FIRST;
}
(void) aSendStopBit;
sendPulseDistanceWidth(aFrequencyKHz, aHeaderMarkMicros, aHeaderSpaceMicros, aOneMarkMicros, aOneSpaceMicros, aZeroMarkMicros,
aZeroSpaceMicros, aData, aNumberOfBits, tFlags, aRepeatPeriodMillis, aNumberOfRepeats, aSpecialSendRepeatFunction);
}
void IRsend::sendPulseDistanceWidth(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros,
uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros, IRRawDataType aData,
uint_fast8_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats,
@ -825,9 +802,12 @@ void IRsend::sendPulseDistanceWidth(uint_fast8_t aFrequencyKHz, uint16_t aHeader
}
/**
* Sends PulseDistance data
* Sends PulseDistance from data contained in parameter using ProtocolConstants structure for timing etc.
* The output always ends with a space
* Each additional call costs 16 bytes program memory
* @param aProtocolConstants The constants to use for sending this protocol.
* @param aData uint32 or uint64 holding the bits to be sent.
* @param aNumberOfBits Number of bits from aData to be actually sent.
*/
void IRsend::sendPulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData,
uint_fast8_t aNumberOfBits) {
@ -838,18 +818,13 @@ void IRsend::sendPulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aPr
}
/**
* Sends PulseDistance data
* Sends PulseDistance data with timing parameters and flag parameters.
* The output always ends with a space
* @param aOneMarkMicros Timing for sending this protocol.
* @param aData uint32 or uint64 holding the bits to be sent.
* @param aNumberOfBits Number of bits from aData to be actually sent.
* @param aFlags Evaluated flags are PROTOCOL_IS_MSB_FIRST and SUPPRESS_STOP_BIT_FOR_THIS_DATA. Stop bit is otherwise sent for all pulse distance protocols.
*/
void IRsend::sendPulseDistanceWidthData(uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
uint16_t aZeroSpaceMicros, IRRawDataType aData, uint_fast8_t aNumberOfBits, bool aMSBFirst, bool aSendStopBit) {
uint8_t tFlags = 0;
if (aMSBFirst) {
tFlags = PROTOCOL_IS_MSB_FIRST;
}
(void) aSendStopBit;
sendPulseDistanceWidthData(aOneMarkMicros, aOneSpaceMicros, aZeroMarkMicros, aZeroSpaceMicros, aData, aNumberOfBits, tFlags);
}
void IRsend::sendPulseDistanceWidthData(uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
uint16_t aZeroSpaceMicros, IRRawDataType aData, uint_fast8_t aNumberOfBits, uint8_t aFlags) {
@ -885,6 +860,7 @@ void IRsend::sendPulseDistanceWidthData(uint16_t aOneMarkMicros, uint16_t aOneSp
/*
* Stop bit is sent for all pulse distance protocols i.e. aOneMarkMicros == aZeroMarkMicros.
* Therefore it is not sent for Sony and Magiquest :-)
* For sending from an array, no intermediate stop bit must be sent for first data chunk.
*/
if (!(aFlags & SUPPRESS_STOP_BIT_FOR_THIS_DATA) && aOneMarkMicros == aZeroMarkMicros) {
// Send stop bit here
@ -905,6 +881,8 @@ void IRsend::sendPulseDistanceWidthData(uint16_t aOneMarkMicros, uint16_t aOneSp
* 1 -> space+mark
* The output always ends with a space
* can only send 31 bit data, since we put the start bit as 32th bit on front
* @param aData uint32 or uint64 holding the bits to be sent.
* @param aNumberOfBits Number of bits from aData to be actually sent.
*/
void IRsend::sendBiphaseData(uint16_t aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits) {

View File

@ -36,10 +36,10 @@
#ifndef _IR_VERSION_HPP
#define _IR_VERSION_HPP
#define VERSION_IRREMOTE "4.3.0"
#define VERSION_IRREMOTE "4.3.1"
#define VERSION_IRREMOTE_MAJOR 4
#define VERSION_IRREMOTE_MINOR 3
#define VERSION_IRREMOTE_PATCH 0
#define VERSION_IRREMOTE_PATCH 1
/*
* Macro to convert 3 version parts into an integer

View File

@ -79,6 +79,11 @@
#error RAW_BUFFER_LENGTH must be even, since the array consists of space / mark pairs.
#endif
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
typedef uint_fast8_t IRRawlenType;
#else
typedef unsigned int IRRawlenType;
#endif
/****************************************************
* Declarations for the receiver Interrupt Service Routine
****************************************************/
@ -105,11 +110,7 @@ struct irparams_struct {
void (*ReceiveCompleteCallbackFunction)(void); ///< The function to call if a protocol message has arrived, i.e. StateForISR changed to IR_REC_STATE_STOP
#endif
bool OverflowFlag; ///< Raw buffer OverflowFlag occurred
#if RAW_BUFFER_LENGTH <= 254 // saves around 75 bytes program memory and speeds up ISR
uint_fast8_t rawlen; ///< counter of entries in rawbuf
#else
uint_fast16_t rawlen; ///< counter of entries in rawbuf
#endif
IRRawlenType rawlen; ///< counter of entries in rawbuf
uint16_t rawbuf[RAW_BUFFER_LENGTH]; ///< raw data / tick counts per mark/space, first entry is the length of the gap between previous and current command
};
@ -249,12 +250,12 @@ public:
* The main decoding functions used by the individual decoders
*/
bool decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits,
uint_fast8_t aStartOffset = 3);
IRRawlenType aStartOffset = 3);
bool decodePulseDistanceWidthData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, uint16_t aOneMarkMicros,
bool decodePulseDistanceWidthData(uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset, uint16_t aOneMarkMicros,
uint16_t aZeroMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroSpaceMicros, bool aMSBfirst);
bool decodeBiPhaseData(uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset, uint_fast8_t aStartClockCount,
bool decodeBiPhaseData(uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset, uint_fast8_t aStartClockCount,
uint_fast8_t aValueOfSpaceToMarkTransition, uint16_t aBiphaseTimeUnit);
void initBiphaselevel(uint_fast8_t aRCDecodeRawbuffOffset, uint16_t aBiphaseTimeUnit);
@ -458,11 +459,6 @@ public:
uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, uint8_t aFlags, uint16_t aRepeatPeriodMillis,
int_fast8_t aNumberOfRepeats);
void sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, uint16_t aHeaderMarkMicros, uint16_t aHeaderSpaceMicros,
uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros, uint16_t aZeroSpaceMicros,
IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, bool aMSBFirst, bool aSendStopBit,
uint16_t aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
__attribute__ ((deprecated ("Since version 4.1.0 parameter aSendStopBit is not longer required.")));
void sendPulseDistanceWidthFromArray(PulseDistanceWidthProtocolConstants *aProtocolConstants,
IRRawDataType *aDecodedRawDataArray, uint16_t aNumberOfBits, int_fast8_t aNumberOfRepeats);
void sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, DistanceWidthTimingInfoStruct *aDistanceWidthTimingInfo,
@ -484,9 +480,6 @@ public:
__attribute__ ((deprecated ("Since version 4.1.0 parameter aSendStopBit is not longer required.")));
void sendPulseDistanceWidthData(uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
uint16_t aZeroSpaceMicros, IRRawDataType aData, uint_fast8_t aNumberOfBits, uint8_t aFlags);
void sendPulseDistanceWidthData(uint16_t aOneMarkMicros, uint16_t aOneSpaceMicros, uint16_t aZeroMarkMicros,
uint16_t aZeroSpaceMicros, IRRawDataType aData, uint_fast8_t aNumberOfBits, bool aMSBFirst, bool aSendStopBit)
__attribute__ ((deprecated ("Since version 4.1.0 last parameter aSendStopBit is not longer required.")));
void sendBiphaseData(uint16_t aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits);
void mark(uint16_t aMarkMicros);

View File

@ -76,6 +76,9 @@
//#define LOCAL_DEBUG // This enables debug output only for this file
#endif
/*
* Protocol selection
*/
//#define DISABLE_PARITY_CHECKS // Disable parity checks. Saves 48 bytes of program memory.
//#define USE_EXTENDED_NEC_PROTOCOL // Like NEC, but take the 16 bit address as one 16 bit value and not as 8 bit normal and 8 bit inverted value.
//#define USE_ONKYO_PROTOCOL // 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.

View File

@ -23,8 +23,8 @@
* https://github.com/Arduino-IRremote/Arduino-IRremote/blob/d51b540cb2ddf1424888d2d9e6b62fe1ef46859d/examples/SendDemo/SendDemo.ino#L175
* sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, unsigned int aHeaderMarkMicros,
* unsigned int aHeaderSpaceMicros, unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros,
* unsigned int aZeroSpaceMicros, uint32_t *aDecodedRawDataArray, unsigned int aNumberOfBits, bool aMSBFirst,
* bool aSendStopBit, unsigned int aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
* unsigned int aZeroSpaceMicros, uint32_t *aDecodedRawDataArray, unsigned int aNumberOfBits, uint8_t aFlags,
* unsigned int aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
*
* This file is part of Arduino-IRremote https://github.com/Arduino-IRremote/Arduino-IRremote.
*
@ -163,8 +163,6 @@ bool IRrecv::decodeDistanceWidth() {
return false;
}
uint_fast8_t i;
// Reset duration array
memset(tDurationArray, 0, DURATION_ARRAY_SIZE);
@ -172,7 +170,7 @@ bool IRrecv::decodeDistanceWidth() {
/*
* Count number of mark durations up to 49 ticks. Skip leading start and trailing stop bit.
*/
for (i = 3; i < (uint_fast8_t) decodedIRData.rawlen - 2; i += 2) {
for (IRRawlenType i = 3; i < decodedIRData.rawlen - 2; i += 2) {
auto tDurationTicks = decodedIRData.rawDataPtr->rawbuf[i];
if (tDurationTicks < DURATION_ARRAY_SIZE) {
tDurationArray[tDurationTicks]++; // count duration if less than DURATION_ARRAY_SIZE (50)
@ -219,7 +217,7 @@ bool IRrecv::decodeDistanceWidth() {
* Count number of space durations. Skip leading start and trailing stop bit.
*/
tIndexOfMaxDuration = 0;
for (i = 4; i < (uint_fast8_t) decodedIRData.rawlen - 2; i += 2) {
for (IRRawlenType i = 4; i < decodedIRData.rawlen - 2; i += 2) {
auto tDurationTicks = decodedIRData.rawDataPtr->rawbuf[i];
if (tDurationTicks < DURATION_ARRAY_SIZE) {
tDurationArray[tDurationTicks]++;
@ -284,9 +282,12 @@ bool IRrecv::decodeDistanceWidth() {
Serial.print(F(", "));
Serial.println(tSpaceTicksShort * MICROS_PER_TICK);
#endif
uint8_t tStartIndex = 3;
// skip leading start bit for decoding.
uint16_t tNumberOfBits = (decodedIRData.rawlen / 2) - 1;
#if RAW_BUFFER_LENGTH <= 508
uint_fast8_t tNumberOfBits;
#else
uint16_t tNumberOfBits;
#endif
tNumberOfBits = (decodedIRData.rawlen / 2) - 1;
if (tSpaceTicksLong > 0 && tMarkTicksLong == 0) {
// For PULSE_DISTANCE a stop bit is mandatory, for PULSE_WIDTH it is not required!
tNumberOfBits--; // Correct for stop bit
@ -320,6 +321,7 @@ bool IRrecv::decodeDistanceWidth() {
unsigned int tMarkMicrosShort = tMarkTicksShort * MICROS_PER_TICK;
unsigned int tMarkMicrosLong = tMarkTicksLong * MICROS_PER_TICK;
unsigned int tSpaceMicrosLong = tSpaceTicksLong * MICROS_PER_TICK;
IRRawlenType tStartIndex = 3; // skip leading start bit for decoding.
for (uint_fast8_t i = 0; i <= tNumberOfAdditionalArrayValues; ++i) {
uint8_t tNumberOfBitsForOneDecode = tNumberOfBits;