Added DECODE_ONKYO, to force 16 bit command and data decoding.

This commit is contained in:
Armin 2023-03-29 02:07:26 +02:00
parent 5bff1adec2
commit a73851300a
7 changed files with 22 additions and 8 deletions

View File

@ -99,6 +99,7 @@ jobs:
sketches-exclude: UnitTest
build-properties: # the flags were put in compiler.cpp.extra_flags
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100 -DIR_SEND_PIN=3 -DSEND_PWM_BY_TIMER
ReceiveDemo: -DDECODE_ONKYO
TinyReceiver: -DUSE_ONKYO_PROTOCOL
TinySender: -DUSE_ONKYO_PROTOCOL
All: -DSEND_PWM_BY_TIMER

View File

@ -4,6 +4,7 @@ See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-I
# 4.2.0
- The old decode function is renamed to decode_old(decode_results *aResults). decode (decode_results *aResults) is only available in IRremote.h and prints a message.
- Added DECODE_ONKYO, to force 16 bit command and data decoding.
## 4.1.2
- Workaround for ESP32 RTOS delay() timing bug influencing the mark() function.

View File

@ -48,6 +48,7 @@
//#define DECODE_KASEIKYO
//#define DECODE_PANASONIC // alias for DECODE_KASEIKYO
//#define DECODE_LG
//#define DECODE_ONKYO // Decodes only Onkyo and not NEC or Apple
//#define DECODE_NEC // Includes Apple and Onkyo
//#define DECODE_SAMSUNG
//#define DECODE_SONY

View File

@ -487,8 +487,8 @@ bool IRrecv::decode() {
return true;
}
#if defined(DECODE_NEC)
IR_TRACE_PRINTLN(F("Attempting NEC decode"));
#if defined(DECODE_NEC) || defined(DECODE_ONKYO)
IR_TRACE_PRINTLN(F("Attempting NEC/Onkyo decode"));
if (decodeNEC()) {
return true;
}
@ -1143,7 +1143,9 @@ void IRrecv::printActiveIRProtocols(Print *aSerial) {
::printActiveIRProtocols(aSerial);
}
void printActiveIRProtocols(Print *aSerial) {
#if defined(DECODE_NEC)
#if defined(DECODE_ONKYO)
aSerial->print(F("Onkyo, "));
#elif defined(DECODE_NEC)
aSerial->print(F("NEC/NEC2/Onkyo/Apple, "));
#endif
#if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)

View File

@ -96,7 +96,7 @@
#if !defined(NO_DECODER) // for sending raw only
# if (!(defined(DECODE_DENON) || defined(DECODE_JVC) || defined(DECODE_KASEIKYO) \
|| defined(DECODE_PANASONIC) || defined(DECODE_LG) || defined(DECODE_NEC) || defined(DECODE_SAMSUNG) \
|| defined(DECODE_PANASONIC) || defined(DECODE_LG) || defined(DECODE_NEC) || defined(DECODE_ONKYO) || defined(DECODE_SAMSUNG) \
|| defined(DECODE_SONY) || defined(DECODE_RC5) || defined(DECODE_RC6) \
|| defined(DECODE_DISTANCE_WIDTH) || defined(DECODE_HASH) || defined(DECODE_BOSEWAVE) \
|| defined(DECODE_LEGO_PF) || defined(DECODE_MAGIQUEST) || defined(DECODE_FAST) || defined(DECODE_WHYNTER)))

View File

@ -72,7 +72,7 @@
// 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 - Fixed address 0x87EE, 8 bit device ID, 7 bit command, 1 bit parity - untested!
// ONKYO like NEC but 16 independent command bits
// ONKYO like NEC but 16 independent address and 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 sends a special fixed repeat frame.
@ -283,6 +283,13 @@ bool IRrecv::decodeNEC() {
LongUnion tValue;
tValue.ULong = decodedIRData.decodedRawData;
decodedIRData.command = tValue.UByte.MidHighByte; // 8 bit
#if defined(DECODE_ONKYO)
// Here only Onkyo protocol -> force 16 bit address and command decoding
decodedIRData.address = tValue.UWord.LowWord; // first 16 bit
decodedIRData.protocol = ONKYO;
decodedIRData.command = tValue.UWord.HighWord; // 16 bit command
#else
// Address
if (tValue.UWord.LowWord == APPLE_ADDRESS) {
/*
@ -310,6 +317,8 @@ bool IRrecv::decodeNEC() {
decodedIRData.command = tValue.UWord.HighWord; // 16 bit command
}
}
#endif
decodedIRData.numberOfBits = NEC_BITS;
// check for NEC2 repeat, do not check for same content ;-)

View File

@ -1376,20 +1376,20 @@ void timerEnableReceiveInterrupt() {
#if !defined(ESP_ARDUINO_VERSION_VAL)
#define ESP_ARDUINO_VERSION_VAL(major, minor, patch) 202
#endif
# if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(2, 0, 2)
#if ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(2, 0, 2)
void timerDisableReceiveInterrupt() {
if (s50usTimer != NULL) {
timerEnd(s50usTimer);
timerDetachInterrupt(s50usTimer);
}
}
# else
#else
void timerDisableReceiveInterrupt() {
if (s50usTimer != NULL) {
timerAlarmDisable (s50usTimer);
}
}
# endif
#endif
// Undefine ISR, because we register/call the plain function IRReceiveTimerInterruptHandler()
# if defined(ISR)