Added NEC2 protocol, Improved Magiquest protocol, minor adjustments, renamed sendSamsungRepeat to sendSamsungLGRepeat, added function sendPulseDistanceWidth(), improved repeat detection for some protocols

This commit is contained in:
Armin 2022-08-27 20:22:58 +02:00
parent 91df621500
commit 1eb7ff24b1
45 changed files with 998 additions and 938 deletions

View File

@ -1,5 +1,4 @@
# Contribution Guidelines
# Contributing
This library is the culmination of the expertise of many members of the open source community who have dedicated their time and hard work.
If you want to contribute to this project:
@ -9,6 +8,7 @@ If you want to contribute to this project:
- Tell other people about this library
- Contribute new protocols
## Guidelines
The following are some guidelines to observe when creating discussions / PRs:
- Be friendly; it is important that we can all enjoy a safe space as we are all working on the same project and **it is okay for people to have different ideas**.
- Use reasonable titles; refrain from using overly long or capitalized titles as they are usually annoying and do little to encourage others to help :smile:.

View File

@ -2,7 +2,7 @@ MIT License
(c) Copyright 2009 Ken Shirriff http://www.righto.com
(c) Copyright 2016 Rafi Khan
(c) Copyright 2020 Armin Joachimsmeyer et al.
(c) Copyright 2020-2022 Armin Joachimsmeyer et al.
http://www.opensource.org/licenses/mit-license.php

181
README.md
View File

@ -5,7 +5,7 @@ A library enabling the sending & receiving of infra-red signals.
[![Badge License: MIT](https://img.shields.io/badge/License-MIT-ac8b11.svg?style=for-the-badge&labelColor=yellow)](https://opensource.org/licenses/MIT)
   
[![Badge Version](https://img.shields.io/github/v/release/Arduino-IRremote/Arduino-IRremote?include_prereleases&style=for-the-badge&color=33660e&labelColor=428813&logoColor=white&logo=DocuSign)](https://www.ardu-badge.com/IRremote)
[![Badge Version](https://img.shields.io/github/v/release/Arduino-IRremote/Arduino-IRremote?include_prereleases&style=for-the-badge&color=33660e&labelColor=428813&logoColor=white&logo=DocuSign)](https://github.com/Arduino-IRremote/Arduino-IRremote/releases/latest)
   
[![Badge Commits since latest](https://img.shields.io/github/commits-since/Arduino-IRremote/Arduino-IRremote/latest?style=for-the-badge&color=004463&labelColor=00557f)](https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master)
   
@ -16,7 +16,7 @@ A library enabling the sending & receiving of infra-red signals.
Available as [Arduino library "IRremote"](https://www.arduinolibraries.info/libraries/i-rremote).
[![Button Install](https://img.shields.io/badge/Install-yellow?style=for-the-badge&logoColor=white&logo=GitBook)](https://www.ardu-badge.com/IRremote/zip)
[![Button Install](https://img.shields.io/badge/Install-yellow?style=for-the-badge&logoColor=white&logo=GitBook)](https://www.ardu-badge.com/IRremote)
   
[![Button API](https://img.shields.io/badge/API-1c8840?style=for-the-badge&logoColor=white&logo=OpenStreetMap)](https://arduino-irremote.github.io/Arduino-IRremote/classIRrecv.html)
   
@ -63,7 +63,6 @@ Available as [Arduino library "IRremote"](https://www.arduinolibraries.info/libr
* [Incompatibilities to other libraries and Arduino commands like tone() and analogWrite()](https://github.com/Arduino-IRremote/Arduino-IRremote#incompatibilities-to-other-libraries-and-arduino-commands-like-tone-and-analogwrite)
* [Hardware-PWM signal generation for sending](https://github.com/Arduino-IRremote/Arduino-IRremote#hardware-pwm-signal-generation-for-sending)
* [Why do we use 30% duty cycle for sending](https://github.com/Arduino-IRremote/Arduino-IRremote#why-do-we-use-30-duty-cycle-for-sending)
* [Increase sending power](https://github.com/Arduino-IRremote/Arduino-IRremote#increase-sending-power)
- [How we decode signals](https://github.com/Arduino-IRremote/Arduino-IRremote#how-we-decode-signals)
- [NEC encoding diagrams](https://github.com/Arduino-IRremote/Arduino-IRremote#nec-encoding-diagrams)
- [Quick comparison of 5 Arduino IR receiving libraries](https://github.com/Arduino-IRremote/Arduino-IRremote#quick-comparison-of-5-arduino-ir-receiving-libraries)
@ -104,7 +103,7 @@ Protocols can be switched off and on by defining macros before the line `#includ
- Protocol values comply to **protocol standards**.<br/>
NEC, Panasonic, Sony, Samsung and JVC decode & send LSB first.
- Supports **Universal Distance protocol**, which covers a lot of previous unknown protocols.
- Compatible with **tone()** library, see [ReceiveDemo](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/21b5747a58e9d47c9e3f1beb056d58c875a92b47/examples/ReceiveDemo/ReceiveDemo.ino#L159-L169).
- Compatible with **tone()** library. See the [ReceiveDemo](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/21b5747a58e9d47c9e3f1beb056d58c875a92b47/examples/ReceiveDemo/ReceiveDemo.ino#L159-L169) example.
- Simultaneous sending and receiving. See the [SendAndReceive](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/examples/SendAndReceive/SendAndReceive.ino#L167-L170) example.
- Supports **more platforms**.
- Allows for the generation of non PWM signal to just **simulate an active low receiver signal** for direct connect to existent receiving devices without using IR.
@ -188,8 +187,8 @@ If this doesn't fit your case, be assured that 3.x is at least trying to be back
- Only the following decoders are available:<br/>
` NEC ` &nbsp; &nbsp; ` Denon ` &nbsp; &nbsp; ` Panasonic ` &nbsp; &nbsp; ` JVC ` &nbsp; &nbsp; ` LG `<br/>
` RC5 ` &nbsp; &nbsp; ` RC6 ` &nbsp; &nbsp; ` Samsung ` &nbsp; &nbsp; ` Sony `
- The call of `irrecv.decode(&results)` uses the old MSB first decoders like in 2.x and sets the 32 bit codes in `results.value`!<br/>
- The old functions `sendNEC()` and `sendJVC()` are renamed to `sendNECMSB()` and `sendJVCMSB()`.
- The call of `irrecv.decode(&results)` uses the old MSB first decoders like in 2.x and sets the 32 bit codes in `results.value`.
- The old functions `sendNEC()` and `sendJVC()` are renamed to `sendNECMSB()` and `sendJVCMSB()`.<br/>
Use them to send your **old MSB-first 32 bit IR data codes**.
- No decoding by a (constant) 8/16 bit address and an 8 bit command.
@ -198,24 +197,24 @@ For the new decoders for **NEC, Panasonic, Sony, Samsung and JVC**, the result `
<br/>
To convert one into the other, you must reverse the byte/nibble positions and then reverse all bit positions of each byte/nibble or write it as one binary string and reverse/mirror it.<br/><br/>
Example:
- 0xCB 34 01 02<br/>
0x20 10 43 BC after nibble reverse<br/>
0x40 80 2C D3 after bit reverse of each nibble<br/><br/>
Nibble reverse map:
`0xCB 34 01 02`<br/>
`0x20 10 43 BC` after nibble reverse<br/>
`0x40 80 2C D3` after bit reverse of each nibble<br/><br/>
### Nibble reverse map:
```
0->0 1->8 2->4 3->C
4->2 5->A 6->6 7->E
8->1 9->9 A->5 B->D
C->3 D->B E->7 F->F
```
- 0xCB340102 is binary 1100 1011 0011 0100 0000 0001 0000 0010.<br/>
0x40802CD3 is binary 0100 0000 1000 0000 0010 1100 1101 0011.<br/>
If you read the first binary sequence backwards (right to left), you get the second sequence.
`0xCB340102` is binary `1100 1011 0011 0100 0000 0001 0000 0010`.<br/>
`0x40802CD3` is binary `0100 0000 1000 0000 0010 1100 1101 0011`.<br/>
If you **read the first binary sequence backwards** (right to left), you get the second sequence.
<br/>
# Errors with using the 3.x versions for old tutorials
If you suffer from errors with old tutorial code which includes `IRremote.h` instead of `IRremote.hpp`, just try to rollback to [version 2.4.0](https://github.com/Arduino-IRremote/Arduino-IRremote/releases/tag/v2.4.0).<br/>
If you suffer from errors with old tutorial code including `IRremote.h` instead of `IRremote.hpp`, just try to rollback to [Version 2.4.0](https://github.com/Arduino-IRremote/Arduino-IRremote/releases/tag/v2.4.0).<br/>
Most likely your code will run and you will not miss the new features...
<br/>
@ -230,7 +229,7 @@ IDE's like [Sloeber](https://github.com/ArminJo/ServoEasing#modifying-compile-op
They add these options at each compiler call e.g. `-DTRACE`.
But Arduino lacks this feature.
So the **workaround** is not to compile all sources separately, but to concatenate them to one huge source file by including them in your source.
So the **workaround** is not to compile all sources separately, but to concatenate them to one huge source file by including them in your source.<br/>
This is done by e.g. `#include "IRremote.hpp"`.
But why not `#include "IRremote.cpp"`?<br/>
@ -241,7 +240,7 @@ Every other extension e.g. *cinclude* would do, but *hpp* seems to be common sen
# Using the new *.hpp files
In order to support [compile options](#compile-options--macros-for-this-library) more easily,
the line `#include <IRremote.h>` must be changed to `#include <IRremote.hpp>` in your main program (aka *.ino file with setup() and loop()).
you must use the statement `#include <IRremote.hpp>` instead of `#include <IRremote.h>` in your main program (aka *.ino file with setup() and loop()).
In **all other files** you must use the following, to **prevent `multiple definitions` linker errors**:
@ -250,8 +249,7 @@ In **all other files** you must use the following, to **prevent `multiple defini
#include <IRremote.hpp>
```
Ensure that all macros in your main program are defined before any `#include <IRremote.hpp>`.
**Ensure that all macros in your main program are defined before any** `#include <IRremote.hpp>`. <br/>
The following macros will definitely be overridden with default values otherwise:
- `RAW_BUFFER_LENGTH`
- `IR_SEND_PIN`
@ -260,7 +258,7 @@ The following macros will definitely be overridden with default values otherwise
<br/>
# Receiving IR codes
Check for **available data** with<br/>
Check for **received data** with:<br/>
`if (IrReceiver.decode()) {}`<br/>
This also decodes the received data.
@ -269,32 +267,40 @@ After successful decoding, the IR data is contained in the IRData structure, ava
```c++
struct IRData {
decode_type_t protocol; // UNKNOWN, NEC, SONY, RC5, ...
uint16_t address; // Decoded address
uint16_t command; // Decoded command
uint16_t extra; // Used by MagiQuest and for Kaseikyo unknown vendor ID. Ticks used for decoding Distance protocol.
uint16_t numberOfBits; // Number of bits received for data (address + command + parity) - to determine protocol length if different length are possible.
uint8_t flags; // See IRDATA_FLAGS_* definitions above
uint32_t decodedRawData; // Up to 32 bit decoded raw data, used for sendRaw functions.
decode_type_t protocol; // UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
uint16_t address; // Decoded address
uint16_t command; // Decoded command
uint16_t extra; // Used for Kaseikyo unknown vendor ID. Ticks used for decoding Distance protocol.
uint16_t numberOfBits; // Number of bits received for data (address + command + parity) - to determine protocol length if different length are possible.
uint8_t flags; // See IRDATA_FLAGS_* definitions
uint32_t decodedRawData; // Up to 32 bit decoded raw data, used for sendRaw functions.
uint32_t decodedRawDataArray[RAW_DATA_ARRAY_SIZE]; // 32 bit decoded raw data, to be used for send function.
irparams_struct *rawDataPtr; // Pointer of the raw timing data to be decoded. Mainly the data buffer filled by receiving ISR.
};
```
To access e.g. the **RAW data**, use <br/>
`uint32_t myRawdata= IrReceiver.decodedIRData.decodedRawData;`
The content of the `IrReceiver.decodedIRData.flags` is described [here](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremoteInt.h#L128-L140).
#### To access the **RAW data**, use:
```c++
uint32_t myRawdata= IrReceiver.decodedIRData.decodedRawData;
```
The definitions for the `IrReceiver.decodedIRData.flags` are described [here](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremoteInt.h#L128-L140).
#### Print all fields:
`IrReceiver.printIRResultShort(&Serial);`
```c++
IrReceiver.printIRResultShort(&Serial);
```
#### Print the raw timing data received:
`IrReceiver.printIRResultRawFormatted(&Serial, true);`
```c++
IrReceiver.printIRResultRawFormatted(&Serial, true);`
```
<br/>
# Minimal NEC receiver
For applications only requiring NEC protocol, there is a receiver which has very **small code size of 500 bytes and does NOT require any timer**.
For applications only requiring NEC protocol, there is a special receiver included,<br/>
which has very **small code size of 500 bytes and does NOT require any timer**.
Check out the [MinimalReceiver](https://github.com/Arduino-IRremote/Arduino-IRremote#minimalreceiver) and [IRDispatcherDemo](https://github.com/Arduino-IRremote/Arduino-IRremote#irdispatcherdemo) examples.
@ -302,8 +308,8 @@ Check out the [MinimalReceiver](https://github.com/Arduino-IRremote/Arduino-IRre
# Sending IR codes
Please do not use the old send*Raw() functions for sending like e.g. `IrSender.sendNECRaw(0xE61957A8,2)`,
even if this functions are used in a lot of **(old)** tutorials. They are only kept for backward compatibility and unsupported and error prone.<br/>
**Much better** is to use the **new structured functions** with address and command parameters like e.g. `IrSender.sendNEC(0xA8, 0x19, 2)`.
even if this functions are used in a lot of **(old)** tutorials. They are only kept for backward compatibility and unsupported as well as error prone.<br/>
**It is recommended** to use the **new structured functions** with address and command parameters like e.g. `IrSender.sendNEC(0xA8, 0x19, 2)`.
Especially if you are able to receive these remote codes and get the address and command values.
You will discover that **the address is a constant** and the commands sometimes are sensibly grouped.
@ -315,25 +321,32 @@ http://www.harctoolbox.org/IR-resources.html
# FAQ and hints
## Problems with Neopixels, FastLed etc.
IR will not work right when you use **Neopixels** (aka WS2811/WS2812/WS2812B) or other libraries blocking interrupts for a longer time (> 50 µs).<br/>
IRremote will not work right when you use **Neopixels** (aka WS2811/WS2812/WS2812B) or other libraries blocking interrupts for a longer time (> 50 µs).<br/>
Whether you use the Adafruit Neopixel lib, or FastLED, interrupts get disabled on many lower end CPUs like the basic Arduinos for longer than 50 µs.
In turn, this stops the IR interrupt handler from running when it needs to.<br/>
You can try to wait for the IR receiver to be idle before you send the Neopixel data with `if (IrReceiver.isIdle()) { strip.show();}`. This prevents at least breaking a running IR transmission and -depending of the update rate of the Neopixel- may work quite well.<br/>
In turn, this stops the IR interrupt handler from running when it needs to.
One **workaround** is to wait for the IR receiver to be idle before you send the Neopixel data with `if (IrReceiver.isIdle()) { strip.show();}`.<br/>
This **prevents at least breaking a running IR transmission** and -depending of the update rate of the Neopixel- may work quite well.<br/>
There are some other solutions to this on more powerful processors,
[see this page from Marc MERLIN](http://marc.merlins.org/perso/arduino/post_2017-04-03_Arduino-328P-Uno-Teensy3_1-ESP8266-ESP32-IR-and-Neopixels.html)
## Does not work/compile with another library
**Another library** is only working if you deactivate the line `IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`.
This is often due to resource conflicts with the other library. Please see [below](https://github.com/Arduino-IRremote/Arduino-IRremote#timer-and-pin-usage).
**Another library is only working/compiling** if you deactivate the line `IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);`.<br/>
This is often due to **timer resource conflicts** with the other library. Please see [below](https://github.com/Arduino-IRremote/Arduino-IRremote#timer-and-pin-usage).
## Multiple IR receiver
## Multiple IR receivers
You can use **multiple IR receiver** by just connecting the output pins of several IR receivers together.
The IR receivers use an NPN transistor as output device with just a 30k resistor to VCC.
This is almost "open collector" and allows connecting of several output pins to one Arduino input pin.
## Increase strength of sent output signal
To **increase strength of sent output signal** you can increase the current through the send diode, and/or use 2 diodes in series,
since one IR diode requires only 1.5 volt.
**The best way to increase the IR power for free** is to use 2 or 3 IR diodes in series. One diode requires 1.2 volt at 20 mA or 1.5 volt at 100 mA so you can supply up to 3 diodes with a 5 volt output.<br/>
To power **2 diodes** with 1.2 volt and 20 mA and a 5 volt supply, set the resistor to: (5 V - 2.4 V) -> 2.6 V / 20 mA = **130 &ohm;**.<br/>
For **3 diodes** it requires 1.4 V / 20 mA = **70 &ohm;**.<br/>
The actual current might be lower since of **loss at the AVR pin**. E.g. 0.3 V at 20 mA.<br/>
If you do not require more current than 20 mA, there is no need to use an external transistor (at least for AVR chips).
On my Arduino Nanos, I always use a 100 &ohm; series resistor and one IR LED :grinning:.
## Minimal CPU frequency
For receiving, the **minimal CPU frequency is 4 MHz**, since the 50 µs timer ISR takes around 12 µs on a 16 MHz ATmega.<br/>
@ -341,15 +354,24 @@ For sending, the **default software generated PWM has problems on AVR running wi
# Handling unknown Protocols
## Disclaimer
**This library was never designed to handle long codes like the ones used by air conditioners.**<br/>
For air conditioners [see this fork](https://github.com/crankyoldgit/IRremoteESP8266) which supports an impressive set of protocols and a lot of air conditioners and the blog entry:
["Recording long Infrared Remote control signals with Arduino"](https://www.analysir.com/blog/2014/03/19/air-conditioners-problems-recording-long-infrared-remote-control-signals-arduino).<br/>
The main reason is, that it was designed to fit inside MCUs with relatively low levels of resources
and was intended to work as a library together with other applications which also require some resources of the MCU to operate.
**This library was designed to fit inside MCUs with relatively low levels of resources and was intended to work as a library together with other applications which also require some resources of the MCU to operate.**
For **air conditioners** [see this fork](https://github.com/crankyoldgit/IRremoteESP8266), which supports an impressive set of protocols and a lot of air conditioners.
For **long signals** see the blog entry: ["Recording long Infrared Remote control signals with Arduino"](https://www.analysir.com/blog/2014/03/19/air-conditioners-problems-recording-long-infrared-remote-control-signals-arduino).
## Protocol=PULSE_DISTANCE
If you get something like this: `PULSE_DISTANCE: HeaderMarkMicros=8900 HeaderSpaceMicros=4450 MarkMicros=550 OneSpaceMicros=1700 ZeroSpaceMicros=600 NumberOfBits=56 0x43D8613C 0x3BC3BC`,
then you have a code consisting of **56 bits**, which is probably from an air conditioner remote.
If you get something like this:
```
PULSE_DISTANCE: HeaderMarkMicros=8900 HeaderSpaceMicros=4450 MarkMicros=550 OneSpaceMicros=1700 ZeroSpaceMicros=600 NumberOfBits=56 0x43D8613C 0x3BC3BC
```
then you have a code consisting of **56 bits**, which is probably from an air conditioner remote.<br/>
You can send it with sendPulseDistance().
```c++
uint32_t tRawData[] = { 0xB02002, 0xA010 };
IrSender.sendPulseDistance(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, false, 0, 0);
```
You can send it with calling sendPulseDistanceWidthData() twice, once for the first 32 bit and next for the remaining 24 bits.<br/>
**The PulseDistance or PulseWidth decoders just decode a timing steam to a bit stream**.
They can not put any semantics like address, command or checksum on this bitstream, since it is no known protocol.
@ -384,50 +406,50 @@ If you do not know which protocol your IR transmitter uses, you have several cho
# Examples for this library
In order to fit the examples to the 8K flash of ATtiny85 and ATtiny88, the [Arduino library ATtinySerialOut](https://github.com/ArminJo/ATtinySerialOut) is required for this CPU's.
### SimpleReceiver + SimpleSender
#### SimpleReceiver + SimpleSender
This examples are a good starting point.
A simple example can be tested online with [WOKWI](https://wokwi.com/projects/338611596994544210).
### ReceiveDemo
#### ReceiveDemo
Receives all protocols and **generates a beep with the Arduino tone() function** on each packet received. By connecting pin 5 to ground, you can see the raw values for each packet. **Example how to use IRremote and tone() together**.
### AllProtocols
#### AllProtocols
Like ReceiveDemo but with 1604 LCD output and without tone().
### ReceiveDump
#### ReceiveDump
Receives all protocols and dumps the received signal in different flavors. Since the printing takes so much time, repeat signals may be skipped or interpreted as UNKNOWN.
### SendDemo
#### SendDemo
Sends all available protocols at least once.
### SendAndReceive + UnitTest
#### SendAndReceive + UnitTest
ReceiveDemo + SendDemo in one program. **Receiving while sending**.
### ReceiveAndSend
#### ReceiveAndSend
Record and **play back last received IR signal** at button press.
### ReceiveOneAndSendMultiple
Serves as a IR **remote macro expander**. Receives Samsung32 protocol and on receiving a specified input frame, it sends multiple Samsung32 frames with appropriate delays in between.
This serves as a **Netflix-key emulation** for my old Samsung H5273 TV.
### SmallReceiver
#### SmallReceiver
If **code size** matters, look at these example.<br/>
### MinimalReceiver
#### MinimalReceiver
The MinimalReceiver example uses the **TinyReceiver** library which can **only receive NEC codes, but does not require any timer**.<br/>
MinimalReceiver can be tested online with [WOKWI](https://wokwi.com/arduino/projects/299034264157028877).
MinimalReceiver can be tested online with [WOKWI](https://wokwi.com/arduino/projects/339264565653013075).
Click on the receiver while simulation is running to specify individual IR codes.
### IRDispatcherDemo
#### IRDispatcherDemo
Framework for **calling different functions of your program** for different IR codes.
### IRrelay
#### IRrelay
**Control a relay** (connected to an output pin) with your remote.
### IRremoteExtensionTest
#### IRremoteExtensionTest
Example for a user defined class, which itself uses the IRrecv class from IRremote.
### SendLGAirConditionerDemo
#### SendLGAirConditionerDemo
Example for sending LG air conditioner IR codes controlled by Serial input.<br/>
By just using the function `bool Aircondition_LG::sendCommandAndParameter(char aCommand, int aParameter)` you can control the air conditioner by any other command source.<br/>
The file *acLG.h* contains the command documentation of the LG air conditioner IR protocol. Based on reverse engineering of the LG AKB73315611 remote.
@ -435,7 +457,7 @@ The file *acLG.h* contains the command documentation of the LG air conditioner I
IReceiverTimingAnalysis can be tested online with [WOKWI](https://wokwi.com/projects/299033930562011656)
Click on the receiver while simulation is running to specify individual IR codes.
### ReceiverTimingAnalysis
#### ReceiverTimingAnalysis
This example analyzes the signal delivered by your IR receiver module.
Values can be used to determine the stability of the received signal as well as a hint for determining the protocol.<br/>
It also computes the `MARK_EXCESS_MICROS` value, which is the extension of the mark (pulse) duration introduced by the IR receiver module.<br/>
@ -443,7 +465,7 @@ It can be tested online with [WOKWI](https://wokwi.com/arduino/projects/29903393
Click on the receiver while simulation is running to specify individual NEC IR codes.
# WOKWI online examples
- [Simple receiver] (https://wokwi.com/projects/338611596994544210).
- [Simple receiver](https://wokwi.com/projects/338611596994544210).
- [MinimalReceiver](https://wokwi.com/arduino/projects/339264565653013075)
- [ReceiverTimingAnalysis](https://wokwi.com/projects/299033930562011656)
- [Receiver with LCD output and switch statement](https://wokwi.com/projects/298934082074575369)
@ -586,8 +608,10 @@ Since the Arduino `micros()` function has a resolution of 4
## Incompatibilities to other libraries and Arduino commands like tone() and analogWrite()
If you use a library which requires the same timer as IRremote, you have a problem, since **the timer resource cannot be shared simultaneously** by both libraries.
The best approach is to change the timer used for IRremote, which can be accomplished by modifying the timer selection in [private/IRTimer.hpp](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/private/IRTimer.hpp).<br/>
For the AVR platform the code to modify looks like:
### Change timer
The best approach is to change the timer used for IRremote, which can be accomplished by specifying the timer before `#include <IRremote.hpp>`.<br/>
The timer specifications available for your board can be found in [private/IRTimer.hpp](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/private/IRTimer.hpp).<br/>
```c++
// Arduino Mega
@ -600,19 +624,23 @@ For the AVR platform the code to modify looks like:
//#define IR_USE_AVR_TIMER5 // send pin = pin 46
# endif
```
You **just have to modify the comments** of the current and desired timer line.
But be aware that the new timer in turn might be incompatible with other libraries or commands.<br/>
The modification must be renewed for each new IRremote library version, or you use an IDE like [Sloeber](https://github.com/Arduino-IRremote/Arduino-IRremote#modifying-compile-options--macros-with-sloeber-ide).<br/>
For other platforms you must modify the appropriate section guarded by e.g. `#elif defined(ESP32)`.
Here you see the Arduino Mega board and the available specifications are `IR_USE_AVR_TIMER[1,2,3,4,5]`.<br/>
You **just have to include a line** e.g. `#define IR_USE_AVR_TIMER3` before `#include <IRremote.hpp>` to enable timer 3.
But be aware that the new timer in turn might be incompatible with other libraries or commands.<br/>
For other boards/platforms you must look for the appropriate section guarded by e.g. `#elif defined(ESP32)`.
### Stop and start timer
Another approach can be to share the timer **sequentially** if their functionality is used only for a short period of time like for the **Arduino tone() command**.
An example can be seen [here](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/21b5747a58e9d47c9e3f1beb056d58c875a92b47/examples/ReceiveDemo/ReceiveDemo.ino#L159-L169), where the timer settings for IR receive are restored after the tone has stopped.
For this we must call `IrReceiver.start()` or better `IrReceiver.start(microsecondsOfToneDuration)`.<br/>
This only works since each call to` tone()` completely initializes the timer 2 used by the `tone()` command.
## Hardware-PWM signal generation for sending
If you define `SEND_PWM_BY_TIMER`, the send PWM signal is forced to be generated by a hardware timer. The same timer as for the receiver is used.
If you define `SEND_PWM_BY_TIMER`, the send PWM signal is forced to be generated by a hardware timer on most platforms.<br/>
The same timer as for the receiver is used.<br/>
Since each hardware timer has its dedicated output pins, you must change timer to change PWM output.<br/>
**Exeptions** are currently [ESP32, ARDUINO_ARCH_RP2040, PARTICLE and ARDUINO_ARCH_MBED](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/39bdf8d7bf5b90dc221f8ae9fb3efed9f0a8a1db/examples/SimpleSender/PinDefinitionsAndMore.h#L273), where **PWM generation does not require a timer**.
## Why do we use 30% duty cycle for sending
We do it according to the statement in the [Vishay datasheet](https://www.vishay.com/docs/80069/circuit.pdf):
@ -621,12 +649,6 @@ We do it according to the statement in the [Vishay datasheet](https://www.vishay
The reason is, that it is not the pure energy of the fundamental which is responsible for the receiver to detect a signal.
Due to automatic gain control and other bias effects, high intensity of the 38 kHz pulse counts more than medium intensity (e.g. 50% duty cycle) at the same total energy.
## Increase sending power
**The best way to increase the IR power for free** is to use 2 or 3 IR diodes in series. One diode requires 1.1 to 1.5 volt so you can supply 3 diodes with a 5 volt output.<br/>
To keep the current for 2 diodes with 1.3 volt and 25 mA and a 5 volt supply, you must reduce the resistor by factor: (5V - 1.3V) / (5V - 2.6V) = 1.5 e.g. from 150 ohm to 100 ohm.<br/>
For 3 diodes it requires factor 2.5 e.g. from 150 ohm to 60 ohm.<br/>
Or compute it directly with the **U = R * I formula**. Here U is (5V - <number_of_diodes> * 1.3V) at moderate current, at higher currents you must choose more than 1.3 volt. If you want to be exact, you must check the datasheet of your diode for the appropriate **forward voltage fo a given current**.
<br/>
# How we decode signals
@ -635,7 +657,8 @@ And believe me, if you send a 525
Therefore **we decode by default with a +/- 25% margin** using the formulas [here](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/IRremoteInt.h#L376-L399).<br/>
E.g. for the NEC protocol with its 560 µs unit length, we have TICKS_LOW = 8.358 and TICKS_HIGH = 15.0. This means, we accept any value between 8 ticks / 400 µs and 15 ticks / 750 µs (inclusive) as a mark or as a zero space. For a one space we have TICKS_LOW = 25.07 and TICKS_HIGH = 45.0.<br/>
And since the receivers generated marks are longer or shorter than the spaces, we have introduced the [`MARK_EXCESS_MICROS` value]/https://github.com/Arduino-IRremote/Arduino-IRremote#protocolunknown)
to compensate for this receiver (and signal strength as well as ambient light dependent :disappointed: ) specific deviation. Welcome to the basics of **real world signal processing**.
to compensate for this receiver (and signal strength as well as ambient light dependent :disappointed: ) specific deviation.<br/>
Welcome to the world of **real world signal processing**.
<br/>

View File

@ -2,8 +2,13 @@
The latest version may not be released!
See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master
## 3.8.1
## 3.9.0
- Improved documentation with the help of [ElectronicsArchiver}(https://github.com/ElectronicsArchiver).
- Added NEC2 protocol.
- Improved Magiquest protocol.
- Renamed sendSamsungRepeat() to sendSamsungLGRepeat().
- Added function sendPulseDistanceWidth().
- Improved repeat detection for some protocols.
## 3.8.0
- Changed Samsung repeat handling. Old handling is available as SamsungLG.

View File

@ -58,7 +58,7 @@
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#if defined(APPLICATION_PIN)
@ -261,10 +261,7 @@ void printIRResultOnLCD() {
* Show or clear repetition flag
*/
myLCD.setCursor(15, 1);
if (IrReceiver.decodedIRData.flags & (IRDATA_FLAGS_IS_SPECIAL_REPEAT)) {
myLCD.print('S');
return; // Since it is a repetition, printed data has not changed
} else if (IrReceiver.decodedIRData.flags & (IRDATA_FLAGS_IS_REPEAT)) {
if (IrReceiver.decodedIRData.flags & (IRDATA_FLAGS_IS_REPEAT)) {
myLCD.print('R');
return; // Since it is a repetition, printed data has not changed
} else {

View File

@ -38,7 +38,7 @@
#define EXCLUDE_EXOTIC_PROTOCOLS
#endif
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#if defined(APPLICATION_PIN)

View File

@ -32,7 +32,7 @@
#define USE_TINY_IR_RECEIVER // Recommended, but only for NEC protocol!!! If disabled and IRMP_INPUT_PIN is defined, the IRMP library is used for decoding
//#define TINY_RECEIVER_USE_ARDUINO_ATTACH_INTERRUPT // costs 112 bytes program memory + 4 bytes RAM
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
// Some kind of auto detect library if USE_TINY_IR_RECEIVER is deactivated
#if !defined(USE_TINY_IR_RECEIVER)
# if defined(IR_RECEIVE_PIN)

View File

@ -12,7 +12,7 @@
#define RAW_BUFFER_LENGTH 750 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#endif
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#include "IRremoteExtensionClass.h"

View File

@ -82,7 +82,7 @@
#define NO_DECODER
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include "IRremote.hpp"
#include <limits.h>

View File

@ -75,7 +75,7 @@
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
int SEND_BUTTON_PIN = APPLICATION_PIN;

View File

@ -45,7 +45,7 @@
//
#if RAMEND <= 0x4FF || (defined(RAMSIZE) && RAMSIZE < 0x4FF)
#define RAW_BUFFER_LENGTH 180 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#define RAW_BUFFER_LENGTH 150 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 650 bytes program memory if all other protocols are active
#elif RAMEND <= 0x8FF || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
@ -65,7 +65,7 @@
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#if defined(APPLICATION_PIN)

View File

@ -51,7 +51,7 @@
//#define RECORD_GAP_MICROS 12000 // Activate it for some LG air conditioner protocols
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
//+=============================================================================

View File

@ -48,7 +48,7 @@
#define DECODE_SAMSUNG
#define ADDRESS_OF_SAMSUNG_REMOTE 0x0707 // The value you see as address in printIRResultShort()
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
void sendSamsungSmartHubMacro(bool aDoSelect);

View File

@ -43,7 +43,7 @@
//#define NO_LED_FEEDBACK_CODE // saves 500 bytes program memory
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#define DELAY_AFTER_SEND 2000

View File

@ -33,7 +33,7 @@
*/
#include <Arduino.h>
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
//......................................................................

View File

@ -38,7 +38,7 @@
//#define NO_LED_FEEDBACK_CODE // Saves 566 bytes program memory
//#define USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN // Use or simulate open drain output mode at send pin. Attention, active state of open drain is LOW, so connect the send LED between positive supply and send pin!
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#define DELAY_AFTER_SEND 2000
@ -170,20 +170,20 @@ void loop() {
delay(DELAY_AFTER_SEND);
/*
* Send 2 Panasonic codes as generic Pulse Distance data, once with LSB and once with MSB first
* Send 2 Panasonic 48 bit codes as generic Pulse Distance data, once with LSB and once with MSB first
*/
Serial.println(F("Send Panasonic 0xB, 0x10 as generic PulseDistance"));
Serial.println(F("Send Panasonic 0xB, 0x10 as generic 48 bit PulseDistance"));
Serial.println(F(" LSB first"));
Serial.flush();
uint32_t tRawData[] = { 0xB02002, 0xA010 };
IrSender.sendPulseDistance(3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, false, 0, 0);
uint32_t tRawData[] = { 0xB02002, 0xA010 }; // LSB of tRawData[0] is sent first
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, false, 0, 0);
delay(DELAY_AFTER_SEND);
// the same with MSB first
// The same with MSB first. Use bit reversed raw data of LSB first part
Serial.println(F(" MSB first"));
tRawData[0] = 0x40040D00;
tRawData[0] = 0x40040D00; // MSB of tRawData[0] is sent first
tRawData[1] = 0x805;
IrSender.sendPulseDistance(3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, true, 0, 0);
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, true, 0, 0);
delay(DELAY_AFTER_SEND);
}

View File

@ -45,7 +45,7 @@
#define INFO // Deactivate this to save program memory and suppress info output from the LG-AC driver.
//#define DEBUG // Activate this for more output from the LG-AC driver.
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)

View File

@ -32,7 +32,7 @@
*/
#include <Arduino.h>
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#define NUMBER_OF_REPEATS 3U

View File

@ -42,7 +42,7 @@
//#define NO_LED_FEEDBACK_CODE // Saves 566 bytes program memory
//#define USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN // Use or simulate open drain output mode at send pin. Attention, active state of open drain is LOW, so connect the send LED between positive supply and send pin!
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
void setup() {

View File

@ -57,7 +57,7 @@
#include <Arduino.h>
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
void setup() {

View File

@ -16,7 +16,7 @@
//#define SEND_PWM_BY_TIMER // Disable carrier PWM generation in software and use (restricted) hardware PWM.
//#define USE_NO_SEND_PWM // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
void setup() {

View File

@ -36,9 +36,9 @@
#if RAMEND <= 0x4FF || (defined(RAMSIZE) && RAMSIZE < 0x4FF)
//#define RAW_BUFFER_LENGTH 180 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#elif RAMEND <= 0x8FF || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
//#define RAW_BUFFER_LENGTH 600 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#define RAW_BUFFER_LENGTH 140 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#else
//#define RAW_BUFFER_LENGTH 750 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#define RAW_BUFFER_LENGTH 200 // 750 (600 if we have only 2k RAM) is the value for air condition remotes. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
#endif
//#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
@ -78,7 +78,7 @@
#define DECODE_WHYNTER
#endif
#include "PinDefinitionsAndMore.h" //Define macros for input and output pin etc.
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
#if defined(APPLICATION_PIN)
@ -159,29 +159,32 @@ void checkReceive(uint16_t aSentAddress, uint16_t aSentCommand) {
Serial.println(F("Overflow detected"));
Serial.println(F("Try to increase the \"RAW_BUFFER_LENGTH\" value of " STR(RAW_BUFFER_LENGTH) " in " __FILE__));
// see also https://github.com/Arduino-IRremote/Arduino-IRremote#compile-options--macros-for-this-library
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
} else if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
// We have an unknown protocol, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true);
#endif
} else {
/*
* Check address
*/
if (IrReceiver.decodedIRData.address != aSentAddress) {
Serial.print(F("ERROR: Received address=0x"));
Serial.print(IrReceiver.decodedIRData.address, HEX);
Serial.print(F(" != sent address=0x"));
Serial.println(aSentAddress, HEX);
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
// We have an unknown protocol, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true);
}
/*
* Check command
*/
if (IrReceiver.decodedIRData.command != aSentCommand) {
Serial.print(F("ERROR: Received command=0x"));
Serial.print(IrReceiver.decodedIRData.command, HEX);
Serial.print(F(" != sent command=0x"));
Serial.println(aSentCommand, HEX);
#endif
if (IrReceiver.decodedIRData.protocol != UNKNOWN && IrReceiver.decodedIRData.protocol != PULSE_DISTANCE) {
/*
* Check address
*/
if (IrReceiver.decodedIRData.address != aSentAddress) {
Serial.print(F("ERROR: Received address=0x"));
Serial.print(IrReceiver.decodedIRData.address, HEX);
Serial.print(F(" != sent address=0x"));
Serial.println(aSentAddress, HEX);
}
/*
* Check command
*/
if (IrReceiver.decodedIRData.command != aSentCommand) {
Serial.print(F("ERROR: Received command=0x"));
Serial.print(IrReceiver.decodedIRData.command, HEX);
Serial.print(F(" != sent command=0x"));
Serial.println(aSentCommand, HEX);
}
}
}
@ -229,6 +232,7 @@ void loop() {
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604. Code does not fit in program memory of ATtiny85 etc.
if (sAddress == 0xFFF1) {
# if FLASHEND >= 0x7FFF // For 32k flash or more, like UNO. Code does not fit in program memory of ATtiny1604 etc.
/*
* Send constant values only once in this demo
*/
@ -243,7 +247,6 @@ void loop() {
checkReceive(0x80, 0x45);
delay(DELAY_AFTER_SEND);
# if FLASHEND >= 0x7FFF // For 32k flash or more, like UNO. Code does not fit in program memory of ATtiny1604 etc.
Serial.println(F("Send NEC 16 bit address=0xFB04 and command 0x08 with exact timing (16 bit array format)"));
Serial.flush();
@ -280,23 +283,31 @@ void loop() {
delay(DELAY_AFTER_SEND);
/*
* Send 2 Panasonic codes as generic Pulse Distance data, once with LSB and once with MSB first
* Send 2 Panasonic 48 bit codes as generic Pulse Distance data, once with LSB and once with MSB first
*/
Serial.println(F("Send Panasonic 0xB, 0x10 as generic PulseDistance"));
Serial.println(F("Send Panasonic 0xB, 0x10 as generic 48 bit PulseDistance"));
Serial.println(F(" LSB first"));
Serial.flush();
uint32_t tRawData[] = { 0xB02002, 0xA010 };
IrSender.sendPulseDistance(3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, false, 0, 0);
uint32_t tRawData[] = { 0xB02002, 0xA010 }; // LSB of tRawData[0] is sent first
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, PROTOCOL_IS_LSB_FIRST, 0, 0);
checkReceive(0x0B, 0x10);
delay(DELAY_AFTER_SEND);
// the same with MSB first
// The same with MSB first. Use bit reversed raw data of LSB first part
Serial.println(F(" MSB first"));
tRawData[0] = 0x40040D00;
tRawData[0] = 0x40040D00; // MSB of tRawData[0] is sent first
tRawData[1] = 0x805;
IrSender.sendPulseDistance(3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, true, 0, 0);
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, PROTOCOL_IS_MSB_FIRST, 0, 0);
checkReceive(0x0B, 0x10);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send generic 56 bit PulseDistance 0x43D8613C and 0x3BC3BC LSB first"));
Serial.flush();
tRawData[0] = 0x43D8613C;
tRawData[1] = 0x3BC3BC;
IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 56, PROTOCOL_IS_LSB_FIRST, 0, 0);
checkReceive(0x0, 0x0); // No real check, only printing of received result
delay(DELAY_AFTER_SEND);
}
#endif
@ -414,9 +425,12 @@ void loop() {
delay(DELAY_AFTER_SEND);
#endif
#if defined(DECODE_LG) || defined(DECODE_MAGIQUEST)
IRSendData.command = sCommand << 8 | sCommand; // LG and MAGIQUEST support 16 bit command
#endif
#if defined(DECODE_LG)
IRSendData.protocol = LG;
IRSendData.command = sCommand << 8 | sCommand; // LG supports 16 bit command
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
Serial.flush();
@ -425,6 +439,16 @@ void loop() {
delay(DELAY_AFTER_SEND);
#endif
#if defined(DECODE_MAGIQUEST)
IRSendData.protocol = MAGIQUEST;
Serial.print(F("Send "));
Serial.println(getProtocolString(IRSendData.protocol));
Serial.flush();
IrSender.write(&IRSendData);
checkReceive(IRSendData.address, IRSendData.command);
delay(DELAY_AFTER_SEND);
#endif
#if defined(DECODE_BOSEWAVE)
IRSendData.protocol = BOSEWAVE;
Serial.println(F("Send Bosewave with no address and 8 command bits"));
@ -449,8 +473,8 @@ void loop() {
for (unsigned int i = 0; i < 140; ++i) {
// 400 + 400 should be received as 8/8 and sometimes as 9/7 or 7/9 if compensation by MARK_EXCESS_MICROS is optimal.
// 210 + 540 = 750 should be received as 5/10 or 4/11 if compensation by MARK_EXCESS_MICROS is optimal.
IrSender.mark(210); // 8 pulses at 38 kHz
IrSender.space(540); // to fill up to 750 us
IrSender.mark(210); // 8 pulses at 38 kHz
IrSender.space(540); // to fill up to 750 us
}
checkReceive(sAddress, sCommand);
delay(DELAY_AFTER_SEND);

View File

@ -1,6 +1,6 @@
START ../src/UnitTest.cpp from Jul 16 2022
START ../src/UnitTest.cpp from Aug 27 2022
Using library version 3.8.0
Ready to receive IR signals of protocols: NEC, Panasonic/Kaseikyo, Denon/Sharp, Sony, RC5, RC6, LG, JVC, Samsung, Whynter, Lego Power Functions, Bosewave , MagiQuest, Pulse Distance, Hash at pin 2
Ready to receive IR signals of protocols: NEC/NEC2/Onkyo/Apple, Panasonic/Kaseikyo, Denon/Sharp, Sony, RC5, RC6, LG, JVC, Samsung, Whynter, Lego Power Functions, Bosewave , MagiQuest, Pulse Distance, Hash at pin 2
Ready to send IR signals at pin 3
Send signal mark duration for 38kHz is 8 us, pulse correction is 3000 ns, total period is 26 us
5000 us is the (minimum) gap, after which the start of a new IR packet is assumed
@ -12,370 +12,441 @@ Send NEC with 8 bit address
Protocol=NEC Address=0xF1 Command=0x76 Raw-Data=0x89760EF1 32 bits LSB first
Send with: IrSender.sendNEC(0xF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1036650
+8900,-4450
+ 600,-1600 + 600,- 550 + 600,- 500 + 600,- 550
+ 600,-1600 + 600,-1650 + 550,-1700 + 600,-1600
+ 600,- 550 + 600,-1600 + 600,-1650 + 600,-1650
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,- 550 + 600,-1650 + 600,-1600 + 600,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,- 500
+ 600,-1650 + 600,- 550 + 550,- 550 + 600,-1650
+ 550,- 550 + 600,- 500 + 600,- 550 + 600,-1650
+ 550
-1038100
+8850,-4450
+ 600,-1650 + 550,- 550 + 600,- 500 + 600,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,- 550 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,- 550 + 550,-1650 + 600,-1650 + 600,- 500
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 550,-1650 + 650,- 500 + 550,- 550 + 600,-1650
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,-1650
+ 600
Sum: 67600
Send NEC with 16 bit address
Protocol=NEC Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send with: IrSender.sendNEC(0xFFF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1044100
+8950,-4400
+ 600,-1600 + 650,- 500 + 600,- 500 + 650,- 500
-1045100
+8900,-4450
+ 550,-1650 + 600,- 550 + 550,- 550 + 600,- 550
+ 600,-1600 + 600,-1650 + 600,-1650 + 600,-1650
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1600 + 600,-1650 + 600,-1650
+ 600,-1600 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1600 + 600,-1650 + 600,-1650
+ 600,- 500 + 600,-1650 + 600,-1650 + 600,- 500
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 600,-1650 + 550,- 550 + 600,- 500 + 600,-1650
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,-1650
+ 600
+ 600,- 500 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 600,-1650 + 600,-1600 + 650,- 500
+ 550,-1700 + 600,- 500 + 600,- 550 + 550,-1650
+ 600,- 550 + 600,- 500 + 600,- 550 + 600,-1600
+ 650
Sum: 73250
Sending NEC Pronto data with 8 bit address 0x80 and command 0x45 and no repeats
Protocol=NEC Address=0x80 Command=0x45 Raw-Data=0xBA457F80 32 bits LSB first
Send with: IrSender.sendNEC(0x80, 0x45, <numberOfRepeats>);
rawData[68]:
-1053400
+9050,-4450
+ 550,- 550 + 600,- 550 + 600,- 600 + 550,- 600
+ 600,- 500 + 650,- 550 + 600,- 500 + 650,-1600
+ 650,-1600 + 600,-1600 + 600,-1600 + 600,-1600
+ 600,-1600 + 600,-1600 + 650,-1550 + 650,- 500
+ 600,-1600 + 600,- 550 + 600,-1650 + 550,- 550
+ 600,- 550 + 600,- 550 + 600,-1600 + 600,- 550
-1054350
+9050,-4400
+ 600,- 550 + 600,- 550 + 600,- 600 + 550,- 550
+ 650,- 500 + 650,- 550 + 600,- 550 + 600,-1600
+ 600,-1650 + 600,-1600 + 600,-1600 + 550,-1650
+ 600,-1600 + 600,-1600 + 600,-1600 + 600,- 550
+ 600,-1600 + 600,- 550 + 600,-1600 + 600,- 550
+ 600,- 500 + 650,- 500 + 650,-1600 + 600,- 550
+ 650,- 500 + 650,-1550 + 600,- 550 + 600,-1600
+ 650,-1550 + 600,-1600 + 650,- 500 + 650,-1600
+ 600,-1600 + 600,-1650 + 600,- 500 + 650,-1600
+ 600
Sum: 67800
Send NEC 16 bit address=0xFB04 and command 0x08 with exact timing (16 bit array format)
Protocol=NEC Address=0x4 Command=0x8 Raw-Data=0xF708FB04 32 bits LSB first
Send with: IrSender.sendNEC(0x4, 0x8, <numberOfRepeats>);
rawData[68]:
-1049150
+8900,-4450
+ 600,- 550 + 600,- 500 + 600,-1650 + 600,- 550
+ 600,- 500 + 600,- 550 + 600,- 500 + 600,- 500
+ 650,-1600 + 650,-1600 + 650,- 500 + 600,-1650
+ 600,-1650 + 550,-1700 + 600,-1600 + 600,-1650
+ 600,- 550 + 600,- 550 + 600,- 500 + 600,-1650
+ 600,- 550 + 550,- 550 + 600,- 550 + 600,- 500
+ 600,-1650 + 600,-1650 + 550,-1700 + 550,- 550
+ 600,-1650 + 600,-1650 + 600,-1650 + 600,-1650
+ 550
-1050150
+8950,-4400
+ 600,- 550 + 600,- 500 + 600,-1700 + 550,- 550
+ 600,- 500 + 600,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 600,-1650 + 600,- 550 + 550,-1700
+ 550,-1650 + 600,-1650 + 600,-1700 + 550,-1700
+ 550,- 550 + 600,- 500 + 600,- 550 + 600,-1650
+ 550,- 550 + 600,- 550 + 600,- 500 + 600,- 550
+ 600,-1650 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 600,-1650 + 600,-1700 + 550,-1650
+ 600
Sum: 67950
Send NEC / ONKYO with 16 bit address 0x0102 and 16 bit command 0x0304 with NECRaw(0x03040102)
Protocol=Onkyo Address=0x102 Command=0x304 Raw-Data=0x3040102 32 bits LSB first
Send with: IrSender.sendOnkyo(0x102, 0x304, <numberOfRepeats>);
rawData[68]:
-1049250
+8950,-4400
+ 600,- 500 + 600,-1650 + 600,- 500 + 600,- 550
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,- 550
+ 600,-1600 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,- 550 + 600,- 500 + 600,- 550 + 600,- 500
+ 600,- 550 + 600,- 500 + 600,-1650 + 600,- 550
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,- 500
+ 600,-1650 + 600,-1650 + 600,- 500 + 600,- 550
+ 600,- 500 + 600,- 550 + 600,- 500 + 600,- 550
+ 600
-1050250
+8900,-4450
+ 550,- 550 + 600,-1600 + 600,- 550 + 600,- 500
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,- 550 + 550,- 550 + 600,-1650 + 550,- 550
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 600,-1600 + 600,- 550 + 600,- 500
+ 600,- 550 + 600,- 500 + 600,- 550 + 600,- 550
+ 550
Sum: 55400
Send NEC with 16 bit address 0x0102 and command 0x34 with old 32 bit format MSB first
Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 32 bits LSB first
Send with: IrSender.sendNEC(0x102, 0x34, <numberOfRepeats>);
rawData[68]:
-1049650
+8900,-4450
+ 550,- 550 + 600,-1650 + 650,- 500 + 600,- 550
+ 600,- 500 + 600,- 500 + 600,- 550 + 600,- 500
+ 600,-1650 + 600,- 500 + 600,- 550 + 600,- 500
+ 650,- 500 + 600,- 550 + 600,- 500 + 600,- 550
+ 600,- 500 + 600,- 550 + 600,-1600 + 600,- 550
+ 550,-1650 + 600,-1650 + 550,- 550 + 650,- 500
+ 600,-1650 + 600,-1600 + 600,- 550 + 550,-1650
+ 650,- 500 + 550,- 550 + 600,-1650 + 600,-1650
-1050700
+8850,-4450
+ 600,- 550 + 600,-1650 + 550,- 550 + 600,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,- 550 + 600,- 500 + 600,-1650 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,- 500 + 600,- 550
+ 600,-1650 + 550,-1650 + 600,- 550 + 550,-1650
+ 600,- 550 + 600,- 550 + 550,-1650 + 650,-1650
+ 550
Sum: 61000
Send Panasonic 0xB, 0x10 as generic PulseDistance
LSB first
Protocol=Panasonic Address=0xB Command=0x10 Raw-Data=0xA01000B0 48 bits LSB first
Send with: IrSender.sendPanasonic(0xB, 0x10, <numberOfRepeats>);
rawData[100]:
-1047150
+3450,-1700
-1048150
+3450,-1650
+ 450,- 400 + 450,-1250 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 350 + 450,- 450
+ 450,- 400 + 450,- 400 + 450,- 400 + 400,- 450
+ 450,- 350 + 500,-1200 + 450,- 450 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 350 + 450,- 450
+ 450,-1200 + 450,-1300 + 400,- 450 + 450,-1200
+ 450,- 450 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 350
+ 450,- 400 + 450,-1300 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,-1200 + 450,-1300 + 450,- 400 + 450,-1250
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,-1200 + 500,- 400 + 450,- 350 + 450,- 450
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,-1200 + 450,- 450 + 450,-1250
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 350
+ 450,-1250 + 500,- 400 + 450,- 400 + 400,- 400
+ 450,- 400 + 450,- 450 + 450,- 400 + 450,- 350
+ 450,- 400 + 450,-1300 + 450,- 400 + 450,-1250
+ 450
Sum: 53150
MSB first
Protocol=Panasonic Address=0xB Command=0x10 Raw-Data=0xA01000B0 48 bits LSB first
Send with: IrSender.sendPanasonic(0xB, 0x10, <numberOfRepeats>);
rawData[100]:
-1060400
+3450,-1650
+ 500,- 400 + 450,-1200 + 450,- 450 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
-1061400
+3450,-1700
+ 450,- 400 + 450,-1250 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 400,- 450
+ 450,-1250 + 450,-1250 + 450,- 400 + 450,-1250
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,- 400 + 400,- 400 + 500,- 400 + 450,- 400
+ 450,- 400 + 450,- 400 + 400,- 450 + 450,- 400
+ 450,- 400 + 450,-1200 + 450,- 450 + 450,- 400
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,-1250 + 450,- 400 + 450,- 400 + 400,- 450
+ 400,-1250 + 500,-1200 + 500,- 350 + 500,-1250
+ 450,- 400 + 450,- 400 + 450,- 400 + 450,- 400
+ 400,- 450 + 450,-1250 + 400,- 450 + 450,-1250
+ 450,- 400 + 450,- 400 + 400,- 450 + 450,- 450
+ 450,- 350 + 450,- 400 + 500,- 350 + 450,- 400
+ 450,-1250 + 450,- 400 + 450,- 400 + 450,- 400
+ 400,- 450 + 450,- 400 + 450,- 400 + 450,- 400
+ 450,- 400 + 450,-1250 + 450,- 400 + 400,-1300
+ 450
Sum: 53200
Send generic 56 bit PulseDistance 0x43D8613C and 0x3BC3BC LSB first
Protocol=PulseDistance Raw-Data=0x3BC3BC 56 bits LSB first
Send with:
uint32_t tRawData[]={0x43D8613C, 0x3BC3BC};
IrSender.sendPulseDistanceWidthFromArray(38, 8800, 4400, 550, 1700, 550, 600, &tRawData[0], 56, PROTOCOL_IS_LSB_FIRST, <millisofRepeatPeriod>, <numberOfRepeats>);
rawData[116]:
-1067200
+8800,-4400
+ 550,- 600 + 550,- 600 + 550,-1650 + 550,-1700
+ 550,-1700 + 550,-1650 + 550,- 600 + 550,- 600
+ 550,-1700 + 550,- 600 + 550,- 600 + 550,- 600
+ 550,- 600 + 550,-1650 + 550,-1700 + 550,- 600
+ 550,- 600 + 550,- 600 + 550,- 600 + 550,-1650
+ 550,-1700 + 550,- 600 + 550,-1700 + 550,-1650
+ 550,-1700 + 550,-1700 + 550,- 600 + 550,- 600
+ 550,- 600 + 550,- 600 + 550,-1650 + 550,- 600
+ 550,- 600 + 550,- 600 + 550,-1700 + 550,-1650
+ 550,-1700 + 550,-1700 + 550,- 600 + 550,-1650
+ 600,-1650 + 550,-1700 + 550,- 600 + 550,- 650
+ 500,- 600 + 550,- 600 + 550,-1650 + 550,-1700
+ 550,-1700 + 550,-1650 + 600,- 600 + 550,-1650
+ 550,-1700 + 550,-1700 + 550,- 600 + 550,- 600
+ 550
Sum: 108450
Send Onkyo (NEC with 16 bit command)
Protocol=Onkyo Address=0xFFF1 Command=0x7676 Raw-Data=0x7676FFF1 32 bits LSB first
Send with: IrSender.sendOnkyo(0xFFF1, 0x7676, <numberOfRepeats>);
rawData[68]:
-1063500
+8900,-4450
+ 600,-1600 + 600,- 550 + 600,- 500 + 600,- 550
-1064500
+8900,-4500
+ 500,-1650 + 600,- 550 + 600,- 500 + 600,- 550
+ 550,-1700 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1700 + 550,-1650
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,- 550 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 550,- 550 + 600,-1650 + 550,-1650 + 600,- 550
+ 600,-1600 + 600,-1650 + 600,-1650 + 600,- 500
+ 600,-1650 + 600,-1650 + 600,-1600 + 600,-1650
+ 600,- 500 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,- 550
+ 550,- 550 + 600,-1650 + 600,-1600 + 650,- 500
+ 600,-1650 + 600,-1600 + 600,-1650 + 550,- 550
+ 600
Sum: 75400
Send Apple
Protocol=Apple Address=0xF1 Command=0x76 Raw-Data=0xF17687EE 32 bits LSB first
Send with: IrSender.sendApple(0xF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1043500
+8900,-4450
+ 600,- 500 + 600,-1650 + 600,-1600 + 600,-1650
+ 600,- 500 + 650,-1600 + 600,-1650 + 600,-1650
+ 550,-1650 + 600,-1650 + 550,-1700 + 550,- 550
+ 600,- 550 + 550,- 550 + 600,- 500 + 600,-1650
+ 600,- 550 + 550,-1650 + 600,-1650 + 600,- 500
+ 600,-1650 + 600,-1650 + 550,-1700 + 550,- 550
+ 600,-1650 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 600
-1044500
+8900,-4500
+ 500,- 550 + 600,-1650 + 550,-1650 + 600,-1650
+ 550,- 550 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,-1650
+ 600,- 500 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 600,-1600 + 600,-1650 + 600,- 550
+ 550,-1650 + 600,- 550 + 550,- 550 + 550,- 600
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,-1700
+ 550
Sum: 72050
Send Panasonic
Protocol=Panasonic Address=0xFF1 Command=0x76 Raw-Data=0x9976FF10 48 bits LSB first
Send with: IrSender.sendPanasonic(0xFF1, 0x76, <numberOfRepeats>);
rawData[100]:
-1043200
+3450,-1700
+ 450,- 400 + 450,-1300 + 450,- 400 + 450,- 400
-1044250
+3500,-1650
+ 450,- 400 + 450,-1250 + 450,- 450 + 450,- 400
+ 450,- 450 + 400,- 450 + 450,- 400 + 450,- 450
+ 400,- 450 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,- 400 + 450,-1300 + 450,- 400 + 450,- 450
+ 400,- 450 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,-1250 + 450,- 450 + 400,- 450 + 450,- 400
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,- 450 + 400,- 450 + 450,- 400 + 450,- 450
+ 400,-1300 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,-1300 + 400,-1300 + 450,-1250 + 450,-1300
+ 450,-1250 + 450,-1300 + 400,-1300 + 450,-1300
+ 400,- 450 + 450,-1250 + 500,-1250 + 400,- 450
+ 450,-1250 + 450,-1300 + 400,-1300 + 450,- 450
+ 400,-1300 + 450,- 400 + 450,- 450 + 450,-1250
+ 450,-1250 + 450,- 450 + 450,- 400 + 450,-1300
+ 400
+ 450,-1250 + 450,-1300 + 400,-1300 + 400,-1300
+ 450,- 450 + 400,-1300 + 450,-1250 + 450,- 450
+ 450,-1250 + 450,-1300 + 450,-1250 + 450,- 400
+ 450,-1300 + 400,- 450 + 450,- 400 + 450,-1300
+ 400,-1300 + 450,- 400 + 450,- 450 + 400,-1300
+ 450
Sum: 64250
Send Kaseikyo with 0x4711 as Vendor ID
Protocol=Kaseikyo Address=0xFF1 Command=0x76 Extra=0x4711 Raw-Data=0x9A76FF13 48 bits LSB first
Send with: IrSender.sendKaseikyo(0xFF1, 0x76, <numberOfRepeats>, 0x4711);
rawData[100]:
-1063850
-1064850
+3450,-1700
+ 450,-1300 + 400,- 450 + 450,- 400 + 450,- 450
+ 400,-1300 + 450,- 400 + 450,- 450 + 450,- 400
+ 450,-1250 + 450,-1300 + 450,-1300 + 400,- 450
+ 450,- 400 + 450,- 400 + 450,-1300 + 400,- 450
+ 450,-1300 + 450,-1250 + 450,- 400 + 450,- 450
+ 450,-1250 + 450,- 400 + 450,- 450 + 450,- 400
+ 450,-1300 + 400,-1300 + 450,-1250 + 450,-1300
+ 450,-1250 + 450,-1300 + 450,-1250 + 450,-1250
+ 450,- 450 + 400,-1300 + 450,-1300 + 400,- 450
+ 400,-1300 + 450,-1250 + 450,-1300 + 400,- 450
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,-1250
+ 450,-1300 + 450,- 400 + 450,- 400 + 450,-1300
+ 400
+ 400,-1300 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,-1250 + 450,- 450 + 400,- 450 + 450,- 400
+ 450,-1300 + 450,-1250 + 450,-1300 + 450,- 400
+ 450,- 450 + 400,- 450 + 450,-1250 + 450,- 450
+ 400,-1300 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,-1250 + 450,- 450 + 450,- 400 + 450,- 400
+ 450,-1300 + 400,-1300 + 450,-1300 + 450,-1250
+ 450,-1250 + 450,-1300 + 400,-1300 + 450,-1300
+ 450,- 400 + 400,-1300 + 450,-1250 + 500,- 400
+ 400,-1300 + 450,-1300 + 400,-1300 + 450,- 400
+ 450,- 450 + 400,-1300 + 450,- 400 + 450,-1300
+ 450,-1250 + 450,- 400 + 500,- 400 + 450,-1250
+ 450
Sum: 69350
Send Kaseikyo_Denon variant
Protocol=Kaseikyo_Denon Address=0xFF1 Command=0x76 Raw-Data=0x9976FF10 48 bits LSB first
Send with: IrSender.sendKaseikyo_Denon(0xFF1, 0x76, <numberOfRepeats>);
rawData[100]:
-1064450
-1065400
+3450,-1700
+ 400,- 450 + 450,- 400 + 450,-1300 + 400,- 450
+ 450,-1250 + 450,- 450 + 400,-1300 + 450,- 400
+ 450,- 450 + 450,-1250 + 450,- 400 + 450,- 450
+ 400,-1300 + 450,-1300 + 400,- 450 + 450,- 450
+ 400,- 450 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,-1250 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,-1250 + 450,-1300 + 400,-1300 + 450,-1300
+ 400,-1300 + 450,-1300 + 400,-1300 + 450,-1300
+ 400,- 450 + 450,-1250 + 450,-1300 + 400,- 450
+ 450,-1250 + 450,-1300 + 400,-1300 + 450,- 400
+ 450,-1300 + 400,- 450 + 450,- 400 + 450,-1300
+ 450,-1250 + 450,- 400 + 450,- 450 + 400,-1300
+ 450,- 400 + 450,- 450 + 400,-1300 + 450,- 400
+ 450,-1300 + 400,- 450 + 450,-1300 + 450,- 400
+ 450,- 400 + 450,-1250 + 450,- 450 + 450,- 400
+ 450,-1300 + 450,-1250 + 450,- 400 + 450,- 450
+ 450,- 400 + 450,- 450 + 400,- 450 + 450,- 400
+ 450,-1300 + 400,- 450 + 450,- 400 + 450,- 450
+ 400,-1300 + 450,-1250 + 450,-1300 + 450,-1250
+ 450,-1300 + 400,-1300 + 450,-1250 + 450,-1300
+ 400,- 450 + 450,-1250 + 500,-1250 + 400,- 450
+ 450,-1300 + 450,-1250 + 450,-1300 + 400,- 450
+ 450,-1250 + 500,- 400 + 450,- 400 + 450,-1250
+ 500,-1250 + 400,- 450 + 450,- 400 + 450,-1300
+ 450
Sum: 67700
Send Denon
Protocol=Denon Address=0x11 Command=0x76 Raw-Data=0x45D8 15 bits MSB first
Send with: IrSender.sendDenon(0x11, 0x76, <numberOfRepeats>);
rawData[32]:
-1062250
+ 300,-1800 + 250,- 800 + 250,- 750 + 300,- 750
+ 300,-1800 + 250,- 800 + 250,-1800 + 250,-1800
+ 300,-1800 + 250,- 800 + 250,-1800 + 300,-1750
+ 300,- 750 + 300,- 750 + 300,- 750 + 300
-1063250
+ 250,-1800 + 300,- 750 + 250,- 800 + 250,- 800
+ 300,-1750 + 300,- 750 + 250,-1800 + 300,-1800
+ 300,-1750 + 250,- 800 + 300,-1750 + 300,-1800
+ 250,- 800 + 250,- 750 + 300,- 750 + 300
Sum: 23100
Send Denon/Sharp variant
Protocol=Sharp Address=0x11 Command=0x76 Raw-Data=0x45DA 15 bits MSB first
Send with: IrSender.sendSharp(0x11, 0x76, <numberOfRepeats>);
rawData[32]:
-1023950
+ 300,-1800 + 250,- 800 + 250,- 750 + 300,- 750
+ 300,-1800 + 250,- 750 + 300,-1800 + 250,-1800
+ 250,-1850 + 250,- 750 + 300,-1800 + 250,-1800
+ 300,- 750 + 250,-1800 + 300,- 750 + 250
-1024950
+ 350,-1750 + 300,- 750 + 250,- 750 + 350,- 700
+ 300,-1800 + 250,- 750 + 350,-1750 + 300,-1750
+ 300,-1800 + 250,- 750 + 300,-1800 + 300,-1750
+ 300,- 750 + 300,-1800 + 250,- 750 + 300
Sum: 24150
Send Sony/SIRCS with 7 command and 5 address bits
Protocol=Sony Address=0x11 Command=0x76 Raw-Data=0x8F6 12 bits LSB first
Send with: IrSender.sendSony(0x11, 0x76, <numberOfRepeats>);
rawData[26]:
-1026100
+2350,- 600
+ 600,- 600 +1200,- 600 +1200,- 600 + 600,- 550
+1250,- 550 +1250,- 550 +1250,- 600 +1200,- 550
-1027050
+2400,- 650
+ 600,- 550 +1200,- 550 +1250,- 550 + 650,- 550
+1250,- 550 +1250,- 550 +1250,- 550 +1200,- 600
+ 650,- 550 + 650,- 550 + 650,- 550 +1250
Sum: 21000
Send Sony/SIRCS with 7 command and 8 address bits
Protocol=Sony Address=0xF1 Command=0x76 Raw-Data=0x78F6 15 bits LSB first
Send with: IrSender.sendSony(0xF1, 0x76, <numberOfRepeats>);
rawData[32]:
-1022650
+2400,- 600
+ 600,- 600 +1200,- 600 +1200,- 550 + 650,- 550
+1250,- 550 +1250,- 550 +1250,- 600 +1200,- 550
+ 650,- 550 + 650,- 550 + 650,- 550 +1250,- 550
+1250,- 550 +1250,- 550 +1200
-1023750
+2350,- 600
+ 600,- 600 +1200,- 550 +1250,- 550 + 650,- 550
+1250,- 550 +1200,- 600 +1200,- 600 +1200,- 600
+ 650,- 600 + 600,- 600 + 600,- 550 +1250,- 600
+1200,- 550 +1250,- 550 +1250
Sum: 26350
Send Sony/SIRCS with 7 command and 13 address bits
Protocol=Sony Address=0x1FF1 Command=0x76 Raw-Data=0xFF8F6 20 bits LSB first
Send with: IrSender.sendSony(0x1FF1, 0x76, <numberOfRepeats>);
rawData[42]:
-1026150
+2400,- 550
+ 650,- 550 +1250,- 550 +1250,- 550 + 650,- 550
+1200,- 600 +1250,- 550 +1250,- 550 +1250,- 550
-1027100
+2450,- 550
+ 600,- 600 +1200,- 600 +1200,- 550 + 650,- 550
+1250,- 550 +1250,- 550 +1250,- 550 +1250,- 550
+ 650,- 550 + 650,- 550 + 650,- 550 +1250,- 550
+1250,- 550 +1250,- 550 +1200,- 600 +1200,- 600
+1250,- 550 +1250,- 550 +1200,- 600 +1200
+1250,- 550 +1200,- 600 +1250,- 550 +1200,- 600
+1200,- 600 +1200,- 550 +1250,- 550 +1250
Sum: 35350
Send RC5
Protocol=RC5 Address=0x11 Command=0x36 Raw-Data=0x1476 13 bits MSB first
Send with: IrSender.sendRC5(0x11, 0x36, <numberOfRepeats>);
rawData[20]:
-1029100
+ 900,- 900
+1750,-1800 +1750,- 900 + 900,- 850 + 900,-1750
+ 900,- 900 + 900,- 850 +1800,-1750 + 900,- 900
+1750
-1030100
+ 900,- 850
+1800,-1800 +1750,- 900 + 900,- 850 + 900,-1800
+ 850,- 900 + 900,- 850 +1800,-1750 + 900,- 900
+1800
Sum: 23100
Send RC5X with 7.th MSB of command set
Protocol=RC5 Address=0x11 Command=0x76 Toggle=1 Raw-Data=0xC76 13 bits MSB first
Send with: IrSender.sendRC5(0x11, 0x76, <numberOfRepeats>);
rawData[20]:
-1020750
+1750,-1800
+ 900,- 850 +1800,- 900 + 850,- 900 + 900,-1800
+ 850,- 900 + 900,- 850 +1800,-1800 + 850,- 900
+1750
-1021700
+1800,-1750
+ 900,- 900 +1750,- 900 + 900,- 850 + 900,-1800
+ 850,- 900 + 900,- 900 +1750,-1800 + 850,- 900
+1800
Sum: 23100
Send RC6
Protocol=RC6 Address=0xF1 Command=0x76 Raw-Data=0xF176 20 bits MSB first
Send with: IrSender.sendRC6(0xF1, 0x76, <numberOfRepeats>);
rawData[36]:
-1018000
-1018950
+2650,- 900
+ 450,- 900 + 450,- 450 + 400,- 500 + 450,- 850
+1350,- 450 + 450,- 450 + 450,- 450 + 450,- 850
+ 450,- 450 + 450,- 450 + 900,- 900 + 900,- 450
+ 450,- 400 + 450,- 900 + 900,- 450 + 450,- 850
+ 450,- 900 + 450,- 450 + 450,- 450 + 450,- 850
+1350,- 450 + 450,- 450 + 450,- 450 + 450,- 900
+ 450,- 450 + 450,- 400 + 900,- 900 + 900,- 450
+ 450,- 450 + 450,- 900 + 900,- 400 + 450,- 900
+ 450
Sum: 23200
Send Samsung
Protocol=Samsung Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1025950
+4400,-4400
+ 550,-1650 + 550,- 550 + 550,- 550 + 550,- 550
+ 550,-1650 + 550,-1650 + 550,-1650 + 550,-1650
+ 550,-1650 + 550,-1650 + 550,-1650 + 550,-1650
+ 550,-1650 + 550,-1650 + 550,-1650 + 550,-1650
+ 550,- 550 + 550,-1650 + 550,-1600 + 600,- 550
+ 550,-1650 + 550,-1650 + 550,-1650 + 550,- 550
+ 550,-1650 + 550,- 550 + 550,- 600 + 500,-1650
+ 550,- 550 + 550,- 550 + 550,- 550 + 550,-1650
-1027000
+4400,-4450
+ 550,-1650 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 600,-1650
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,- 500 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,-1650 + 600,-1600 + 600,-1650 + 600,- 550
+ 550,-1650 + 600,- 550 + 600,- 500 + 600,-1650
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,-1650
+ 550
Sum: 68650
Send JVC
Protocol=JVC Address=0xF1 Command=0x76 Raw-Data=0x76F1 16 bits LSB first
Send with: IrSender.sendJVC(0xF1, 0x76, <numberOfRepeats>);
rawData[36]:
-1043450
+8400,-4150
-1044550
+8350,-4150
+ 550,-1550 + 550,- 500 + 550,- 500 + 550,- 500
+ 550,-1550 + 500,-1550 + 550,-1550 + 550,-1550
+ 550,- 500 + 550,-1550 + 550,-1550 + 500,- 550
+ 550,-1550 + 500,-1600 + 500,-1600 + 500,- 550
+ 500
+ 550,-1550 + 550,-1550 + 500,-1600 + 550,-1550
+ 500,- 550 + 500,-1600 + 500,-1600 + 500,- 550
+ 500,-1550 + 550,-1550 + 550,-1550 + 550,- 500
+ 550
Sum: 40300
Send LG
Protocol=LG Address=0xF1 Command=0x7676 Raw-Data=0xF17676A 28 bits MSB first
Send with: IrSender.sendLG(0xF1, 0x7676, <numberOfRepeats>);
rawData[60]:
-1024600
-1025600
+8950,-4150
+ 500,-1600 + 500,-1550 + 550,-1550 + 500,-1550
+ 500,-1600 + 500,-1550 + 500,-1600 + 500,-1550
+ 500,- 550 + 500,- 550 + 500,- 550 + 500,-1550
+ 500,- 550 + 500,-1550 + 550,-1550 + 500,-1600
+ 500,- 550 + 500,-1550 + 500,-1550 + 500,- 550
+ 500,- 550 + 500,-1600 + 500,-1550 + 500,-1550
+ 500,- 550 + 500,-1600 + 500,-1550 + 500,- 550
+ 500,-1550 + 550,- 550 + 500,-1550 + 500,- 550
+ 550,- 550 + 500,-1550 + 500,-1550 + 550,-1550
+ 500,- 550 + 500,-1550 + 500,-1600 + 500,- 550
+ 500,- 550 + 500,-1550 + 500,-1550 + 550,-1550
+ 500,- 550 + 500,-1550 + 500,-1550 + 550,- 550
+ 500,-1550 + 500,- 550 + 500,-1550 + 500,- 550
+ 500
Sum: 60350
Send MagiQuest
Protocol=MagiQuest Address=0xFFF1 Command=0x7676 Raw-Data=0xFFF17676 56 bits MSB first
Send with: IrSender.sendMagiQuest(0xFFF1, 0x7676, <numberOfRepeats>);
rawData[112]:
-1039800
+ 350,- 800 + 350,- 800 + 300,- 850 + 300,- 850
+ 250,- 900 + 300,- 850 + 300,- 850 + 300,- 850
+ 350,- 800 + 300,- 850 + 300,- 850 + 300,- 850
+ 300,- 850 + 300,- 850 + 300,- 850 + 300,- 850
+ 300,- 850 + 300,- 850 + 300,- 850 + 250,- 900
+ 250,- 900 + 250,- 900 + 300,- 800 + 350,- 800
+ 600,- 550 + 650,- 500 + 600,- 550 + 600,- 550
+ 600,- 550 + 600,- 550 + 600,- 550 + 600,- 550
+ 550,- 600 + 600,- 550 + 600,- 550 + 600,- 550
+ 300,- 850 + 300,- 850 + 300,- 850 + 600,- 550
+ 300,- 850 + 550,- 600 + 550,- 600 + 600,- 550
+ 250,- 900 + 600,- 550 + 600,- 550 + 300,- 850
+ 300,- 850 + 600,- 550 + 550,- 600 + 600,- 550
+ 250,- 900 + 550,- 550 + 650,- 500 + 350
Sum: 63500
Send Bosewave with no address and 8 command bits
Protocol=BoseWave Address=0x0 Command=0x76 Raw-Data=0x8976 16 bits LSB first
Send with: IrSender.sendBoseWave(0x0, 0x76, <numberOfRepeats>);
rawData[36]:
-1041650
+1000,-1500
+ 500,- 450 + 550,-1450 + 550,-1450 + 500,- 450
+ 550,-1450 + 550,-1450 + 500,-1450 + 550,- 450
+ 550,-1400 + 600,- 400 + 550,- 450 + 550,-1450
+ 500,- 450 + 550,- 450 + 550,- 450 + 550,-1450
+ 500
-1071300
+1000,-1450
+ 550,- 500 + 500,-1450 + 500,-1450 + 550,- 450
+ 500,-1450 + 550,-1450 + 550,-1450 + 550,- 400
+ 550,-1450 + 550,- 450 + 500,- 500 + 550,-1400
+ 550,- 450 + 550,- 450 + 550,- 450 + 550,-1400
+ 550
Sum: 26750
Force buffer overflow by sending 280 marks and spaces
Protocol=UNKNOWN Hash=0x0 0 bits (incl. gap and start) received
@ -390,267 +461,87 @@ Protocol=NEC Address=0xF2 Command=0x87 Raw-Data=0x78870DF2 32 bits LSB first
Send with: IrSender.sendNEC(0xF2, 0x87, <numberOfRepeats>);
rawData[68]:
-3276750
+8950,-4400
+ 600,- 500 + 600,-1650 + 600,- 500 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1600 + 650,-1600
+ 650,-1600 + 600,- 500 + 600,-1650 + 600,-1650
+8900,-4500
+ 500,- 550 + 600,-1650 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 550,- 550 + 600,-1650 + 600,-1650
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,- 550
+ 600,-1600 + 600,-1650 + 600,-1650 + 600,- 500
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,-1650
+ 600,- 550 + 600,- 500 + 600,- 550 + 600,-1650
+ 550,-1650 + 600,-1650 + 550,-1700 + 550,- 550
+ 600,- 550 + 600,- 500 + 600,- 550 + 550,-1650
+ 600,-1650 + 600,-1650 + 600,-1650 + 550,- 550
+ 600
Sum: 67650
Send NEC with 16 bit address
Protocol=NEC Address=0xF2 Command=0x87 Raw-Data=0x78870DF2 32 bits LSB first
Send with: IrSender.sendNEC(0xF2, 0x87, <numberOfRepeats>);
rawData[68]:
-1044100
+8950,-4400
+ 600,- 500 + 600,-1650 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,-1650 + 550,-1700 + 550,-1700
+ 550,-1650 + 600,- 500 + 600,-1650 + 550,-1700
+ 550,- 550 + 600,- 500 + 600,- 550 + 600,- 500
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,-1650
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,-1650
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,- 550
-1045100
+8900,-4500
+ 500,- 550 + 600,-1650 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 600,-1600
+ 600,-1650 + 600,- 500 + 600,-1650 + 600,-1650
+ 600,- 500 + 600,- 550 + 600,- 500 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 600,- 500
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,-1650
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,-1650
+ 600,-1650 + 600,-1650 + 600,-1600 + 600,- 550
+ 600
Sum: 67650
Send Onkyo (NEC with 16 bit command)
Protocol=Onkyo Address=0xF2 Command=0x8787 Raw-Data=0x878700F2 32 bits LSB first
Send with: IrSender.sendOnkyo(0xF2, 0x8787, <numberOfRepeats>);
rawData[68]:
-1044800
-1045800
+8900,-4400
+ 650,- 500 + 600,-1650 + 600,- 500 + 600,- 550
+ 600,-1600 + 600,-1650 + 600,-1650 + 600,-1600
+ 600,- 550 + 600,- 500 + 600,- 550 + 550,- 550
+ 600,- 500 + 650,- 500 + 550,- 700 + 450,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,- 500
+ 550,- 600 + 550,- 550 + 600,- 550 + 550,-1650
+ 600,- 550 + 550,-1650 + 600,- 550 + 600,- 500
+ 550,-1700 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,- 500 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 600,- 500
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 600,- 500 + 600,- 550 + 600,- 500 + 600,-1650
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,-1650
+ 600
Sum: 64300
Send Apple
Protocol=Apple Address=0xF2 Command=0x87 Raw-Data=0xF28787EE 32 bits LSB first
Send with: IrSender.sendApple(0xF2, 0x87, <numberOfRepeats>);
rawData[68]:
-1043300
+8950,-4400
+ 550,- 550 + 600,-1650 + 600,-1600 + 600,-1650
-1044300
+8900,-4400
+ 600,- 550 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,- 500 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1650 + 600,-1600 + 600,- 550
+ 600,- 500 + 550,- 600 + 600,- 500 + 600,-1650
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,- 500
+ 600,- 550 + 600,- 500 + 600,- 550 + 600,-1650
+ 550,- 550 + 600,-1650 + 600,- 500 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 600,-1650
+ 550
+ 600,-1650 + 600,-1650 + 600,-1650 + 550,- 550
+ 600,- 550 + 550,- 550 + 600,- 550 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,-1650
+ 600,- 500 + 600,-1650 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 600,-1600
+ 600
Sum: 70950
Send Panasonic
Protocol=Panasonic Address=0xF2 Command=0x87 Raw-Data=0xA8870F20 48 bits LSB first
Send with: IrSender.sendPanasonic(0xF2, 0x87, <numberOfRepeats>);
rawData[100]:
-1043250
-1044250
+3450,-1700
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,- 450 + 400,- 450 + 450,- 400 + 450,- 400
+ 450,- 450 + 450,- 400 + 450,- 400 + 450,- 450
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,- 400 + 450,-1300 + 450,- 400 + 450,- 400
+ 450,- 450 + 400,- 450 + 450,- 400 + 450,- 450
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,-1300 + 400,-1300 + 450,-1300 + 400,-1300
+ 400,- 450 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,- 450
+ 400,- 450 + 450,- 400 + 450,- 450 + 400,- 450
+ 400,- 450 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,-1300 + 450,-1250 + 450,-1300 + 400,-1300
+ 450,- 400 + 450,- 450 + 400,- 450 + 450,- 400
+ 450,-1300 + 400,-1300 + 450,-1300 + 400,- 450
+ 450,- 400 + 450,- 400 + 450,- 450 + 450,-1250
+ 450,- 450 + 400,- 450 + 450,- 400 + 450,-1300
+ 400,- 450 + 450,-1250 + 450,- 450 + 450,-1250
+ 450
Send Kaseikyo with 0x4711 as Vendor ID
Protocol=Kaseikyo Address=0xF2 Command=0x87 Extra=0x4711 Raw-Data=0xAB870F23 48 bits LSB first
Send with: IrSender.sendKaseikyo(0xF2, 0x87, <numberOfRepeats>, 0x4711);
rawData[100]:
-1063750
+3450,-1700
+ 450,-1300 + 400,- 450 + 450,- 400 + 450,- 400
+ 450,-1300 + 400,- 450 + 450,- 400 + 450,- 450
+ 400,-1300 + 450,-1250 + 450,-1300 + 450,- 400
+ 450,- 400 + 450,- 450 + 450,-1250 + 450,- 450
+ 400,-1300 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,-1300 + 450,-1250 + 450,-1300 + 400,-1300
+ 450,- 400 + 450,- 450 + 450,- 400 + 450,- 400
+ 450,-1300 + 400,-1300 + 450,-1300 + 400,- 450
+ 400,- 450 + 450,- 400 + 450,- 450 + 400,-1300
+ 450,-1300 + 400,-1300 + 450,- 400 + 450,-1300
+ 400,- 450 + 450,-1250 + 450,- 450 + 450,-1250
+ 450
Send Kaseikyo_Denon variant
Protocol=Kaseikyo_Denon Address=0xF2 Command=0x87 Raw-Data=0xA8870F20 48 bits LSB first
Send with: IrSender.sendKaseikyo_Denon(0xF2, 0x87, <numberOfRepeats>);
rawData[100]:
-1064300
+3450,-1700
+ 450,- 400 + 450,- 450 + 400,-1300 + 450,- 400
+ 450,-1300 + 400,- 450 + 450,-1300 + 400,- 450
+ 400,- 450 + 500,-1250 + 400,- 450 + 450,- 400
+ 450,-1300 + 400,-1300 + 450,- 400 + 450,- 450
+ 450,- 400 + 450,- 400 + 450,- 450 + 400,- 450
+ 450,- 400 + 450,-1300 + 400,- 450 + 450,- 400
+ 450,-1300 + 450,-1250 + 450,-1300 + 400,-1300
+ 450,- 400 + 450,- 450 + 450,- 400 + 450,- 400
+ 450,-1300 + 400,-1300 + 450,-1250 + 450,- 450
+ 400,- 450 + 450,- 400 + 450,- 450 + 400,-1300
+ 450,-1300 + 450,-1250 + 450,-1300 + 400,- 450
+ 450,- 400 + 450,- 450 + 400,- 450 + 450,-1250
+ 450,- 450 + 400,-1300 + 450,- 400 + 450,-1300
+ 400
Send Denon
Protocol=Denon Address=0x12 Command=0x87 Raw-Data=0x4A1C 15 bits MSB first
Send with: IrSender.sendDenon(0x12, 0x87, <numberOfRepeats>);
rawData[32]:
-1062250
+ 250,-1800 + 250,- 800 + 250,- 750 + 300,-1800
+ 250,- 800 + 250,-1800 + 250,- 800 + 250,- 800
+ 250,- 750 + 300,- 750 + 300,-1800 + 250,-1800
+ 300,-1750 + 300,- 750 + 300,- 750 + 300
Send Denon/Sharp variant
Protocol=Sharp Address=0x12 Command=0x87 Raw-Data=0x4A1E 15 bits MSB first
Send with: IrSender.sendSharp(0x12, 0x87, <numberOfRepeats>);
rawData[32]:
-1024000
+ 300,-1800 + 250,- 800 + 250,- 750 + 300,-1800
+ 250,- 800 + 250,-1800 + 250,- 800 + 250,- 800
+ 250,- 750 + 300,- 750 + 300,-1800 + 250,-1800
+ 300,-1800 + 250,-1800 + 250,- 800 + 250
Send Sony/SIRCS with 7 command and 5 address bits
Protocol=Sony Address=0x12 Command=0x7 Raw-Data=0x907 12 bits LSB first
Send with: IrSender.sendSony(0x12, 0x7, <numberOfRepeats>);
rawData[26]:
-1026050
+2350,- 600
+1250,- 550 +1250,- 550 +1250,- 550 + 650,- 550
+ 650,- 550 + 650,- 550 + 650,- 600 + 600,- 550
+1250,- 550 + 650,- 550 + 650,- 550 +1250
Send Sony/SIRCS with 7 command and 8 address bits
Protocol=Sony Address=0xF2 Command=0x7 Raw-Data=0x7907 15 bits LSB first
Send with: IrSender.sendSony(0xF2, 0x7, <numberOfRepeats>);
rawData[32]:
-1022500
+2400,- 600
+1200,- 550 +1250,- 550 +1250,- 600 + 600,- 550
+ 650,- 550 + 650,- 550 + 650,- 600 + 600,- 550
+1250,- 550 + 650,- 550 + 650,- 550 +1250,- 600
+1200,- 550 +1250,- 550 +1250
Send Sony/SIRCS with 7 command and 13 address bits
Protocol=Sony Address=0xF2 Command=0x7 Raw-Data=0x7907 20 bits LSB first
Send with: IrSender.sendSony(0xF2, 0x7, <numberOfRepeats>);
rawData[42]:
-1025950
+2400,- 550
+1250,- 550 +1250,- 550 +1250,- 550 + 650,- 550
+ 650,- 550 + 650,- 550 + 650,- 600 + 600,- 600
+1200,- 550 + 650,- 550 + 650,- 550 +1250,- 550
+1250,- 550 +1250,- 550 +1250,- 550 + 650,- 550
+ 650,- 550 + 650,- 550 + 650,- 550 + 650
Send RC5
Protocol=RC5 Address=0x12 Command=0x7 Toggle=1 Raw-Data=0x1C87 13 bits MSB first
Send with: IrSender.sendRC5(0x12, 0x7, <numberOfRepeats>);
rawData[24]:
-1028500
+ 900,- 850
+ 900,- 900 + 900,- 900 +1750,- 900 + 850,-1800
+1750,- 900 + 900,- 850 + 900,- 900 + 900,-1750
+ 900,- 850 + 900,- 900 + 900
Send RC5X with 7.th MSB of command set
Protocol=RC5 Address=0x12 Command=0x47 Raw-Data=0x487 13 bits MSB first
Send with: IrSender.sendRC5(0x12, 0x47, <numberOfRepeats>);
rawData[22]:
-1022450
+1800,- 850
+ 900,-1750 +1800,- 900 + 850,-1800 +1750,- 900
+ 900,- 900 + 850,- 900 + 900,-1750 + 900,- 900
+ 850,- 900 + 900
Send RC6
Protocol=RC6 Address=0xF2 Command=0x87 Toggle=1 Raw-Data=0x1F287 20 bits MSB first
Send with: IrSender.sendRC6(0xF2, 0x87, <numberOfRepeats>);
rawData[36]:
-1017400
+2600,- 900
+ 450,- 900 + 450,- 450 + 450,- 450 +1300,- 900
+ 450,- 450 + 450,- 450 + 450,- 450 + 450,- 850
+ 500,- 400 + 900,- 900 + 900,- 900 + 450,- 450
+ 400,- 500 + 450,- 400 + 900,- 450 + 450,- 450
+ 450,- 450 + 400,- 450 + 400,- 450 + 450,-1300
+ 400,- 450 + 450,-1250 + 450,- 400 + 450,-1300
+ 450
Send Samsung
Protocol=Samsung Address=0xF2 Command=0x87 Raw-Data=0x788700F2 32 bits LSB first
Send with: IrSender.sendSamsung(0xF2, 0x87, <numberOfRepeats>);
rawData[68]:
-1027150
+4400,-4400
+ 550,- 550 + 550,-1650 + 600,- 500 + 550,- 550
+ 550,-1650 + 550,-1650 + 550,-1650 + 550,-1650
+ 550,- 550 + 550,- 550 + 550,- 550 + 550,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 550,- 550
+ 550,-1650 + 550,-1650 + 550,-1650 + 550,- 550
+ 550,- 550 + 550,- 550 + 550,- 550 + 550,-1650
+ 550,- 550 + 550,- 550 + 550,- 550 + 550,-1650
+ 550,-1650 + 550,-1650 + 550,-1650 + 550,- 550
+ 550
Send JVC
Protocol=JVC Address=0xF2 Command=0x87 Raw-Data=0x87F2 16 bits LSB first
Send with: IrSender.sendJVC(0xF2, 0x87, <numberOfRepeats>);
rawData[36]:
-1043300
+8350,-4150
+ 550,- 550 + 500,-1550 + 550,- 500 + 550,- 500
+ 550,-1550 + 550,-1550 + 500,-1600 + 500,-1550
+ 550,-1550 + 550,-1550 + 550,-1550 + 550,- 500
+ 550,- 500 + 550,- 500 + 550,- 500 + 550,-1550
+ 550
Send LG
Protocol=LG Address=0xF2 Command=0x8787 Raw-Data=0xF28787E 28 bits MSB first
Send with: IrSender.sendLG(0xF2, 0x8787, <numberOfRepeats>);
rawData[60]:
-1024600
+8950,-4150
+ 550,-1500 + 550,-1550 + 500,-1550 + 500,-1600
+ 500,- 550 + 500,- 550 + 500,-1550 + 500,- 550
+ 500,-1550 + 550,- 550 + 500,- 550 + 500,- 550
+ 500,- 550 + 500,-1550 + 500,-1550 + 500,-1600
+ 500,-1550 + 500,- 550 + 500,- 550 + 500,- 550
+ 500,- 550 + 500,-1600 + 500,-1550 + 500,-1550
+ 500,-1600 + 500,-1550 + 500,-1550 + 500,- 600
+ 500
Send Bosewave with no address and 8 command bits
Protocol=BoseWave Address=0x0 Command=0x87 Raw-Data=0x7887 16 bits LSB first
Send with: IrSender.sendBoseWave(0x0, 0x87, <numberOfRepeats>);
rawData[36]:
-1041600
+1050,-1400
+ 550,-1450 + 550,-1450 + 550,-1400 + 550,- 450
+ 550,- 450 + 550,- 400 + 600,- 400 + 550,-1450
+ 550,- 400 + 600,- 400 + 600,- 400 + 550,-1450
+ 550,-1400 + 550,-1450 + 550,-1400 + 550,- 450
+ 550
Force buffer overflow by sending 280 marks and spaces
Protocol=UNKNOWN Hash=0x0 0 bits (incl. gap and start) received
Overflow detected
Try to increase the "RAW_BUFFER_LENGTH" value of 112 in ../src/UnitTest.cpp
Sum: 59150

View File

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

View File

@ -1,9 +1,9 @@
name=IRremote
version=3.8.0
version=3.9.0
author=shirriff, z3t0, ArminJo
maintainer=Armin Joachimsmeyer <armin.arduino@gmail.com>
sentence=Send and receive infrared signals with multiple protocols
paragraph=Currently included protocols: Denon / Sharp, JVC, LG / LG2, NEC / Onkyo / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b>Improvements and bug fixes. Added SAMD51 support.<br/><a href="https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/changelog.md">Release notes</a><br/>
paragraph=Currently included protocols: Denon / Sharp, JVC, LG / LG2, NEC / Onkyo / Apple, Panasonic / Kaseikyo, RC5, RC6, Samsung, Sony, (Pronto), BoseWave, Lego, Whynter, MagiQuest.<br/><br/><b>New: </b>Added NEC2 protocol. Improved Magiquest protocol. Added function sendPulseDistanceWidth().<br/><a href="https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/changelog.md">Release notes</a><br/>
category=Communication
url=https://github.com/Arduino-IRremote/Arduino-IRremote
architectures=avr,megaavr,samd,esp8266,esp32,stm32,STM32F1,mbed,mbed_nano,rp2040

View File

@ -8,7 +8,7 @@
************************************************************************************
* MIT License
*
* Copyright (c) 2020-2021 Armin Joachimsmeyer
* Copyright (c) 2020-2022 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
@ -59,6 +59,7 @@ typedef enum {
SAMSUNG,
SAMSUNG_LG,
SONY,
NEC2, /* NEC with full frame as repeat */
ONKYO,
APPLE,
#if !defined(EXCLUDE_EXOTIC_PROTOCOLS)
@ -69,6 +70,22 @@ typedef enum {
#endif
} decode_type_t;
struct PulsePauseWidthProtocolConstants {
decode_type_t ProtocolIndex;
uint_fast8_t FrequencyKHz;
unsigned int HeaderMarkMicros;
unsigned int HeaderSpaceMicros;
unsigned int OneMarkMicros;
unsigned int OneSpaceMicros;
unsigned int ZeroMarkMicros;
unsigned int ZeroSpaceMicros;
bool isMSBFirst;
bool hasStopBit;
unsigned int RepeatPeriodMillis;
void (*SpecialSendRepeatFunction)(); // using non member functions here saves up to 250 bytes for send demo
// void (IRsend::*SpecialSendRepeatFunction)();
};
const __FlashStringHelper* getProtocolString(decode_type_t aProtocol);
#define PROTOCOL_IS_LSB_FIRST false
@ -100,8 +117,4 @@ const __FlashStringHelper* getProtocolString(decode_type_t aProtocol);
#define SIRCS_15_PROTOCOL 15
#define SIRCS_20_PROTOCOL 20
#define LEGO_MODE_EXTENDED 0
#define LEGO_MODE_COMBO 1
#define LEGO_MODE_SINGLE 0x4 // here the 2 LSB have meanings like Output A / Output B
#endif // _IR_PROTOCOL_H

View File

@ -441,8 +441,8 @@ bool IRrecv::decodePulseWidthData(uint_fast8_t aNumberOfBits, uint_fast8_t aStar
}
tRawBufPointer++;
// If we have no stop bit, assume that last space, which is not recorded, is correct, since we can not check it
if (tRawBufPointer < &decodedIRData.rawDataPtr->rawbuf[decodedIRData.rawDataPtr->rawlen]) {
// Assume that last space, which is not recorded, is correct, since we can not check it
// Check for constant length space
if (!matchSpace(*tRawBufPointer, aBitSpaceMicros)) {
IR_DEBUG_PRINT(F("Space="));
@ -479,9 +479,9 @@ bool IRrecv::decodePulseWidthData(uint_fast8_t aNumberOfBits, uint_fast8_t aStar
}
tRawBufPointer++;
// If we have no stop bit, assume that last space, which is not recorded, is correct, since we can not check it
if (tRawBufPointer < &decodedIRData.rawDataPtr->rawbuf[decodedIRData.rawDataPtr->rawlen]) {
// Assume that last space, which is not recorded, is correct, since we can not check it
// Check for constant length space
// Check for constant length space here
if (!matchSpace(*tRawBufPointer, aBitSpaceMicros)) {
IR_DEBUG_PRINT(F("Space="));
IR_DEBUG_PRINT(*tRawBufPointer * MICROS_PER_TICK);
@ -885,7 +885,7 @@ void IRrecv::printActiveIRProtocols(Print *aSerial) {
}
void printActiveIRProtocols(Print *aSerial) {
#if defined(DECODE_NEC)
aSerial->print(F("NEC, "));
aSerial->print(F("NEC/NEC2/Onkyo/Apple, "));
#endif
#if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
aSerial->print(F("Panasonic/Kaseikyo, "));
@ -994,7 +994,7 @@ void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, bool aPrintRepeatGap
}
if (aIRDataPtr->flags & IRDATA_TOGGLE_BIT_MASK) {
if(aIRDataPtr->protocol == NEC) {
if (aIRDataPtr->protocol == NEC) {
aSerial->print(F(" Special repeat"));
} else {
aSerial->print(F(" Toggle=1"));
@ -1058,9 +1058,10 @@ void IRrecv::printIRSendUsage(Print *aSerial) {
void printIRSendUsage(Print *aSerial, IRData *aIRDataPtr) {
if (aIRDataPtr->protocol != UNKNOWN && (aIRDataPtr->flags & (IRDATA_FLAGS_IS_AUTO_REPEAT | IRDATA_FLAGS_IS_REPEAT)) == 0x00) {
#if defined(DECODE_DISTANCE)
aSerial->print(F("Send with: "));
aSerial->print(F("Send with:"));
if (aIRDataPtr->protocol == PULSE_DISTANCE) {
aSerial->print(F("uint32_t tRawData[]={0x"));
aSerial->println();
aSerial->print(F(" uint32_t tRawData[]={0x"));
uint_fast8_t tNumberOf32BitChunks = ((aIRDataPtr->numberOfBits - 1) / 32) + 1;
for (uint_fast8_t i = 0; i < tNumberOf32BitChunks; ++i) {
aSerial->print(aIRDataPtr->decodedRawDataArray[i], HEX);
@ -1068,33 +1069,35 @@ void printIRSendUsage(Print *aSerial, IRData *aIRDataPtr) {
aSerial->print(F(", 0x"));
}
}
aSerial->print(F("}; "));
aSerial->println(F("};"));
aSerial->print(F(" "));
}
aSerial->print(F("IrSender.send"));
aSerial->print(F(" IrSender.send"));
#else
aSerial->print(F("Send with: IrSender.send"));
#endif
aSerial->print(getProtocolString(aIRDataPtr->protocol));
#if defined(DECODE_DISTANCE)
if (aIRDataPtr->protocol != PULSE_DISTANCE) {
#endif
aSerial->print(F("(0x"));
/*
* New decoders have address and command
*/
aSerial->print(aIRDataPtr->address, HEX);
aSerial->print(getProtocolString(aIRDataPtr->protocol));
aSerial->print(F("(0x"));
/*
* New decoders have address and command
*/
aSerial->print(aIRDataPtr->address, HEX);
aSerial->print(F(", 0x"));
aSerial->print(aIRDataPtr->command, HEX);
aSerial->print(F(", <numberOfRepeats>"));
if (aIRDataPtr->flags & IRDATA_FLAGS_EXTRA_INFO) {
aSerial->print(F(", 0x"));
aSerial->print(aIRDataPtr->extra, HEX);
}
aSerial->print(aIRDataPtr->command, HEX);
aSerial->print(F(", <numberOfRepeats>"));
if (aIRDataPtr->flags & IRDATA_FLAGS_EXTRA_INFO) {
aSerial->print(F(", 0x"));
aSerial->print(aIRDataPtr->extra, HEX);
}
#if defined(DECODE_DISTANCE)
} else {
aSerial->print('(');
aSerial->print("PulseDistanceWidthFromArray(38, ");
aSerial->print((aIRDataPtr->extra >> 8) * MICROS_PER_TICK); // aHeaderMarkMicros
aSerial->print(F(", "));
aSerial->print((aIRDataPtr->extra & 0xFF) * MICROS_PER_TICK); // aHeaderSpaceMicros
@ -1108,13 +1111,12 @@ void printIRSendUsage(Print *aSerial, IRData *aIRDataPtr) {
aSerial->print((aIRDataPtr->command & 0xFF) * MICROS_PER_TICK); // aZeroSpaceMicros
aSerial->print(F(", &tRawData[0], "));
aSerial->print(aIRDataPtr->numberOfBits); // aNumberOfBits
aSerial->print(F(", "));
if (aIRDataPtr->flags & IRDATA_FLAGS_IS_MSB_FIRST) {
aSerial->print(F("true"));
} else {
aSerial->print(F("false"));
}
aSerial->print(F(", <millisBetweenRepeats>, <numberOfRepeats>"));
#if defined(DISTANCE_DO_MSB_DECODING)
aSerial->print(F(", PROTOCOL_IS_MSB_FIRST"));
#else
aSerial->print(F(", PROTOCOL_IS_LSB_FIRST"));
#endif
aSerial->print(F(", <millisofRepeatPeriod>, <numberOfRepeats>"));
}
#endif
aSerial->println(F(");"));
@ -1169,8 +1171,6 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
aSerial->print(decodedIRData.rawDataPtr->rawlen, DEC);
aSerial->println(F("]: "));
uint32_t tDurationMicros;
/*
* Print initial gap
*/
@ -1185,6 +1185,7 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
#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
@ -1202,13 +1203,17 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
}
#endif
uint32_t tDuration;
uint16_t tSumOfDurationTicks = 0;
for (i = 1; i < decodedIRData.rawDataPtr->rawlen; i++) {
auto tCurrentTicks = decodedIRData.rawDataPtr->rawbuf[i];
if (aOutputMicrosecondsInsteadOfTicks) {
tDurationMicros = decodedIRData.rawDataPtr->rawbuf[i] * MICROS_PER_TICK;
tDuration = tCurrentTicks * MICROS_PER_TICK;
} else {
tDurationMicros = decodedIRData.rawDataPtr->rawbuf[i];
tDuration = tCurrentTicks;
}
tSumOfDurationTicks += tCurrentTicks; // compute length of protocol frame
if (!(i & 1)) { // even
aSerial->print('-');
} else { // odd
@ -1216,16 +1221,16 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
}
// padding only for big values
if (aOutputMicrosecondsInsteadOfTicks && tDurationMicros < 1000) {
if (aOutputMicrosecondsInsteadOfTicks && tDuration < 1000) {
aSerial->print(' ');
}
if (aOutputMicrosecondsInsteadOfTicks && tDurationMicros < 100) {
if (aOutputMicrosecondsInsteadOfTicks && tDuration < 100) {
aSerial->print(' ');
}
if (tDurationMicros < 10) {
if (tDuration < 10) {
aSerial->print(' ');
}
aSerial->print(tDurationMicros, DEC);
aSerial->print(tDuration, DEC);
if ((i & 1) && (i + 1) < decodedIRData.rawDataPtr->rawlen) {
aSerial->print(','); //',' not required for last one
@ -1236,7 +1241,14 @@ void IRrecv::printIRResultRawFormatted(Print *aSerial, bool aOutputMicrosecondsI
aSerial->println();
}
}
aSerial->println(""); // Newline
aSerial->println();
aSerial->print("Sum: ");
if (aOutputMicrosecondsInsteadOfTicks) {
aSerial->println((uint32_t) tSumOfDurationTicks * MICROS_PER_TICK, DEC);
} else {
aSerial->println(tSumOfDurationTicks, DEC);
}
}
/**
@ -1432,6 +1444,9 @@ const __FlashStringHelper* getProtocolString(decode_type_t aProtocol) {
case SONY:
return (F("Sony"));
break;
case NEC2:
return (F("NEC2"));
break;
case ONKYO:
return (F("Onkyo"));
break;

View File

@ -144,7 +144,7 @@ size_t IRsend::write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats) {
auto tProtocol = aIRSendData->protocol;
auto tAddress = aIRSendData->address;
auto tCommand = aIRSendData->command;
bool tSendRepeat = (aIRSendData->flags & IRDATA_FLAGS_IS_REPEAT);
bool tIsRepeat = (aIRSendData->flags & IRDATA_FLAGS_IS_REPEAT);
// switch (tProtocol) { // 26 bytes bigger than if, else if, else
// case NEC:
// sendNEC(tAddress, tCommand, aNumberOfRepeats, tSendRepeat);
@ -181,7 +181,7 @@ size_t IRsend::write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats) {
* Order of protocols is in guessed relevance :-)
*/
if (tProtocol == NEC) {
sendNEC(tAddress, tCommand, aNumberOfRepeats, tSendRepeat);
sendNEC(tAddress, tCommand, aNumberOfRepeats, tIsRepeat);
} else if (tProtocol == SAMSUNG) {
sendSamsung(tAddress, tCommand, aNumberOfRepeats);
@ -202,16 +202,16 @@ size_t IRsend::write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats) {
sendSharp(tAddress, tCommand, aNumberOfRepeats);
} else if (tProtocol == LG) {
sendLG(tAddress, tCommand, aNumberOfRepeats, tSendRepeat);
sendLG(tAddress, tCommand, aNumberOfRepeats, tIsRepeat);
} else if (tProtocol == JVC) {
sendJVC((uint8_t) tAddress, (uint8_t) tCommand, aNumberOfRepeats); // casts are required to specify the right function
} else if (tProtocol == RC5) {
sendRC5(tAddress, tCommand, aNumberOfRepeats, !tSendRepeat); // No toggle for repeats
sendRC5(tAddress, tCommand, aNumberOfRepeats, !tIsRepeat); // No toggle for repeats
} else if (tProtocol == RC6) {
sendRC6(tAddress, tCommand, aNumberOfRepeats, !tSendRepeat); // No toggle for repeats
sendRC6(tAddress, tCommand, aNumberOfRepeats, !tIsRepeat); // No toggle for repeats
} else if (tProtocol == KASEIKYO_JVC) {
sendKaseikyo_JVC(tAddress, tCommand, aNumberOfRepeats);
@ -225,18 +225,24 @@ size_t IRsend::write(IRData *aIRSendData, uint_fast8_t aNumberOfRepeats) {
} else if (tProtocol == KASEIKYO_MITSUBISHI) {
sendKaseikyo_Mitsubishi(tAddress, tCommand, aNumberOfRepeats);
} else if (tProtocol == NEC2) {
sendNEC2(tAddress, tCommand, aNumberOfRepeats);
} else if (tProtocol == ONKYO) {
sendOnkyo(tAddress, tCommand, aNumberOfRepeats, tSendRepeat);
sendOnkyo(tAddress, tCommand, aNumberOfRepeats, tIsRepeat);
} else if (tProtocol == APPLE) {
sendApple(tAddress, tCommand, aNumberOfRepeats, tSendRepeat);
sendApple(tAddress, tCommand, aNumberOfRepeats, tIsRepeat);
#if !defined(EXCLUDE_EXOTIC_PROTOCOLS)
} else if (tProtocol == BOSEWAVE) {
sendBoseWave(tCommand, aNumberOfRepeats);
} else if (tProtocol == MAGIQUEST) {
sendMagiQuest(tAddress, tCommand);
} else if (tProtocol == LEGO_PF) {
sendLegoPowerFunctions(tAddress, tCommand, tCommand >> 4, tSendRepeat); // send 5 autorepeats
sendLegoPowerFunctions(tAddress, tCommand, tCommand >> 4, tIsRepeat); // send 5 autorepeats
#endif
}
@ -338,6 +344,83 @@ void IRsend::sendRaw_P(const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOf
#endif
}
/**
* Sends PulseDistance data from array
* 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
*/
void IRsend::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, unsigned int aRepeatPeriodMillis,
uint_fast8_t aNumberOfRepeats) {
// Set IR carrier frequency
enableIROut(aFrequencyKHz);
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
uint_fast8_t tNumberOf32BitChunks = ((aNumberOfBits - 1) / 32) + 1;
while (tNumberOfCommands > 0) {
unsigned long tStartOfFrameMillis = millis();
// Header
mark(aHeaderMarkMicros);
space(aHeaderSpaceMicros);
for (uint_fast8_t i = 0; i < tNumberOf32BitChunks; ++i) {
uint8_t tNumberOfBitsForOneSend;
if (aNumberOfBits > 32) {
tNumberOfBitsForOneSend = 32;
} else {
tNumberOfBitsForOneSend = aNumberOfBits;
}
sendPulseDistanceWidthData(aOneMarkMicros, aOneSpaceMicros, aZeroMarkMicros, aZeroSpaceMicros, aDecodedRawDataArray[i],
tNumberOfBitsForOneSend, aMSBfirst, (i == (tNumberOf32BitChunks - 1)));
aNumberOfBits -= 32;
}
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
delay(aRepeatPeriodMillis - (millis() - tStartOfFrameMillis));
}
}
IrReceiver.restartAfterSend();
}
/**
* Sends PulseDistance frames and repeats
*/
void IRsend::sendPulseDistanceWidth(uint_fast8_t aFrequencyKHz, unsigned int aHeaderMarkMicros, unsigned int aHeaderSpaceMicros,
unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros, unsigned int aZeroSpaceMicros,
uint32_t aData, uint_fast8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit, unsigned int aRepeatPeriodMillis,
uint_fast8_t aNumberOfRepeats) {
// Set IR carrier frequency
enableIROut(aFrequencyKHz);
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
while (tNumberOfCommands > 0) {
unsigned long tStartOfFrameMillis = millis();
// Header
mark(aHeaderMarkMicros);
space(aHeaderSpaceMicros);
sendPulseDistanceWidthData(aOneMarkMicros, aOneSpaceMicros, aZeroMarkMicros, aZeroSpaceMicros, aData, aNumberOfBits,
aMSBfirst, aSendStopBit);
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
delay(aRepeatPeriodMillis - (millis() - tStartOfFrameMillis));
}
}
IrReceiver.restartAfterSend();
}
/**
* Sends PulseDistance data
* The output always ends with a space
@ -372,7 +455,7 @@ void IRsend::sendPulseDistanceWidthData(unsigned int aOneMarkMicros, unsigned in
}
if (aSendStopBit) {
IR_TRACE_PRINT('S');
mark(aZeroMarkMicros); // seems like this is used for stop bits
mark(aZeroMarkMicros); // Use aZeroMarkMicros for stop bits. This seems to be correct for all protocols :-)
}
IR_TRACE_PRINTLN(F(""));
}
@ -394,9 +477,9 @@ void IRsend::sendBiphaseData(unsigned int aBiphaseTimeUnit, uint32_t aData, uint
// Data - Biphase code MSB first
// prepare for start with sending the start bit, which is 1
uint32_t tMask = 1UL << aNumberOfBits; // mask is now set for the virtual start bit
uint_fast8_t tLastBitValue = 1; // Start bit is a 1
bool tNextBitIsOne = 1; // Start bit is a 1
uint32_t tMask = 1UL << aNumberOfBits; // mask is now set for the virtual start bit
uint_fast8_t tLastBitValue = 1; // Start bit is a 1
bool tNextBitIsOne = 1; // Start bit is a 1
for (uint_fast8_t i = aNumberOfBits + 1; i > 0; i--) {
bool tCurrentBitIsOne = tNextBitIsOne;
tMask >>= 1;
@ -446,7 +529,7 @@ void IRsend::mark(unsigned int aMarkMicros) {
*/
ENABLE_SEND_PWM_BY_TIMER; // Enable timer or ledcWrite() generated PWM output
customDelayMicroseconds(aMarkMicros);
IRLedOff(); // disables hardware PWM and manages feedback LED
IRLedOff();// disables hardware PWM and manages feedback LED
return;
#elif defined(USE_NO_SEND_PWM)
@ -496,7 +579,7 @@ void IRsend::mark(unsigned int aMarkMicros) {
// 4.3 us from do{ to pin setting if sendPin is no constant
digitalWriteFast(sendPin, HIGH);
# endif
delayMicroseconds(periodOnTimeMicros); // this is normally implemented by a blocking wait
delayMicroseconds (periodOnTimeMicros); // this is normally implemented by a blocking wait
/*
* Output the PWM pause
@ -538,7 +621,7 @@ void IRsend::mark(unsigned int aMarkMicros) {
// tDeltaMicros += (160 / CLOCKS_PER_MICRO); // adding this once increases program size !
# if !defined(NO_LED_FEEDBACK_CODE)
if (tDeltaMicros >= aMarkMicros - (30 + (112 / CLOCKS_PER_MICRO))) { // 30 to be constant. Using periodTimeMicros increases program size too much.
// reset feedback led in the last pause before end
// reset feedback led in the last pause before end
if (FeedbackLEDControl.LedFeedbackEnabled == LED_FEEDBACK_ENABLED_FOR_SEND) {
setFeedbackLED(false);
}
@ -546,18 +629,18 @@ void IRsend::mark(unsigned int aMarkMicros) {
# endif
if (tDeltaMicros >= aMarkMicros - (112 / CLOCKS_PER_MICRO)) { // To compensate for call duration - 112 is an empirical value
#else
if (tDeltaMicros >= aMarkMicros) {
if (tDeltaMicros >= aMarkMicros) {
# if !defined(NO_LED_FEEDBACK_CODE)
if (FeedbackLEDControl.LedFeedbackEnabled == LED_FEEDBACK_ENABLED_FOR_SEND) {
setFeedbackLED(false);
}
if (FeedbackLEDControl.LedFeedbackEnabled == LED_FEEDBACK_ENABLED_FOR_SEND) {
setFeedbackLED(false);
}
# endif
#endif
return;
}
// digitalToggleFast(_IR_TIMING_TEST_PIN); // 3.0 us per call @16MHz
}while (tMicros < tNextPeriodEnding); // 3.4 us @16MHz
}while (true);
} while (tMicros < tNextPeriodEnding); // 3.4 us @16MHz
} while (true);
# endif
}
@ -568,20 +651,20 @@ void IRsend::mark(unsigned int aMarkMicros) {
*/
void IRsend::IRLedOff() {
#if defined(SEND_PWM_BY_TIMER)
DISABLE_SEND_PWM_BY_TIMER; // Disable PWM output
DISABLE_SEND_PWM_BY_TIMER; // Disable PWM output
#elif defined(USE_NO_SEND_PWM)
# if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && !defined(OUTPUT_OPEN_DRAIN)
digitalWriteFast(sendPin, LOW); // prepare for all next active states.
pinModeFast(sendPin, INPUT);// inactive state for open drain
digitalWriteFast(sendPin, LOW); // prepare for all next active states.
pinModeFast(sendPin, INPUT);// inactive state for open drain
# else
digitalWriteFast(sendPin, HIGH); // Set output to inactive high.
digitalWriteFast(sendPin, HIGH); // Set output to inactive high.
# endif
#else
# if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN)
# if defined(OUTPUT_OPEN_DRAIN)
digitalWriteFast(sendPin, HIGH); // Set output to inactive high.
digitalWriteFast(sendPin, HIGH); // Set output to inactive high.
# else
pinModeFast(sendPin, INPUT); // inactive state to mimic open drain
pinModeFast(sendPin, INPUT); // inactive state to mimic open drain
# endif
# else
digitalWriteFast(sendPin, LOW);
@ -611,7 +694,7 @@ void IRsend::customDelayMicroseconds(unsigned long aMicroseconds) {
#if defined(__AVR__)
unsigned long start = micros() - (64 / clockCyclesPerMicrosecond()); // - (64 / clockCyclesPerMicrosecond()) for reduced resolution and additional overhead
#else
unsigned long start = micros();
unsigned long start = micros();
#endif
// overflow invariant comparison :-)
while (micros() - start < aMicroseconds) {
@ -625,15 +708,15 @@ void IRsend::customDelayMicroseconds(unsigned long aMicroseconds) {
*/
void IRsend::enableIROut(uint_fast8_t aFrequencyKHz) {
#if defined(SEND_PWM_BY_TIMER)
timerConfigForSend(aFrequencyKHz); // must set output pin mode and disable receive interrupt if required, e.g. uses the same resource
timerConfigForSend(aFrequencyKHz); // must set output pin mode and disable receive interrupt if required, e.g. uses the same resource
#elif defined(USE_NO_SEND_PWM)
(void) aFrequencyKHz;
(void) aFrequencyKHz;
#else
periodTimeMicros = (1000U + (aFrequencyKHz / 2)) / aFrequencyKHz; // rounded value -> 26 for 38.46 kHz, 27 for 37.04 kHz, 25 for 40 kHz.
# if defined(IR_SEND_PIN)
periodOnTimeMicros = (((periodTimeMicros * IR_SEND_DUTY_CYCLE_PERCENT) + 50) / 100U); // +50 for rounding -> 830/100 for 30% and 16 MHz
periodOnTimeMicros = (((periodTimeMicros * IR_SEND_DUTY_CYCLE_PERCENT) + 50) / 100U); // +50 for rounding -> 830/100 for 30% and 16 MHz
# else
// Heuristics! We require a nanosecond correction for "slow" digitalWrite() functions
periodOnTimeMicros = (((periodTimeMicros * IR_SEND_DUTY_CYCLE_PERCENT) + 50 - (PULSE_CORRECTION_NANOS / 10)) / 100U); // +50 for rounding -> 530/100 for 30% and 16 MHz
@ -642,9 +725,9 @@ void IRsend::enableIROut(uint_fast8_t aFrequencyKHz) {
#if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && defined(OUTPUT_OPEN_DRAIN) // the mode INPUT for mimicking open drain is set at IRLedOff()
# if defined(IR_SEND_PIN)
pinModeFast(IR_SEND_PIN, OUTPUT_OPEN_DRAIN);
pinModeFast(IR_SEND_PIN, OUTPUT_OPEN_DRAIN);
# else
pinModeFast(sendPin, OUTPUT_OPEN_DRAIN);
pinModeFast(sendPin, OUTPUT_OPEN_DRAIN);
# endif
#else
@ -652,7 +735,7 @@ void IRsend::enableIROut(uint_fast8_t aFrequencyKHz) {
// because ESP 2.0.2 ledcWrite does not work if pin mode is set, and RP2040 requires gpio_set_function(IR_SEND_PIN, GPIO_FUNC_PWM);
# if defined(__AVR__) || !defined(SEND_PWM_BY_TIMER)
# if defined(IR_SEND_PIN)
pinModeFast(IR_SEND_PIN, OUTPUT);
pinModeFast(IR_SEND_PIN, OUTPUT);
# else
pinModeFast(sendPin, OUTPUT);
# endif

View File

@ -65,9 +65,9 @@
#ifndef _IR_REMOTE_HPP
#define _IR_REMOTE_HPP
#define VERSION_IRREMOTE "3.8.0"
#define VERSION_IRREMOTE "3.9.0"
#define VERSION_IRREMOTE_MAJOR 3
#define VERSION_IRREMOTE_MINOR 8
#define VERSION_IRREMOTE_MINOR 9
#define VERSION_IRREMOTE_PATCH 0
/*

View File

@ -133,7 +133,6 @@ struct irparams_struct {
#define IRDATA_FLAGS_IS_AUTO_REPEAT 0x02
#define IRDATA_FLAGS_PARITY_FAILED 0x04 ///< the current (autorepeat) frame violated parity check
#define IRDATA_FLAGS_TOGGLE_BIT 0x08 ///< is set if RC5 or RC6 toggle bit is set
#define IRDATA_FLAGS_IS_SPECIAL_REPEAT 0x08 ///< is set if we received a NEC special receive (full frame instead of repeat frame)
#define IRDATA_FLAGS_EXTRA_INFO 0x10 ///< there is extra info not contained in address and data (e.g. Kaseikyo unknown vendor ID)
#define IRDATA_FLAGS_WAS_OVERFLOW 0x40 ///< irparams.rawlen is 0 in this case to avoid endless OverflowFlag
#define IRDATA_FLAGS_IS_LSB_FIRST 0x00
@ -148,10 +147,10 @@ struct irparams_struct {
* Filled by decoders and read by print functions or user application.
*/
struct IRData {
decode_type_t protocol; ///< UNKNOWN, NEC, SONY, RC5, ...
decode_type_t protocol; ///< UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
uint16_t address; ///< Decoded address, Distance protocol (OneMarkTicks << 8) | OneSpaceTicks
uint16_t command; ///< Decoded command, Distance protocol (ZeroMarkTicks << 8) | ZeroSpaceTicks
uint16_t extra; ///< Contains MagiQuest magnitude, Kaseikyo unknown vendor ID and Distance protocol (HeaderMarkTicks << 8) | HeaderSpaceTicks.
uint16_t extra; ///< Contains upper 16 bit of Magiquest WandID, Kaseikyo unknown vendor ID and Distance protocol (HeaderMarkTicks << 8) | HeaderSpaceTicks.
uint16_t numberOfBits; ///< Number of bits received for data (address + command + parity) - to determine protocol length if different length are possible.
uint8_t flags; ///< See IRDATA_FLAGS_* definitions above
uint32_t decodedRawData; ///< Up to 32 bit decoded raw data, to be used for send functions.
@ -399,6 +398,7 @@ extern IRrecv IrReceiver;
*/
#define NO_REPEATS 0
#define SEND_STOP_BIT true
#define SEND_NO_STOP_BIT false
#define SEND_REPEAT_COMMAND true ///< used for e.g. NEC, where a repeat is different from just repeating the data.
/**
@ -427,6 +427,13 @@ public:
void enableIROut(uint_fast8_t aFrequencyKHz);
void 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, unsigned int aRepeatPeriodMillis = 110,
uint_fast8_t aNumberOfRepeats = 0);
void sendPulseDistanceWidth(uint_fast8_t aFrequencyKHz, unsigned int aHeaderMarkMicros, unsigned int aHeaderSpaceMicros, unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros,
unsigned int aZeroSpaceMicros, uint32_t aData, uint_fast8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit, unsigned int aRepeatPeriodMillis = 110,
uint_fast8_t aNumberOfRepeats = 0);
void sendPulseDistanceWidthData(unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros,
unsigned int aZeroSpaceMicros, uint32_t aData, uint_fast8_t aNumberOfBits, bool aMSBfirst, bool aSendStopBit = false);
void sendBiphaseData(unsigned int aBiphaseTimeUnit, uint32_t aData, uint_fast8_t aNumberOfBits);
@ -455,17 +462,18 @@ public:
void sendJVC(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats);
void sendLGRepeat(bool aUseLG2Protocol = false);
void sendLG(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false, bool aUseLG2Protocol =
void sendLG(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialLGRepeat = false, bool aUseLG2Protocol =
false);
void sendLG2(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false);
void sendLGRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats = 0, bool aIsRepeat = false, bool aUseLG2Protocol = false);
void sendLG2(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialLGRepeat = false);
void sendLGRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats = 0, bool aSendOnlySpecialLGRepeat = false, bool aUseLG2Protocol = false);
void sendNECRepeat();
void sendNEC(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false);
void sendNECRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats = 0, bool aIsRepeat = false);
void sendNEC(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialNECRepeat = false);
void sendNEC2(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats);
void sendNECRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats = 0, bool aSendOnlySpecialNECRepeat = false);
// NEC variants
void sendOnkyo(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false);
void sendApple(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false);
void sendOnkyo(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialNECRepeat = false);
void sendApple(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialNECRepeat = false);
void sendKaseikyo(uint16_t aAddress, uint8_t aData, uint_fast8_t aNumberOfRepeats, uint16_t aVendorCode); // LSB first
void sendPanasonic(uint16_t aAddress, uint8_t aData, uint_fast8_t aNumberOfRepeats); // LSB first
@ -476,9 +484,9 @@ public:
void sendRC5(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle = true);
void sendRC6(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle = true);
void sendSamsungRepeat();
void sendSamsungLGRepeat();
void sendSamsung(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats);
void sendSamsungLG(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat = false);
void sendSamsungLG(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialSamsungRepeat = false);
void sendSharp(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats); // redirected to sendDenon
void sendSony(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, uint8_t numberOfBits = SIRCS_12_PROTOCOL);
@ -492,10 +500,6 @@ public:
void sendPronto(const char *prontoHexString, uint_fast8_t aNumberOfRepeats = NO_REPEATS);
void sendPronto(const uint16_t *data, unsigned int length, uint_fast8_t aNumberOfRepeats = NO_REPEATS);
void sendPulseDistance(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, unsigned int aRepeatSpaceMillis = 110,
uint_fast8_t aNumberOfRepeats = 0);
#if defined(__AVR__)
void sendPronto_PF(uint_farptr_t str, uint_fast8_t aNumberOfRepeats = NO_REPEATS);
void sendPronto_P(const char *str, uint_fast8_t aNumberOfRepeats);

View File

@ -41,34 +41,18 @@
#define BOSEWAVE_ZERO_SPACE 468 // 468 are 18 clock periods
#define BOSEWAVE_ONE_SPACE 1468 // 1468(measured), 1456 are 56 clock periods
#define BOSEWAVE_REPEAT_PERIOD 75000
#define BOSEWAVE_REPEAT_SPACE 50000
//+=============================================================================
void IRsend::sendBoseWave(uint8_t aCommand, uint_fast8_t aNumberOfRepeats) {
// Set IR carrier frequency
enableIROut(BOSEWAVE_KHZ); // 38 kHz
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
while (tNumberOfCommands > 0) {
// Header
mark(BOSEWAVE_HEADER_MARK);
space(BOSEWAVE_HEADER_SPACE);
// send 8 command bits and then 8 inverted command bits LSB first
uint16_t tData = ((~aCommand) << 8) | aCommand;
sendPulseDistanceWidthData(BOSEWAVE_BIT_MARK, BOSEWAVE_ONE_SPACE, BOSEWAVE_BIT_MARK, BOSEWAVE_ZERO_SPACE, tData,
BOSEWAVE_BITS, PROTOCOL_IS_LSB_FIRST, SEND_STOP_BIT);
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
// send repeated command with a fixed space gap
delay( BOSEWAVE_REPEAT_SPACE / MICROS_IN_ONE_MILLI);
}
}
IrReceiver.restartAfterSend();
// send 8 command bits and then 8 inverted command bits LSB first
uint16_t tData = ((~aCommand) << 8) | aCommand;
sendPulseDistanceWidth(BOSEWAVE_KHZ, BOSEWAVE_HEADER_MARK, BOSEWAVE_HEADER_SPACE, BOSEWAVE_BIT_MARK, BOSEWAVE_ONE_SPACE,
BOSEWAVE_BIT_MARK, BOSEWAVE_ZERO_SPACE, tData, BOSEWAVE_BITS, PROTOCOL_IS_LSB_FIRST, SEND_STOP_BIT,
BOSEWAVE_REPEAT_PERIOD / MICROS_IN_ONE_MILLI, aNumberOfRepeats);
}
//+=============================================================================
@ -96,7 +80,7 @@ bool IRrecv::decodeBoseWave() {
}
if (!decodePulseDistanceData(BOSEWAVE_BITS, 3, BOSEWAVE_BIT_MARK, BOSEWAVE_ONE_SPACE, BOSEWAVE_ZERO_SPACE,
PROTOCOL_IS_LSB_FIRST)) {
PROTOCOL_IS_LSB_FIRST)) {
IR_DEBUG_PRINT(F("Bose: "));
IR_DEBUG_PRINTLN(F("Decode failed"));
return false;

View File

@ -110,8 +110,7 @@ void IRsend::sendDenon(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberO
// Data
sendPulseDistanceWidthData(DENON_BIT_MARK, DENON_ONE_SPACE, DENON_BIT_MARK, DENON_ZERO_SPACE, tData, DENON_BITS,
PROTOCOL_IS_MSB_FIRST,
SEND_STOP_BIT);
PROTOCOL_IS_MSB_FIRST, SEND_STOP_BIT);
// Inverted autorepeat frame
delay(DENON_AUTO_REPEAT_SPACE / MICROS_IN_ONE_MILLI);
@ -244,8 +243,7 @@ void IRsend::sendDenon(unsigned long data, int nbits) {
// Data
sendPulseDistanceWidthData(DENON_BIT_MARK, DENON_ONE_SPACE, DENON_BIT_MARK, DENON_ZERO_SPACE, data, nbits,
PROTOCOL_IS_MSB_FIRST,
SEND_STOP_BIT);
PROTOCOL_IS_MSB_FIRST, SEND_STOP_BIT);
IrReceiver.restartAfterSend();
}

View File

@ -38,7 +38,7 @@ void IRsend::sendDISH(unsigned long data, int nbits) {
mark(DISH_HEADER_MARK);
space(DISH_HEADER_SPACE);
sendPulseDistanceWidthData(DISH_BIT_MARK, DISH_ONE_SPACE, DISH_BIT_MARK, DISH_ZERO_SPACE, data, nbits, PROTOCOL_IS_MSB_FIRST);
sendPulseDistanceWidthData(DISH_BIT_MARK, DISH_ONE_SPACE, DISH_BIT_MARK, DISH_ZERO_SPACE, data, nbits, PROTOCOL_IS_MSB_FIRST, SEND_NO_STOP_BIT);
mark(DISH_HEADER_MARK); //added 26th March 2016, by AnalysIR ( https://www.AnalysIR.com )
IrReceiver.restartAfterSend();
}

View File

@ -58,45 +58,6 @@
* @{
*/
// see: https://www.mikrocontroller.net/articles/IRMP_-_english#Codings
/*
* Send function for up to 64 bit
*/
void IRsend::sendPulseDistance(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, unsigned int aRepeatSpaceMillis, uint_fast8_t aNumberOfRepeats) {
// Set IR carrier frequency
enableIROut(38);
// Header
mark(aHeaderMarkMicros);
space(aHeaderSpaceMicros);
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
uint_fast8_t tNumberOf32BitChunks = ((aNumberOfBits - 1) / 32) + 1;
while (tNumberOfCommands > 0) {
for (uint_fast8_t i = 0; i < tNumberOf32BitChunks; ++i) {
uint8_t tNumberOfBitsForOneSend;
if (aNumberOfBits > 32) {
tNumberOfBitsForOneSend = 32;
} else {
tNumberOfBitsForOneSend = aNumberOfBits;
}
sendPulseDistanceWidthData(aOneMarkMicros, aOneSpaceMicros, aZeroMarkMicros, aZeroSpaceMicros, aDecodedRawDataArray[i],
tNumberOfBitsForOneSend, aMSBfirst, (i == (tNumberOf32BitChunks - 1)));
aNumberOfBits -= 32;
}
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
delay(aRepeatSpaceMillis);
}
}
IrReceiver.restartAfterSend();
}
#if defined(DEBUG)
void printDurations(uint8_t aArray[], uint8_t aMaxIndex) {

View File

@ -66,6 +66,10 @@
#define JVC_ZERO_SPACE JVC_UNIT // The length of a Bit:Space for 0's
#define JVC_REPEAT_SPACE (uint16_t)(45 * JVC_UNIT) // 23625 - Commands are repeated with a distance of 23 ms for as long as the key on the remote control is held down.
#define JVC_REPEAT_PERIOD 65000 // assume around 40 ms for a JVC frame
struct ProtocolConstants JVCProtocolConstants = { JVC, JVC_KHZ, JVC_HEADER_MARK, JVC_HEADER_SPACE, JVC_BIT_MARK, JVC_ONE_SPACE,
JVC_BIT_MARK, JVC_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST, SEND_STOP_BIT, (JVC_REPEAT_PERIOD / MICROS_IN_ONE_MILLI) };
//+=============================================================================
// JVC does NOT repeat by sending a separate code (like NEC does).
@ -76,7 +80,7 @@ void IRsend::sendJVC(uint8_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfR
// Set IR carrier frequency
enableIROut(JVC_KHZ); // 38 kHz
// Header
// The JVC protocol repeats by skipping the header.
mark(JVC_HEADER_MARK);
space(JVC_HEADER_SPACE);

View File

@ -48,21 +48,24 @@
// P A A N NN A A S O O N NN I C
// P A A N N A A SSSS OOO N N IIIII CCCC
//==============================================================================
// see: http://www.hifi-remote.com/johnsfine/DecodeIR.html#Panasonic and http://www.hifi-remote.com/johnsfine/DecodeIR.html#Kaseikyo
// http://www.hifi-remote.com/johnsfine/DecodeIR.html#Panasonic
// http://www.hifi-remote.com/johnsfine/DecodeIR.html#Kaseikyo
// The first two (8-bit) bytes contains the vendor code.
// There are multiple interpretations of the next fields:
// 1. IRP notation: {37k,432}<1,-1|1,-3>(8,-4,M:8,N:8,X:4,D:4,S:8,F:8,G:8,1,-173)+ {X=M:4:0^M:4:4^N:4:0^N:4:4}
// 2. The next two bytes are 4 independent 4-bit fields or Device and Subdevice
// The second to last byte is the function and the last byte is xor of the three bytes before it.
// IRP: {37k,432}<1,-1|1,-3>(8,-4,M:8,N:8,X:4,D:4,S:8,F:8,G:8,1,-173)+ {X=M:4:0^M:4:4^N:4:0^N:4:4}
// 1. interpretation: After the vendor code, the next byte is 4 bit VendorID parity and 4 bit Device and Subdevice
// The 5th byte is the function and the last (6.th) byte is xor of the three bytes before it.
// 0_______ 1_______ 2______ 3_______ 4_______ 5
// 01234567 89ABCDEF 01234567 01234567 01234567 01234567
// 01000000 00100100 Dev____ Sub_Dev_ Fun____ XOR( B2, B3, B4) - showing Panasonic vendor code 0x2002
// see: http://www.remotecentral.com/cgi-bin/mboard/rc-pronto/thread.cgi?26152
//
// 3. LSB first, start bit + 16 VendorID + 4 VendorID parity + 4 Genre1 + 4 Genre2 + 10 Command + 2 ID + 8 Parity + stop bit
// 2. interpretation: LSB first, start bit + 16 VendorID + 4 VendorID parity + 4 Genre1 + 4 Genre2 + 10 Command + 2 ID + 8 Parity + stop bit
// see: https://www.mikrocontroller.net/articles/IRMP_-_english#KASEIKYO
//
// We reduce it to: start bit + 16 VendorID + 4 VendorID parity + 12 Address + 8 Command + 8 Parity of VendorID parity, Address and Command + stop bit
//
// We reduce it to: IRP: {37k,432}<1,-1|1,-3>(8,-4,V:16,X:4,D:4,S:8,F:8,(X^D^S^F):8,1,-173)+ {X=M:4:0^M:4:4^N:4:0^N:4:4}
// start bit + 16 VendorID + 4 VendorID parity + 12 Address + 8 Command + 8 Parity of VendorID parity, Address and Command + stop bit
//
#define KASEIKYO_VENDOR_ID_BITS 16
#define KASEIKYO_VENDOR_ID_PARITY_BITS 4
@ -70,7 +73,7 @@
#define KASEIKYO_COMMAND_BITS 8
#define KASEIKYO_PARITY_BITS 8
#define KASEIKYO_BITS (KASEIKYO_VENDOR_ID_BITS + KASEIKYO_VENDOR_ID_PARITY_BITS + KASEIKYO_ADDRESS_BITS + KASEIKYO_COMMAND_BITS + KASEIKYO_PARITY_BITS)
#define KASEIKYO_UNIT 432 // 16 pulses of 37 kHz (432,432432) - Pronto 0x70 / 0x10
#define KASEIKYO_UNIT 432 // 16 pulses of 37 kHz (432,432432) - Pronto 0x70 | 0x10
#define KASEIKYO_HEADER_MARK (8 * KASEIKYO_UNIT) // 3456
#define KASEIKYO_HEADER_SPACE (4 * KASEIKYO_UNIT) // 1728
@ -104,7 +107,7 @@ void IRsend::sendKaseikyo(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNum
// Vendor ID
sendPulseDistanceWidthData(KASEIKYO_BIT_MARK, KASEIKYO_ONE_SPACE, KASEIKYO_BIT_MARK, KASEIKYO_ZERO_SPACE, aVendorCode,
KASEIKYO_VENDOR_ID_BITS, PROTOCOL_IS_LSB_FIRST);
KASEIKYO_VENDOR_ID_BITS, PROTOCOL_IS_LSB_FIRST, SEND_NO_STOP_BIT);
// Vendor Parity
uint8_t tVendorParity = aVendorCode ^ (aVendorCode >> 8);
@ -268,7 +271,7 @@ bool IRrecv::decodeKaseikyo() {
}
// check for repeat
if (decodedIRData.rawDataPtr->rawbuf[0] < (KASEIKYO_REPEAT_PERIOD / MICROS_PER_TICK)) {
if (decodedIRData.rawDataPtr->rawbuf[0] < ((KASEIKYO_REPEAT_SPACE + (KASEIKYO_REPEAT_SPACE / 4)) / MICROS_PER_TICK)) {
decodedIRData.flags |= IRDATA_FLAGS_IS_REPEAT;
}
@ -326,11 +329,11 @@ void IRsend::sendPanasonic(uint16_t aAddress, uint32_t aData) {
// Old version with MSB first Data Address
sendPulseDistanceWidthData(KASEIKYO_BIT_MARK, KASEIKYO_ONE_SPACE, KASEIKYO_BIT_MARK, KASEIKYO_ZERO_SPACE, aAddress,
KASEIKYO_ADDRESS_BITS, PROTOCOL_IS_MSB_FIRST);
KASEIKYO_ADDRESS_BITS, PROTOCOL_IS_MSB_FIRST, SEND_NO_STOP_BIT);
// Old version with MSB first Data Data + stop bit
sendPulseDistanceWidthData(KASEIKYO_BIT_MARK, KASEIKYO_ONE_SPACE, KASEIKYO_BIT_MARK, KASEIKYO_ZERO_SPACE, aData,
KASEIKYO_DATA_BITS, PROTOCOL_IS_MSB_FIRST);
KASEIKYO_DATA_BITS, PROTOCOL_IS_MSB_FIRST, SEND_STOP_BIT);
IrReceiver.restartAfterSend();
}

View File

@ -54,7 +54,7 @@
// Bit and repeat timing is like NEC
// LG2 has different header timing and a shorter bit time
/*
* LG remote measurements: Type AKB73315611, Ver1.1 from 2011.03.01
* LG remote IR-LED measurements: Type AKB73315611, Ver1.1 from 2011.03.01
* Internal crystal: 4 MHz
* Header: 8.9 ms mark 4.15 ms space
* Data: 500 / 540 and 500 / 1580;
@ -110,7 +110,7 @@ void IRsend::sendLGRepeat(bool aUseLG2Protocol) {
* There is NO delay after the last sent repeat!
* @param aUseLG2Protocol if true use LG2 protocol, which has a different header
*/
void IRsend::sendLG(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat, bool aUseLG2Protocol) {
void IRsend::sendLG(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialLGRepeat, bool aUseLG2Protocol) {
uint32_t tRawData = ((uint32_t) aAddress << (LG_COMMAND_BITS + LG_CHECKSUM_BITS)) | ((uint32_t) aCommand << LG_CHECKSUM_BITS);
/*
* My guess of the 4 bit checksum
@ -123,18 +123,18 @@ void IRsend::sendLG(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfR
tTempForChecksum >>= 4; // shift by a nibble
}
tRawData |= (tChecksum & 0xF);
sendLGRaw(tRawData, aNumberOfRepeats, aIsRepeat, aUseLG2Protocol);
sendLGRaw(tRawData, aNumberOfRepeats, aSendOnlySpecialLGRepeat, aUseLG2Protocol);
}
void IRsend::sendLG2(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat) {
sendLG(aAddress, aCommand, aNumberOfRepeats, aIsRepeat);
void IRsend::sendLG2(uint8_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialLGRepeat) {
sendLG(aAddress, aCommand, aNumberOfRepeats, aSendOnlySpecialLGRepeat);
}
/*
* Here you can put your raw data, even one with "wrong" checksum
*/
void IRsend::sendLGRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats, bool aIsRepeat, bool aUseLG2Protocol) {
if (aIsRepeat) {
void IRsend::sendLGRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialLGRepeat, bool aUseLG2Protocol) {
if (aSendOnlySpecialLGRepeat) {
sendLGRepeat();
return;
}

View File

@ -105,38 +105,21 @@ void IRsend::sendLegoPowerFunctions(uint8_t aChannel, uint8_t aCommand, uint8_t
}
void IRsend::sendLegoPowerFunctions(uint16_t aRawData, uint8_t aChannel, bool aDoSend5Times) {
enableIROut(38);
IR_DEBUG_PRINT(F("sendLego aRawData=0x"));
IR_DEBUG_PRINTLN(aRawData, HEX);
aChannel &= 0x03; // we have 4 channels
uint_fast8_t tNumberOfCommands = 1;
uint_fast8_t tNumberOfRepeats = 0;
if (aDoSend5Times) {
tNumberOfCommands = 5;
tNumberOfRepeats = 4;
}
// required for repeat timing, see http://www.hackvandedam.nl/blog/?page_id=559
uint8_t tRepeatPeriod = (110 - (LEGO_AVERAGE_DURATION / MICROS_IN_ONE_MILLI)) + (aChannel * 40); // from 100 to 220
uint8_t tRepeatPeriod = (LEGO_AUTO_REPEAT_PERIOD_MIN / MICROS_IN_ONE_MILLI) + (aChannel * 40); // from 110 to 230
while (tNumberOfCommands > 0) {
// Header
mark(LEGO_HEADER_MARK);
space(LEGO_HEADER_SPACE);
sendPulseDistanceWidthData(LEGO_BIT_MARK, LEGO_ONE_SPACE, LEGO_BIT_MARK, LEGO_ZERO_SPACE, aRawData, LEGO_BITS,
PROTOCOL_IS_MSB_FIRST,
SEND_STOP_BIT);
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
// send repeated command with a fixed space gap
delay(tRepeatPeriod);
}
}
IrReceiver.restartAfterSend();
sendPulseDistanceWidth(38, LEGO_HEADER_MARK, LEGO_HEADER_SPACE, LEGO_BIT_MARK, LEGO_ONE_SPACE, LEGO_BIT_MARK, LEGO_ZERO_SPACE,
aRawData, LEGO_BITS, PROTOCOL_IS_MSB_FIRST, SEND_STOP_BIT, tRepeatPeriod, tNumberOfRepeats);
}
/*

View File

@ -37,15 +37,39 @@
#include "IRremoteInt.h" // evaluates the DEBUG for IR_DEBUG_PRINT
#if defined(DEBUG) && !defined(LOCAL_DEBUG)
#define LOCAL_DEBUG
#else
//#define LOCAL_DEBUG // This enables debug output only for this file
#endif
//
//==============================================================================
//
// M A G I Q U E S T
//
//==============================================================================
// MSB first, 8 Start bits (zero), 32 wand id bits, 16 magnitude bits, one stop bit
// Not all start bits must be received, since protocol is MSB first and so the LSB ends up always at the right position.
/*
* https://github.com/kitlaan/Arduino-IRremote/blob/master/ir_Magiquest.cpp
* https://github.com/Arduino-IRremote/Arduino-IRremote/issues/1015#issuecomment-1222247231
-3276750
+ 250,- 800 + 250,- 850 + 250,- 850 + 250,- 850
+ 250,- 850 + 300,- 800 + 250,- 850 + 250,- 850
+ 300,- 800 + 300,- 800 + 550,- 600 + 550,- 650
+ 250,- 850 + 500,- 650 + 500,- 650 + 250,- 850
+ 250,- 850 + 250,- 850 + 500,- 650 + 300,- 800
+ 500,- 650 + 300,- 800 + 550,- 650 + 250,- 850
+ 500,- 650 + 250,- 850 + 500,- 650 + 500,- 650
+ 500,- 650 + 300,- 800 + 300,- 800 + 300,- 850
+ 250,- 850 + 250,- 850 + 250,- 850 + 250,- 850
+ 300,- 800 + 250,- 850 + 500,- 650 + 250,- 850
+ 250,- 850 + 250,- 850 + 250,- 850 + 250,- 850
+ 250,- 850 + 250,- 850 + 250,- 850 + 500,- 700
+ 500,- 650 + 500,- 650 + 500,- 650 + 200,- 900
+ 250,- 850 + 500,- 650 + 300,- 800 + 500
*/
// MSB first, 8 start bits (zero), 32 wand id bits, 16 magnitude bits and no stop bit
#if !defined (DOXYGEN)
// MagiQuest packet is both Wand ID and magnitude of swish and flick
union magiquest_t {
@ -63,11 +87,10 @@ union magiquest_t {
#define MAGIQUEST_WAND_ID_BITS 32 // magiquest_t.cmd.wand_id
#define MAGIQUEST_START_BITS 8 // magiquest_t.cmd.StartBits
#define MAGIQUEST_PERIOD 1150 // Time for a full MagiQuest "bit" (1100 - 1200 usec)
#define MAGIQUEST_PERIOD 1150 // Time for a full MagiQuest "bit" (1100 - 1200 usec)
#define MAGIQUEST_BITS (MAGIQUEST_MAGNITUDE_BITS + MAGIQUEST_WAND_ID_BITS) // 48 Size of the command without the start bits
// The maximum size of a packet is the sum of all 3 expected fields * 2
#define MAGIQUEST_PACKET_SIZE (MAGIQUEST_MAGNITUDE_BITS + MAGIQUEST_WAND_ID_BITS + MAGIQUEST_START_BITS) // 56
#define MAGIQUEST_DATA_BITS (MAGIQUEST_MAGNITUDE_BITS + MAGIQUEST_WAND_ID_BITS) // 48 Size of the command without the start bits
#define MAGIQUEST_BITS (MAGIQUEST_MAGNITUDE_BITS + MAGIQUEST_WAND_ID_BITS + MAGIQUEST_START_BITS) // 56 Size of the command with the start bits
/*
* 0 = 25% mark & 75% space across 1 period
@ -77,11 +100,11 @@ union magiquest_t {
* 1150 * 0.5 = 575 usec mark
* 1150 - 575 = 575 usec space
*/
#define MAGIQUEST_UNIT (MAGIQUEST_PERIOD / 4)
#define MAGIQUEST_UNIT (MAGIQUEST_PERIOD / 4) // 287.5
#define MAGIQUEST_ONE_MARK (2 * MAGIQUEST_UNIT) // 576
#define MAGIQUEST_ONE_SPACE (2 * MAGIQUEST_UNIT) // 576
#define MAGIQUEST_ZERO_MARK MAGIQUEST_UNIT
#define MAGIQUEST_ZERO_MARK MAGIQUEST_UNIT // 287.5
#define MAGIQUEST_ZERO_SPACE (3 * MAGIQUEST_UNIT) // 864
//+=============================================================================
@ -93,16 +116,16 @@ void IRsend::sendMagiQuest(uint32_t wand_id, uint16_t magnitude) {
// 8 start bits
sendPulseDistanceWidthData(
MAGIQUEST_ONE_MARK, MAGIQUEST_ONE_SPACE, MAGIQUEST_ZERO_MARK, MAGIQUEST_ZERO_SPACE, 0, 8, PROTOCOL_IS_MSB_FIRST);
MAGIQUEST_ONE_MARK, MAGIQUEST_ONE_SPACE, MAGIQUEST_ZERO_MARK, MAGIQUEST_ZERO_SPACE, 0, 8, PROTOCOL_IS_MSB_FIRST,
SEND_NO_STOP_BIT);
// Data
sendPulseDistanceWidthData(
MAGIQUEST_ONE_MARK, MAGIQUEST_ONE_SPACE, MAGIQUEST_ZERO_MARK, MAGIQUEST_ZERO_SPACE, wand_id, MAGIQUEST_WAND_ID_BITS,
PROTOCOL_IS_MSB_FIRST);
PROTOCOL_IS_MSB_FIRST, SEND_NO_STOP_BIT);
sendPulseDistanceWidthData(
MAGIQUEST_ONE_MARK, MAGIQUEST_ONE_SPACE, MAGIQUEST_ZERO_MARK, MAGIQUEST_ZERO_SPACE, magnitude, MAGIQUEST_MAGNITUDE_BITS,
PROTOCOL_IS_MSB_FIRST,
SEND_STOP_BIT);
PROTOCOL_IS_MSB_FIRST, SEND_NO_STOP_BIT);
IrReceiver.restartAfterSend();
}
@ -110,71 +133,81 @@ void IRsend::sendMagiQuest(uint32_t wand_id, uint16_t magnitude) {
//
/*
* decodes a 56 bit result, which is not really compatible with standard decoder layout
* magnitude is stored in Command
*/
bool IRrecv::decodeMagiQuest() {
magiquest_t data; // Somewhere to build our code
unsigned int tOffset = 1; // Skip the gap between packets
unsigned int tMark;
unsigned int tSpace;
#if defined(DEBUG)
char bitstring[(MAGIQUEST_PACKET_SIZE + 1)];
bitstring[MAGIQUEST_PACKET_SIZE] = '\0';
#if defined(LOCAL_DEBUG)
char bitstring[(MAGIQUEST_BITS + 1)];
bitstring[MAGIQUEST_BITS] = '\0';
#endif
// Check we have the right amount of data, magnitude and ID bits and at least 2 start bits + 1 stop bit
if (decodedIRData.rawDataPtr->rawlen < (2 * (MAGIQUEST_BITS + 3))
|| decodedIRData.rawDataPtr->rawlen > (2 * (MAGIQUEST_PACKET_SIZE + 1))) {
// Check we have the right amount of data, magnitude and ID bits and 8 start bits + 0 stop bit
if (decodedIRData.rawDataPtr->rawlen != (2 * MAGIQUEST_BITS)) {
IR_DEBUG_PRINT(F("MagiQuest: "));
IR_DEBUG_PRINT(F("Data length="));
IR_DEBUG_PRINT(decodedIRData.rawDataPtr->rawlen);
IR_DEBUG_PRINTLN(F(" is not between 102 and 114"));
IR_DEBUG_PRINTLN(F(" is not 112"));
return false;
}
// Read the bits in
// Decode each bit
data.llword = 0;
while (tOffset < (unsigned int) (decodedIRData.rawDataPtr->rawlen - 1)) {
uint_fast8_t tIndex = 1; // Skip the gap between frames
for (uint_fast8_t i = 0; i < MAGIQUEST_BITS; i++) {
// get one mark and space pair
tMark = decodedIRData.rawDataPtr->rawbuf[tOffset++];
tSpace = decodedIRData.rawDataPtr->rawbuf[tOffset++];
tMark = decodedIRData.rawDataPtr->rawbuf[tIndex++];
tSpace = decodedIRData.rawDataPtr->rawbuf[tIndex++]; // buffer overflow for last bit, but we do not evaluate this value :-)
IR_TRACE_PRINT(F("MagiQuest: mark="));
IR_TRACE_PRINT(tMark * MICROS_PER_TICK);
IR_TRACE_PRINT(F(" space="));
IR_TRACE_PRINTLN(tSpace * MICROS_PER_TICK);
if (matchMark(tSpace + tMark, MAGIQUEST_PERIOD)) {
if (tSpace > tMark) {
// We have no stop bit, so assume that last space, which is not recorded, is correct, since we can not check it
if (i == (MAGIQUEST_BITS - 1) || matchMark(tMark + tSpace, MAGIQUEST_PERIOD)) {
if (matchMark(tMark, MAGIQUEST_ZERO_MARK)) {
// It's a 0
data.llword <<= 1;
#if defined(DEBUG)
bitstring[(tOffset / 2) - 1] = '0';
#if defined(LOCAL_DEBUG)
bitstring[(tIndex / 2) - 1] = '0';
#endif
} else {
// It's a 1
data.llword = (data.llword << 1) | 1;
#if defined(DEBUG)
bitstring[(tOffset / 2) - 1] = '1';
#if defined(LOCAL_DEBUG)
bitstring[(tIndex / 2) - 1] = '1';
#endif
}
} else {
IR_DEBUG_PRINTLN(F("Mark and space does not match the constant MagiQuest period"));
#if defined(LOCAL_DEBUG)
Serial.print(F("Mark and space does not match the constant MagiQuest period. Index="));
Serial.println(i);
// Serial.println(tIndex - 2);
#endif
return false;
}
}
#if defined(DEBUG)
#if defined(LOCAL_DEBUG)
Serial.println(bitstring);
#endif
// Success
decodedIRData.protocol = MAGIQUEST;
decodedIRData.numberOfBits = tOffset / 2;
decodedIRData.flags = IRDATA_FLAGS_EXTRA_INFO | IRDATA_FLAGS_IS_MSB_FIRST;
decodedIRData.extra = data.cmd.magnitude;
decodedIRData.decodedRawData = data.cmd.wand_id;
decodedIRData.numberOfBits = tIndex / 2;
decodedIRData.flags = IRDATA_FLAGS_IS_MSB_FIRST;
decodedIRData.decodedRawData = data.cmd.wand_id; // 32 bit wand_id
decodedIRData.address = data.cmd.wand_id; // lower 16 bit of wand_id
decodedIRData.extra = data.cmd.wand_id << 16; // upper 16 bit of wand_id
decodedIRData.command = data.cmd.magnitude; // seems to be always 205 https://github.com/Arduino-IRremote/Arduino-IRremote/issues/1017
return true;
}
#if defined(LOCAL_DEBUG)
#undef LOCAL_DEBUG
#endif
#endif // _IR_MAGIQUEST_HPP

View File

@ -48,11 +48,20 @@
// N NN E C
// N N EEEEE CCCC
//==============================================================================
// see: https://www.sbprojects.net/knowledge/ir/nec.php
// http://www.hifi-remote.com/wiki/index.php/NEC
// https://www.sbprojects.net/knowledge/ir/nec.php
// for Apple see https://en.wikipedia.org/wiki/Apple_Remote
// ONKYO like NEC but 16 independent command bits
// PIONEER (not implemented) is NEC2 with 40 kHz
// LSB first, 1 start bit + 16 bit address (or 8 bit address and 8 bit inverted address) + 8 bit command + 8 bit inverted command + 1 stop bit.
// Standard NEC send a special fixed repeat frame, but I have a DVD remote, which send the same full frame after the 110 ms.
// Standard NEC (or NEC1) sends a special fixed repeat frame, but I have a DVD remote with NEC2, which send the same full frame after the 110 ms.
// IRP: NEC {38.0k,564}<1,-1|1,-3>(16,-8,D:8,S:8,F:8,~F:8,1,^108m,(16,-4,1,^108m)*) ==> "*" means send special repeat frames o ore more times
// IRP: NEC2 {38.0k,564}<1,-1|1,-3>(16,-8,D:8,S:8,F:8,~F:8,1,^108m)+ ==> "+" means send frame 1 or more times (special repeat is missing here!)
// {38.0k,564} ==> 38.0k -> Frequency , 564 -> unit in microseconds (we use 560), no "msb", so "lsb" is assumed
// <1,-1|1,-3> ==> Zero is 1 unit mark and space | One is 1 unit mark and 3 units space
// 16,-8 ==> Start bit durations
// D:8,S:8,F:8,~F:8 ==> D:8 -> 8 bit bitfield for Device, S:8 -> 8 bit bitfield for Subdevice, F:8 -> 8 bit bitfield for Function, ~F:8 -> 8 bit inverted bitfield for Function
// 1,^108m ==> 1 -> unit mark Stop bit, ^108m -> wait until 108 milliseconds after start of protocol (we use 110)
//
#define NEC_ADDRESS_BITS 16 // 16 bit address or 8 bit address and 8 bit inverted address
#define NEC_COMMAND_BITS 16 // Command and inverted command
@ -60,11 +69,11 @@
#define NEC_BITS (NEC_ADDRESS_BITS + NEC_COMMAND_BITS)
#define NEC_UNIT 560 // 21.28 periods of 38 kHz, 11.2 ticks TICKS_LOW = 8.358 TICKS_HIGH = 15.0
#define NEC_HEADER_MARK (16 * NEC_UNIT) // 9000 / 180
#define NEC_HEADER_SPACE (8 * NEC_UNIT) // 4500 / 90
#define NEC_HEADER_MARK (16 * NEC_UNIT) // 9000 | 180
#define NEC_HEADER_SPACE (8 * NEC_UNIT) // 4500 | 90
#define NEC_BIT_MARK NEC_UNIT
#define NEC_ONE_SPACE (3 * NEC_UNIT) // 1690 / 33.8 TICKS_LOW = 25.07 TICKS_HIGH = 45.0
#define NEC_ONE_SPACE (3 * NEC_UNIT) // 1690 | 33.8 TICKS_LOW = 25.07 TICKS_HIGH = 45.0
#define NEC_ZERO_SPACE NEC_UNIT
#define NEC_REPEAT_HEADER_SPACE (4 * NEC_UNIT) // 2250
@ -95,9 +104,9 @@ void IRsend::sendNECRepeat() {
* Repeat commands should be sent in a 110 ms raster.
* There is NO delay after the last sent repeat!
* https://www.sbprojects.net/knowledge/ir/nec.php
* @param aIsRepeat if true, send only one repeat frame without leading and trailing space
* @param aSendOnlySpecialNECRepeat if true, send only one repeat frame without leading and trailing space
*/
void IRsend::sendNEC(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat) {
void IRsend::sendNEC(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialNECRepeat) {
LongUnion tRawData;
@ -114,15 +123,61 @@ void IRsend::sendNEC(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOf
tRawData.UByte.MidHighByte = aCommand;
tRawData.UByte.HighByte = ~aCommand;
sendNECRaw(tRawData.ULong, aNumberOfRepeats, aIsRepeat);
sendNECRaw(tRawData.ULong, aNumberOfRepeats, aSendOnlySpecialNECRepeat);
}
/*
* Repeat commands should be sent in a 110 ms raster.
* There is NO delay after the last sent repeat!
* @param aIsRepeat if true, send only one repeat frame without leading and trailing space
* @param aSendOnlySpecialNECRepeat if true, send only one repeat frame without leading and trailing space
*/
void IRsend::sendOnkyo(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat) {
void IRsend::sendNEC2(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats) {
LongUnion tRawData;
// Address 16 bit LSB first
if ((aAddress & 0xFF00) == 0) {
// assume 8 bit address -> send 8 address bits and then 8 inverted address bits LSB first
tRawData.UByte.LowByte = aAddress;
tRawData.UByte.MidLowByte = ~tRawData.UByte.LowByte;
} else {
tRawData.UWord.LowWord = aAddress;
}
// send 8 command bits and then 8 inverted command bits LSB first
tRawData.UByte.MidHighByte = aCommand;
tRawData.UByte.HighByte = ~aCommand;
// Set IR carrier frequency
enableIROut(NEC_KHZ);
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
while (tNumberOfCommands > 0) {
// Header
mark(NEC_HEADER_MARK);
space(NEC_HEADER_SPACE);
// LSB first + stop bit
sendPulseDistanceWidthData(NEC_BIT_MARK, NEC_ONE_SPACE, NEC_BIT_MARK, NEC_ZERO_SPACE, tRawData.ULong, NEC_BITS,
PROTOCOL_IS_LSB_FIRST, SEND_STOP_BIT);
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
// send repeated command in a fixed raster
delay(NEC_REPEAT_SPACE / MICROS_IN_ONE_MILLI);
}
}
IrReceiver.restartAfterSend();
}
/*
* Repeat commands should be sent in a 110 ms raster.
* There is NO delay after the last sent repeat!
* @param aSendOnlySpecialNECRepeat if true, send only one repeat frame without leading and trailing space
*/
void IRsend::sendOnkyo(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialNECRepeat) {
LongUnion tRawData;
@ -131,7 +186,7 @@ void IRsend::sendOnkyo(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumbe
// Command 16 bit LSB first
tRawData.UWord.HighWord = aCommand;
sendNECRaw(tRawData.ULong, aNumberOfRepeats, aIsRepeat);
sendNECRaw(tRawData.ULong, aNumberOfRepeats, aSendOnlySpecialNECRepeat);
}
/*
@ -140,9 +195,9 @@ void IRsend::sendOnkyo(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumbe
* https://en.wikipedia.org/wiki/Apple_Remote
* https://gist.github.com/darconeous/4437f79a34e3b6441628
* @param aAddress is the DeviceId*
* @param aIsRepeat if true, send only one repeat frame without leading and trailing space
* @param aSendOnlySpecialNECRepeat if true, send only one repeat frame without leading and trailing space
*/
void IRsend::sendApple(uint8_t aDeviceId, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat) {
void IRsend::sendApple(uint8_t aDeviceId, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialNECRepeat) {
LongUnion tRawData;
@ -153,11 +208,14 @@ void IRsend::sendApple(uint8_t aDeviceId, uint8_t aCommand, uint_fast8_t aNumber
tRawData.UByte.MidHighByte = aCommand;
tRawData.UByte.HighByte = aDeviceId; // e.g. 0xD7
sendNECRaw(tRawData.ULong, aNumberOfRepeats, aIsRepeat);
sendNECRaw(tRawData.ULong, aNumberOfRepeats, aSendOnlySpecialNECRepeat);
}
void IRsend::sendNECRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats, bool aIsRepeat) {
if (aIsRepeat) {
/*
* Sends NEC1 protocol
*/
void IRsend::sendNECRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats, bool aSendOnlySpecialNECRepeat) {
if (aSendOnlySpecialNECRepeat) {
sendNECRepeat();
return;
}
@ -179,14 +237,14 @@ void IRsend::sendNECRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats, bool a
} else {
delay((NEC_REPEAT_PERIOD - NEC_REPEAT_DURATION) / MICROS_IN_ONE_MILLI);
}
// send repeat
// send special NEC repeats
sendNECRepeat();
}
IrReceiver.restartAfterSend();
}
//+=============================================================================
// NECs have a repeat only 4 items long
// NEC1 has a repeat only 4 items long
//
/*
* First check for right data length
@ -289,9 +347,10 @@ bool IRrecv::decodeNEC() {
}
decodedIRData.numberOfBits = NEC_BITS;
// check for special repeat, do not check for same content ;-)
// check for NEC2 repeat, do not check for same content ;-)
if (decodedIRData.rawDataPtr->rawbuf[0] < (NEC_MAXIMUM_REPEAT_SPACE / MICROS_PER_TICK)) {
decodedIRData.flags |= IRDATA_FLAGS_IS_REPEAT | IRDATA_FLAGS_IS_SPECIAL_REPEAT;
decodedIRData.protocol = NEC2;
decodedIRData.flags |= IRDATA_FLAGS_IS_REPEAT;
}
return true;

View File

@ -196,7 +196,7 @@ bool IRrecv::decodeRC5() {
}
// check for repeat
if (decodedIRData.rawDataPtr->rawbuf[0] < (RC5_REPEAT_PERIOD / MICROS_PER_TICK)) {
if (decodedIRData.rawDataPtr->rawbuf[0] < ((RC5_REPEAT_SPACE + (RC5_REPEAT_SPACE / 4)) / MICROS_PER_TICK)) {
decodedIRData.flags |= IRDATA_FLAGS_IS_REPEAT;
}

View File

@ -50,31 +50,36 @@
//==============================================================================
// see http://www.hifi-remote.com/wiki/index.php?title=DecodeIR#Samsung
// https://www.mikrocontroller.net/articles/IRMP_-_english#SAMSUNG32
// LSB first, 1 start bit + 16 bit address + 16,32,20 bit data + 1 stop bit.
// On my Samsung remote they are plain repeats of the complete frame.
// LSB first, 1 start bit + 16 bit address + 16,32 bit data + 1 stop bit.
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:8,~F:8,1,^110)+ ==> 8 bit data
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:16,1,^110)+ ==> 16 bit data
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:32,1,^110)+ ==> 32 bit data
//
#define SAMSUNG_ADDRESS_BITS 16
#define SAMSUNG_COMMAND16_BITS 16
#define SAMSUNG_COMMAND32_BITS 32
#define SAMSUNG_BITS (SAMSUNG_ADDRESS_BITS + SAMSUNG_COMMAND16_BITS)
#define SAMSUNG48_BITS (SAMSUNG_ADDRESS_BITS + SAMSUNG_COMMAND32_BITS)
#define SAMSUNG_UNIT 553 // 21 periods of 38 kHz (552,631) TICKS_LOW = 8.253 TICKS_HIGH = 14.825
#define SAMSUNG_HEADER_MARK (8 * SAMSUNG_UNIT) // 4400
#define SAMSUNG_HEADER_SPACE (8 * SAMSUNG_UNIT) // 4400
// except SAMSUNG_HEADER_MARK, values are like NEC
#define SAMSUNG_UNIT 560 // 21.28 periods of 38 kHz, 11.2 ticks TICKS_LOW = 8.358 TICKS_HIGH = 15.0
#define SAMSUNG_HEADER_MARK (8 * SAMSUNG_UNIT) // 4500 | 180
#define SAMSUNG_HEADER_SPACE (8 * SAMSUNG_UNIT) // 4500
#define SAMSUNG_BIT_MARK SAMSUNG_UNIT
#define SAMSUNG_ONE_SPACE (3 * SAMSUNG_UNIT) // 1650 TICKS_LOW = 24.62 TICKS_HIGH = 42.25
#define SAMSUNG_ONE_SPACE (3 * SAMSUNG_UNIT) // 1690 | 33.8 TICKS_LOW = 25.07 TICKS_HIGH = 45.0
#define SAMSUNG_ZERO_SPACE SAMSUNG_UNIT
#define SAMSUNG_AVERAGE_DURATION 55000 // SAMSUNG_HEADER_MARK + SAMSUNG_HEADER_SPACE + 32 * 2,5 * SAMSUNG_UNIT + SAMSUNG_UNIT // 2.5 because we assume more zeros than ones
#define SAMSUNG_REPEAT_DURATION (SAMSUNG_HEADER_MARK + SAMSUNG_HEADER_SPACE + SAMSUNG_BIT_MARK + SAMSUNG_ZERO_SPACE + SAMSUNG_BIT_MARK)
#define SAMSUNG_REPEAT_PERIOD 110000 // Commands are repeated every 110 ms (measured from start to start) for as long as the key on the remote control is held down.
#define SAMSUNG_REPEAT_SPACE (SAMSUNG_REPEAT_PERIOD - SAMSUNG_AVERAGE_DURATION)
/**
* Send repeat
* Repeat commands should be sent in a 110 ms raster.
* was sent by an LG 6711R1P071A remote
*/
void IRsend::sendSamsungRepeat() {
void IRsend::sendSamsungLGRepeat() {
enableIROut(SAMSUNG_KHZ); // 38 kHz
mark(SAMSUNG_HEADER_MARK);
space(SAMSUNG_HEADER_SPACE);
@ -86,44 +91,24 @@ void IRsend::sendSamsungRepeat() {
void IRsend::sendSamsung(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats) {
// Set IR carrier frequency
enableIROut(SAMSUNG_KHZ);
// send 16 bit address and 8 command bits and then 8 inverted command bits LSB first
LongUnion tData;
tData.UWord.LowWord = aAddress;
tData.UByte.MidHighByte = aCommand;
tData.UByte.HighByte = ~aCommand;
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
while (tNumberOfCommands > 0) {
unsigned long tStartOfFrameMillis = millis();
// Header
mark(SAMSUNG_HEADER_MARK);
space(SAMSUNG_HEADER_SPACE);
// send 16 bit address and 8 command bits and then 8 inverted command bits LSB first
LongUnion tData;
tData.UWord.LowWord = aAddress;
tData.UByte.MidHighByte = aCommand;
tData.UByte.HighByte = ~aCommand;
// Address
sendPulseDistanceWidthData(SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_BIT_MARK, SAMSUNG_ZERO_SPACE, tData.ULong,
SAMSUNG_ADDRESS_BITS + SAMSUNG_COMMAND16_BITS, PROTOCOL_IS_LSB_FIRST, SEND_STOP_BIT);
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
// send repeat in a 110 ms raster
while (millis() - tStartOfFrameMillis < (SAMSUNG_REPEAT_PERIOD / MICROS_IN_ONE_MILLI)) {
delay(1);
}
}
}
IrReceiver.restartAfterSend();
sendPulseDistanceWidth(SAMSUNG_KHZ, SAMSUNG_HEADER_MARK, SAMSUNG_HEADER_SPACE, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE,
SAMSUNG_BIT_MARK, SAMSUNG_ZERO_SPACE, tData.ULong, SAMSUNG_ADDRESS_BITS + SAMSUNG_COMMAND16_BITS, PROTOCOL_IS_LSB_FIRST,
SEND_STOP_BIT, SAMSUNG_REPEAT_PERIOD / MICROS_IN_ONE_MILLI, aNumberOfRepeats);
}
/*
* Sent e.g. by an LG 6711R1P071A remote
*/
void IRsend::sendSamsungLG(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats, bool aIsRepeat) {
if (aIsRepeat) {
sendSamsungRepeat();
void IRsend::sendSamsungLG(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aNumberOfRepeats,
bool aSendOnlySpecialSamsungRepeat) {
if (aSendOnlySpecialSamsungRepeat) {
sendSamsungLGRepeat();
return;
}
@ -151,7 +136,7 @@ void IRsend::sendSamsungLG(uint16_t aAddress, uint16_t aCommand, uint_fast8_t aN
delay((SAMSUNG_REPEAT_PERIOD - SAMSUNG_REPEAT_DURATION) / MICROS_IN_ONE_MILLI);
}
// send repeat
sendSamsungRepeat();
sendSamsungLGRepeat();
}
IrReceiver.restartAfterSend();
}
@ -191,9 +176,9 @@ bool IRrecv::decodeSamsung() {
/*
* Samsung48
*/
// decode address
// decode 16 bit address
if (!decodePulseDistanceData(SAMSUNG_ADDRESS_BITS, 3, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_ZERO_SPACE,
PROTOCOL_IS_LSB_FIRST)) {
PROTOCOL_IS_LSB_FIRST)) {
IR_DEBUG_PRINT(F("Samsung: "));
IR_DEBUG_PRINTLN(F("Decode failed"));
return false;
@ -202,7 +187,7 @@ bool IRrecv::decodeSamsung() {
// decode 32 bit command
if (!decodePulseDistanceData(SAMSUNG_COMMAND32_BITS, 3, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_ZERO_SPACE,
PROTOCOL_IS_LSB_FIRST)) {
PROTOCOL_IS_LSB_FIRST)) {
IR_DEBUG_PRINT(F("Samsung: "));
IR_DEBUG_PRINTLN(F("Decode failed"));
return false;
@ -225,7 +210,7 @@ bool IRrecv::decodeSamsung() {
* Samsung32
*/
if (!decodePulseDistanceData(SAMSUNG_BITS, 3, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_ZERO_SPACE,
PROTOCOL_IS_LSB_FIRST)) {
PROTOCOL_IS_LSB_FIRST)) {
IR_DEBUG_PRINT(F("Samsung: "));
IR_DEBUG_PRINTLN(F("Decode failed"));
return false;
@ -245,7 +230,7 @@ bool IRrecv::decodeSamsung() {
}
// check for repeat
if (decodedIRData.rawDataPtr->rawbuf[0] < (SAMSUNG_REPEAT_PERIOD / MICROS_PER_TICK)) {
if (decodedIRData.rawDataPtr->rawbuf[0] < ((SAMSUNG_REPEAT_SPACE + (SAMSUNG_REPEAT_SPACE / 4)) / MICROS_PER_TICK)) {
decodedIRData.flags |= IRDATA_FLAGS_IS_REPEAT;
}
@ -283,7 +268,7 @@ bool IRrecv::decodeSAMSUNG(decode_results *aResults) {
offset++;
if (!decodePulseDistanceData(SAMSUNG_BITS, offset, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_ZERO_SPACE,
PROTOCOL_IS_MSB_FIRST)) {
PROTOCOL_IS_MSB_FIRST)) {
return false;
}
@ -306,7 +291,7 @@ void IRsend::sendSAMSUNG(unsigned long data, int nbits) {
// Old version with MSB first Data + stop bit
sendPulseDistanceWidthData(SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_BIT_MARK, SAMSUNG_ZERO_SPACE, data, nbits,
PROTOCOL_IS_MSB_FIRST, SEND_STOP_BIT);
PROTOCOL_IS_MSB_FIRST, SEND_STOP_BIT);
IrReceiver.restartAfterSend();
}

View File

@ -45,9 +45,24 @@
// S O O N NN Y
// SSSS OOO N N Y
//==============================================================================
/*
* Protocol=Sony Address=0x4B9 Command=0x7 Raw-Data=0x25C87 20 bits LSB first
+2550,- 400
+1300,- 450 +1350,- 450 +1300,- 450 + 700,- 450
+ 700,- 450 + 750,- 450 + 700,- 400
--13 address bits--
+1300,- 500
+ 700,- 450 + 700,- 450 +1300,- 500 +1300,- 450
+1300,- 450 + 700,- 450 +1350,- 400 + 750,- 450
+ 700,- 450 +1300,- 450 + 700,- 450 + 700
Sum: 31100
*/
// see https://www.sbprojects.net/knowledge/ir/sirc.php
// Here http://picprojects.org.uk/projects/sirc/ it is claimed, that many Sony remotes repeat each frame a minimum of 3 times
// LSB first, start bit + 7 command + 5 to 13 address, no stop bit
// IRP: Sony12 {40k,600}<1,-1|2,-1>(4,-1,F:7,D:5,^45m)+ ==> 40 kHz, Unit is 600, LSB, One mark is 2 units, Start bit is 4 units, 7 bit Function, 5 bit Device, no Stop bit, every 45 milliseconds
// IRP: Sony15 {40k,600}<1,-1|2,-1>(4,-1,F:7,D:8,^45m)+ ==> 8 bit Device
// IRP: Sony20 {40k,600}<1,-1|2,-1>(4,-1,F:7,D:5,S:8,^45m)+ ==> 5 bit Device, 8 bit Subdevice
//
#define SONY_ADDRESS_BITS 5
#define SONY_COMMAND_BITS 7
@ -62,9 +77,10 @@
#define SONY_ZERO_MARK SONY_UNIT
#define SONY_SPACE SONY_UNIT
#define SONY_AVERAGE_DURATION 21000 // SONY_HEADER_MARK + SONY_SPACE + 12 * 2,5 * SONY_UNIT // 2.5 because we assume more zeros than ones
#define SONY_REPEAT_PERIOD 45000 // Commands are repeated every 45 ms (measured from start to start) for as long as the key on the remote control is held down.
#define SONY_REPEAT_SPACE (SONY_REPEAT_PERIOD - SONY_AVERAGE_DURATION) // 24 ms
#define SONY_AVERAGE_DURATION_MIN 21000 // SONY_HEADER_MARK + SONY_SPACE + 12 * 2,5 * SONY_UNIT // 2.5 because we assume more zeros than ones
#define SONY_AVERAGE_DURATION_MAX 33000 // SONY_HEADER_MARK + SONY_SPACE + 20 * 2,5 * SONY_UNIT // 2.5 because we assume more zeros than ones
#define SONY_REPEAT_PERIOD 45000 // Commands are repeated every 45 ms (measured from start to start) for as long as the key on the remote control is held down.
#define SONY_REPEAT_SPACE_MAX (SONY_REPEAT_PERIOD - SONY_AVERAGE_DURATION_MIN) // 24 ms
/*
* Repeat commands should be sent in a 45 ms raster.
@ -72,31 +88,10 @@
* @param numberOfBits if == 20 send 13 address bits otherwise only 5 address bits
*/
void IRsend::sendSony(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumberOfRepeats, uint8_t numberOfBits) {
// Set IR carrier frequency
enableIROut(SONY_KHZ); // 40 kHz
uint_fast8_t tNumberOfCommands = aNumberOfRepeats + 1;
while (tNumberOfCommands > 0) {
// Header
mark(SONY_HEADER_MARK);
space(SONY_SPACE);
// send 7 command bits LSB first
sendPulseDistanceWidthData(SONY_ONE_MARK, SONY_SPACE, SONY_ZERO_MARK, SONY_SPACE, aCommand, SONY_COMMAND_BITS,
PROTOCOL_IS_LSB_FIRST);
// send 5, 8, 13 address bits LSB first
sendPulseDistanceWidthData(SONY_ONE_MARK, SONY_SPACE, SONY_ZERO_MARK, SONY_SPACE, aAddress,
(numberOfBits - SONY_COMMAND_BITS), PROTOCOL_IS_LSB_FIRST);
tNumberOfCommands--;
// skip last delay!
if (tNumberOfCommands > 0) {
// send repeated command in a 45 ms raster
delay(SONY_REPEAT_SPACE / MICROS_IN_ONE_MILLI);
}
}
IrReceiver.restartAfterSend();
uint32_t tData = (uint32_t)aAddress << 7 | aCommand;
// send 5, 8, 13 address bits LSB first
sendPulseDistanceWidth(SONY_KHZ, SONY_HEADER_MARK, SONY_SPACE, SONY_ONE_MARK, SONY_SPACE, SONY_ZERO_MARK, SONY_SPACE, tData,
numberOfBits, PROTOCOL_IS_LSB_FIRST, SEND_NO_STOP_BIT, SONY_REPEAT_PERIOD / MICROS_IN_ONE_MILLI, aNumberOfRepeats);
}
//+=============================================================================
@ -127,7 +122,7 @@ bool IRrecv::decodeSony() {
}
if (!decodePulseWidthData((decodedIRData.rawDataPtr->rawlen - 1) / 2, 3, SONY_ONE_MARK, SONY_ZERO_MARK, SONY_SPACE,
PROTOCOL_IS_LSB_FIRST)) {
PROTOCOL_IS_LSB_FIRST)) {
IR_DEBUG_PRINT(F("Sony: "));
IR_DEBUG_PRINTLN(F("Decode failed"));
return false;
@ -141,7 +136,7 @@ bool IRrecv::decodeSony() {
/*
* Check for repeat
*/
if (decodedIRData.rawDataPtr->rawbuf[0] < (SONY_REPEAT_PERIOD / MICROS_PER_TICK)) {
if (decodedIRData.rawDataPtr->rawbuf[0] < ((SONY_REPEAT_SPACE_MAX + (SONY_REPEAT_SPACE_MAX / 4)) / MICROS_PER_TICK)) {
decodedIRData.flags = IRDATA_FLAGS_IS_REPEAT | IRDATA_FLAGS_IS_LSB_FIRST;
}
decodedIRData.command = tCommand;
@ -222,7 +217,8 @@ void IRsend::sendSony(unsigned long data, int nbits) {
space(SONY_SPACE);
// Old version with MSB first Data
sendPulseDistanceWidthData(SONY_ONE_MARK, SONY_SPACE, SONY_ZERO_MARK, SONY_SPACE, data, nbits, PROTOCOL_IS_MSB_FIRST);
sendPulseDistanceWidthData(SONY_ONE_MARK, SONY_SPACE, SONY_ZERO_MARK, SONY_SPACE, data, nbits, PROTOCOL_IS_MSB_FIRST,
SEND_NO_STOP_BIT);
IrReceiver.restartAfterSend();
}

View File

@ -143,7 +143,7 @@ void IRsend::sendShuzu(uint16_t aAddress, uint8_t aCommand, uint_fast8_t aNumber
// Address (device and subdevice)
sendPulseDistanceWidthData(SHUZU_BIT_MARK, SHUZU_ONE_SPACE, SHUZU_BIT_MARK, SHUZU_ZERO_SPACE, aAddress,
SHUZU_ADDRESS_BITS, PROTOCOL_IS_LSB_FIRST); // false -> LSB first
SHUZU_ADDRESS_BITS, PROTOCOL_IS_LSB_FIRST, SEND_NO_STOP_BIT); // false -> LSB first
// Command + stop bit
sendPulseDistanceWidthData(SHUZU_BIT_MARK, SHUZU_ONE_SPACE, SHUZU_BIT_MARK, SHUZU_ZERO_SPACE, aCommand,

View File

@ -40,8 +40,7 @@ void IRsend::sendWhynter(unsigned long data, int nbits) {
// Data + stop bit
sendPulseDistanceWidthData(WHYNTER_BIT_MARK, WHYNTER_ONE_SPACE, WHYNTER_BIT_MARK, WHYNTER_ZERO_SPACE, data, nbits,
PROTOCOL_IS_MSB_FIRST,
SEND_STOP_BIT);
PROTOCOL_IS_MSB_FIRST, SEND_STOP_BIT);
IrReceiver.restartAfterSend();
}