удалила лишнее из примеров
This commit is contained in:
1 parent
8a857b5852
commit
c081a527fe
13 files changed
+145
-772
No files matched your search
@@ -33,24 +33,17 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
|
||||
#define IR_SEND_PIN 3
|
||||
|
||||
#if !defined(RAW_BUFFER_LENGTH)
|
||||
// For air condition remotes it requires 600 (maximum for 2k RAM) to 750. Default is 112 if DECODE_MAGIQUEST is enabled, otherwise 100.
|
||||
# if (defined(RAMEND) && RAMEND <= 0x4FF) || (defined(RAMSIZE) && RAMSIZE < 0x4FF)
|
||||
#define RAW_BUFFER_LENGTH 360
|
||||
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
|
||||
#define RAW_BUFFER_LENGTH 400 // 400 is OK with Pronto and 1000 is OK without Pronto. 1200 is too much here, because then variables are overwritten.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
|
||||
//#define EXCLUDE_EXOTIC_PROTOCOLS // Saves around 240 bytes program memory if IrSender.write is used
|
||||
//#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
|
||||
#if FLASHEND <= 0x7FFF // For 32k flash or less, like ATmega328
|
||||
#define NO_LED_FEEDBACK_CODE // Saves 344 bytes program memory
|
||||
#endif
|
||||
|
||||
// MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding,
|
||||
//#define USE_MSB_DECODING_FOR_DISTANCE_DECODER
|
||||
// to compensate for the signal forming of different IR receiver modules. See also IRremote.hpp line 142.
|
||||
@@ -61,33 +54,26 @@
|
||||
//#define TRACE // For internal usage
|
||||
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
|
||||
|
||||
#if FLASHEND >= 0x1FFF // For 8k flash or more, like ATtiny85
|
||||
#define DECODE_DENON // Includes Sharp
|
||||
#define DECODE_KASEIKYO
|
||||
#define DECODE_PANASONIC // alias for DECODE_KASEIKYO
|
||||
#define DECODE_NEC // Includes Apple and Onkyo
|
||||
#endif
|
||||
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
#define DECODE_JVC
|
||||
#define DECODE_RC5
|
||||
#define DECODE_RC6
|
||||
|
||||
#define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance width protocols
|
||||
#define DECODE_HASH // special decoder for all protocols
|
||||
#endif
|
||||
|
||||
#if FLASHEND >= 0x7FFF // For 32k flash or more, like ATmega328
|
||||
#define DECODE_SONY
|
||||
#define DECODE_SAMSUNG
|
||||
#define DECODE_LG
|
||||
|
||||
#define DECODE_BEO // It prevents decoding of SONY (default repeats), which we are not using here.
|
||||
//#define ENABLE_BEO_WITHOUT_FRAME_GAP // !!!For successful unit testing we must see the warning at ir_BangOlufsen.hpp:100:2!!!
|
||||
#if defined(DECODE_BEO)
|
||||
#define RECORD_GAP_MICROS 16000 // Force to get the complete frame including the 3. space of 15 ms in the receive buffer
|
||||
#define BEO_KHZ 38 // We send and receive Bang&Olufsen with 38 kHz here (instead of 455 kHz).
|
||||
#endif
|
||||
|
||||
#define DECODE_BOSEWAVE
|
||||
#define DECODE_MAGIQUEST
|
||||
@@ -95,17 +81,22 @@
|
||||
|
||||
//#define DECODE_WHYNTER
|
||||
//#define DECODE_LEGO_PF
|
||||
|
||||
/*
|
||||
* Helper macro for getting a macro definition as string
|
||||
*/
|
||||
#if !defined(STR_HELPER)
|
||||
#define STR_HELPER(x) #x
|
||||
#define STR(x) STR_HELPER(x)
|
||||
#endif
|
||||
|
||||
//#undef IR_SEND_PIN // enable this, if you need to set send pin programmatically using uint8_t tSendPin below
|
||||
#define IR_SEND_PIN 3
|
||||
#define IR_RECEIVE_PIN 4
|
||||
|
||||
#define BTN_ACTIVE_STATE HIGH
|
||||
|
||||
#include <IRremote.hpp>
|
||||
|
||||
#if defined(APPLICATION_PIN)
|
||||
#define DEBUG_BUTTON_PIN APPLICATION_PIN // if held low, print timing for each received data
|
||||
#else
|
||||
#define DEBUG_BUTTON_PIN 6
|
||||
#endif
|
||||
|
||||
#define DELAY_AFTER_SEND 1000
|
||||
#define DELAY_AFTER_LOOP 5000
|
||||
|
||||
@@ -120,16 +111,12 @@ volatile bool sDataJustReceived = false;
|
||||
void ReceiveCompleteCallbackHandler();
|
||||
|
||||
void setup() {
|
||||
pinMode(DEBUG_BUTTON_PIN, INPUT_PULLUP);
|
||||
pinMode(BTN_BUILTIN, INPUT_PULLUP);
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial.begin(9600);
|
||||
while (!Serial)
|
||||
; // Wait for Serial to become available. Is optimized away for some cores.
|
||||
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|
||||
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_attiny3217)
|
||||
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
|
||||
#endif
|
||||
// Just to know which program is running on my Arduino
|
||||
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
|
||||
|
||||
@@ -139,18 +126,13 @@ void setup() {
|
||||
|
||||
Serial.print(F("Ready to receive IR signals of protocols: "));
|
||||
printActiveIRProtocols(&Serial);
|
||||
#if defined(IR_RECEIVE_PIN_STRING)
|
||||
Serial.println(F("at pin " IR_RECEIVE_PIN_STRING));
|
||||
#else
|
||||
|
||||
Serial.println(F("at pin " STR(IR_RECEIVE_PIN)));
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(LED_BUILTIN) && !defined(NO_LED_FEEDBACK_CODE)
|
||||
# if defined(FEEDBACK_LED_IS_ACTIVE_LOW)
|
||||
Serial.print(F("Active low "));
|
||||
# endif
|
||||
Serial.print(F("FeedbackLED at pin "));
|
||||
Serial.println(LED_BUILTIN); // Works also for ESP32: static const uint8_t LED_BUILTIN = 8; #define LED_BUILTIN LED_BUILTIN
|
||||
Serial.println(LED_BUILTIN);
|
||||
#endif
|
||||
|
||||
Serial.println(F("Use ReceiveCompleteCallback"));
|
||||
@@ -158,11 +140,7 @@ void setup() {
|
||||
|
||||
#if defined(IR_SEND_PIN)
|
||||
IrSender.begin(); // Start with IR_SEND_PIN -which is defined in PinDefinitionsAndMore.h- as send pin and enable feedback LED at default feedback LED pin
|
||||
# if defined(IR_SEND_PIN_STRING)
|
||||
Serial.println(F("Send IR signals at pin " IR_SEND_PIN_STRING));
|
||||
# else
|
||||
Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
|
||||
# endif
|
||||
#else
|
||||
// Here the macro IR_SEND_PIN is not defined or undefined above with #undef IR_SEND_PIN
|
||||
uint8_t tSendPin = 3;
|
||||
@@ -173,16 +151,10 @@ void setup() {
|
||||
Serial.println(tSendPin);
|
||||
#endif
|
||||
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
Serial.print(F("If you connect debug pin "));
|
||||
# if defined(APPLICATION_PIN_STRING)
|
||||
Serial.print(APPLICATION_PIN_STRING);
|
||||
# else
|
||||
Serial.print(DEBUG_BUTTON_PIN);
|
||||
# endif
|
||||
Serial.println(F(" to ground, raw data is always printed"));
|
||||
Serial.print(F("If you press button "));
|
||||
Serial.print(BTN_BUILTIN);
|
||||
Serial.println(F(" raw data is always printed"));
|
||||
|
||||
// For esp32 we use PWM generation by ledcWrite() for each pin.
|
||||
# if !defined(SEND_PWM_BY_TIMER)
|
||||
/*
|
||||
* Print internal software PWM generation info
|
||||
@@ -202,7 +174,7 @@ void setup() {
|
||||
Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
|
||||
Serial.print(MARK_EXCESS_MICROS);
|
||||
Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
|
||||
#endif
|
||||
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
}
|
||||
@@ -214,33 +186,20 @@ void checkReceivedRawData(IRRawDataType aRawData) {
|
||||
sDataJustReceived = false;
|
||||
|
||||
if (IrReceiver.decode()) {
|
||||
// Print a short summary of received data
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
// Print a short summary of received data
|
||||
IrReceiver.printIRResultShort(&Serial);
|
||||
IrReceiver.printIRSendUsage(&Serial);
|
||||
#else
|
||||
IrReceiver.printIRResultMinimal(&Serial);
|
||||
#endif
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
|
||||
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(BTN_BUILTIN) == BTN_ACTIVE_STATE) {
|
||||
// We have an unknown protocol, print more info
|
||||
IrReceiver.printIRResultRawFormatted(&Serial, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (IrReceiver.decodedIRData.protocol == PULSE_DISTANCE || IrReceiver.decodedIRData.protocol == PULSE_WIDTH) {
|
||||
if (IrReceiver.decodedIRData.decodedRawData != aRawData) {
|
||||
Serial.print(F("ERROR: Received data=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
Serial.print(F(" != sent data=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(aRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, aRawData, HEX);
|
||||
#endif
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
@@ -259,29 +218,20 @@ void checkReceivedArray(IRRawDataType *aRawDataArrayPointer, uint8_t aArraySize)
|
||||
sDataJustReceived = false;
|
||||
|
||||
if (IrReceiver.decode()) {
|
||||
// Print a short summary of received data
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
// Print a short summary of received data
|
||||
IrReceiver.printIRResultShort(&Serial);
|
||||
IrReceiver.printIRSendUsage(&Serial);
|
||||
#else
|
||||
IrReceiver.printIRResultMinimal(&Serial);
|
||||
#endif
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
|
||||
|
||||
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(BTN_BUILTIN) == BTN_ACTIVE_STATE) {
|
||||
// We have an unknown protocol, print more info
|
||||
IrReceiver.printIRResultRawFormatted(&Serial, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (IrReceiver.decodedIRData.protocol == PULSE_DISTANCE || IrReceiver.decodedIRData.protocol == PULSE_WIDTH) {
|
||||
for (uint_fast8_t i = 0; i < aArraySize; ++i) {
|
||||
if (IrReceiver.decodedIRData.decodedRawDataArray[i] != *aRawDataArrayPointer) {
|
||||
Serial.print(F("ERROR: Received data=0x"));
|
||||
# if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawDataArray[i], HEX);
|
||||
# else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawDataArray[i], HEX);
|
||||
# endif
|
||||
Serial.print(F(" != sent data=0x"));
|
||||
Serial.println(*aRawDataArrayPointer, HEX);
|
||||
}
|
||||
@@ -318,25 +268,19 @@ void checkReceive(uint16_t aSentAddress, uint16_t aSentCommand) {
|
||||
sDataJustReceived = false;
|
||||
|
||||
if (IrReceiver.decode()) {
|
||||
// Print a short summary of received data
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
// Print a short summary of received data
|
||||
IrReceiver.printIRResultShort(&Serial);
|
||||
IrReceiver.printIRSendUsage(&Serial);
|
||||
#else
|
||||
IrReceiver.printIRResultMinimal(&Serial);
|
||||
#endif
|
||||
|
||||
if (IrReceiver.decodedIRData.flags & IRDATA_FLAGS_WAS_OVERFLOW) {
|
||||
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
|
||||
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {
|
||||
if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(BTN_BUILTIN) == BTN_ACTIVE_STATE) {
|
||||
// We have an unknown protocol, print more info
|
||||
IrReceiver.printIRResultRawFormatted(&Serial, true);
|
||||
}
|
||||
#endif
|
||||
IrReceiver.resume(); // Early resume
|
||||
|
||||
if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
|
||||
@@ -405,7 +349,7 @@ void loop() {
|
||||
* Complete NEC frames as repeats to force decoding as NEC2 are tested here
|
||||
*/
|
||||
for (int8_t i = 0; i < sRepeats; i++) {
|
||||
if (digitalRead(DEBUG_BUTTON_PIN) != LOW) {
|
||||
if (digitalRead(BTN_BUILTIN) != BTN_ACTIVE_STATE) {
|
||||
// If debug is enabled, printing time (50 ms) is sufficient as delay
|
||||
delayMicroseconds(NEC_REPEAT_DISTANCE - 20000); // 20000 is just a guess
|
||||
}
|
||||
@@ -427,10 +371,7 @@ void loop() {
|
||||
checkReceive(sAddress, sCommand);
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
#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 && ((defined(RAMEND) && RAMEND <= 0x6FF) || (defined(RAMSIZE) && RAMSIZE < 0x6FF)) // 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
|
||||
*/
|
||||
@@ -480,21 +421,12 @@ void loop() {
|
||||
IrSender.sendNECMSB(0x40802CD3, 32, false);
|
||||
checkReceive(0x0102, 0x34);
|
||||
delay(DELAY_AFTER_SEND);
|
||||
# endif
|
||||
|
||||
# if __INT_WIDTH__ < 32
|
||||
IRRawDataType tRawData[4] = { 0xB02002, 0xA010, 0x0, 0x0 }; // LSB of tRawData[0] is sent first
|
||||
# endif
|
||||
# if defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
|
||||
Serial.println(F("Send Panasonic 0xB, 0x10 as 48 bit PulseDistance using ProtocolConstants"));
|
||||
Serial.flush();
|
||||
# if __INT_WIDTH__ < 32
|
||||
IrSender.sendPulseDistanceWidthFromArray(&KaseikyoProtocolConstants, &tRawData[0], 48, NO_REPEATS); // Panasonic is a Kaseikyo variant
|
||||
checkReceive(0x0B, 0x10);
|
||||
# else
|
||||
IrSender.sendPulseDistanceWidth(&KaseikyoProtocolConstants, 0xA010B02002, 48, NO_REPEATS); // Panasonic is a Kaseikyo variant
|
||||
checkReceivedRawData(0xA010B02002);
|
||||
# endif
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
/*
|
||||
@@ -503,30 +435,16 @@ void loop() {
|
||||
Serial.println(F("Send Panasonic 0xB, 0x10 as 48 bit PulseDistance"));
|
||||
Serial.println(F("-LSB first"));
|
||||
Serial.flush();
|
||||
# if __INT_WIDTH__ < 32
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, PROTOCOL_IS_LSB_FIRST, 0,
|
||||
NO_REPEATS);
|
||||
checkReceive(0x0B, 0x10);
|
||||
# else
|
||||
IrSender.sendPulseDistanceWidth(38, 3450, 1700, 450, 1250, 450, 400, 0xA010B02002, 48, PROTOCOL_IS_LSB_FIRST, 0,
|
||||
NO_REPEATS);
|
||||
checkReceivedRawData(0xA010B02002);
|
||||
# endif
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
// The same with MSB first. Use bit reversed raw data of LSB first part
|
||||
Serial.println(F("-MSB first"));
|
||||
# if __INT_WIDTH__ < 32
|
||||
tRawData[0] = 0x40040D00; // MSB of tRawData[0] is sent first
|
||||
tRawData[1] = 0x805;
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 3450, 1700, 450, 1250, 450, 400, &tRawData[0], 48, PROTOCOL_IS_MSB_FIRST, 0,
|
||||
NO_REPEATS);
|
||||
checkReceive(0x0B, 0x10);
|
||||
# else
|
||||
IrSender.sendPulseDistanceWidth(38, 3450, 1700, 450, 1250, 450, 400, 0x40040D000805, 48, PROTOCOL_IS_MSB_FIRST, 0,
|
||||
NO_REPEATS);
|
||||
checkReceivedRawData(0x40040D000805);
|
||||
# endif
|
||||
|
||||
delay(DELAY_AFTER_SEND);
|
||||
# endif // defined(DECODE_PANASONIC) || defined(DECODE_KASEIKYO)
|
||||
@@ -535,28 +453,15 @@ void loop() {
|
||||
# if defined(USE_MSB_DECODING_FOR_DISTANCE_DECODER)
|
||||
Serial.println(F("Send 52 bit PulseDistance 0x43D8613C and 0x3BC3B MSB first"));
|
||||
Serial.flush();
|
||||
# if __INT_WIDTH__ < 32
|
||||
tRawData[0] = 0x43D8613C; // MSB of tRawData[0] is sent first
|
||||
tRawData[1] = 0x3BC3B;
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 52, PROTOCOL_IS_MSB_FIRST, 0,
|
||||
NO_REPEATS);
|
||||
checkReceivedArray(tRawData, 2);
|
||||
# else
|
||||
IrSender.sendPulseDistanceWidth(38, 8900, 4450, 550, 1700, 550, 600, 0x43D8613CBC3B, 52, PROTOCOL_IS_MSB_FIRST, 0, NO_REPEATS);
|
||||
checkReceivedRawData(0x43D8613CBC3B);
|
||||
# endif
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
Serial.println(F("Send 52 bit PulseDistanceWidth 0x43D8613C and 0x3BC3B MSB first"));
|
||||
Serial.flush();
|
||||
// Real PulseDistanceWidth (constant bit length) does not require a stop bit
|
||||
# if __INT_WIDTH__ < 32
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 300, 600, 600, 300, 300, 600, &tRawData[0], 52, PROTOCOL_IS_MSB_FIRST, 0, 0);
|
||||
checkReceivedArray(tRawData, 2);
|
||||
# else
|
||||
IrSender.sendPulseDistanceWidth(38, 300, 600, 600, 300, 300, 600, 0x123456789ABC, 52, PROTOCOL_IS_MSB_FIRST, 0, 0);
|
||||
checkReceivedRawData(0x123456789ABC);
|
||||
# endif
|
||||
delay(DELAY_AFTER_SEND);
|
||||
Serial.println(F("Send 32 bit PulseWidth 0x43D8613C MSB first"));
|
||||
Serial.flush();
|
||||
@@ -568,45 +473,23 @@ void loop() {
|
||||
# else // defined(USE_MSB_DECODING_FOR_DISTANCE_DECODER)
|
||||
Serial.println(F("Send 72 bit PulseDistance 0x5A AFEDCBA9 87654321 LSB first"));
|
||||
Serial.flush();
|
||||
# if __INT_WIDTH__ < 32
|
||||
tRawData[0] = 0x87654321; // LSB of tRawData[0] is sent first
|
||||
tRawData[1] = 0xAFEDCBA9;
|
||||
tRawData[2] = 0x5A;
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 72, PROTOCOL_IS_LSB_FIRST, 0,
|
||||
NO_REPEATS);
|
||||
checkReceivedArray(tRawData, 3);
|
||||
# else
|
||||
IRRawDataType tRawData[] = { 0xAFEDCBA987654321, 0x5A }; // LSB of tRawData[0] is sent first
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 8900, 4450, 550, 1700, 550, 600, &tRawData[0], 72, PROTOCOL_IS_LSB_FIRST, 0,
|
||||
NO_REPEATS);
|
||||
checkReceivedArray(tRawData, 2);
|
||||
# endif
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
Serial.println(F("Send 52 bit PulseDistanceWidth 0xDCBA9 87654321 LSB first"));
|
||||
Serial.flush();
|
||||
// Real PulseDistanceWidth (constant bit length) does theoretically not require a stop bit, but we know the stop bit from serial transmission
|
||||
# if __INT_WIDTH__ < 32
|
||||
tRawData[1] = 0xDCBA9;
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 300, 600, 300, 600, 600, 300, &tRawData[0], 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
|
||||
checkReceivedArray(tRawData, 2);
|
||||
# else
|
||||
IrSender.sendPulseDistanceWidth(38, 300, 600, 300, 600, 600, 300, 0xDCBA987654321, 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
|
||||
checkReceivedRawData(0xDCBA987654321);
|
||||
# endif
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
Serial.println(F("Send 52 bit PulseDistanceWidth 0xDCBA9 87654321 LSB first with inverse timing and data"));
|
||||
Serial.flush();
|
||||
# if __INT_WIDTH__ < 32
|
||||
tRawData[2] = ~tRawData[0];
|
||||
tRawData[3] = ~tRawData[1];
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 300, 600, 600, 300, 300, 600, &tRawData[2], 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
|
||||
checkReceivedArray(tRawData, 2);
|
||||
# else
|
||||
IrSender.sendPulseDistanceWidth(38, 300, 600, 600, 300, 300, 600, ~0xDCBA987654321, 52, PROTOCOL_IS_LSB_FIRST, 0, 0);
|
||||
checkReceivedRawData(0xDCBA987654321);
|
||||
# endif
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
Serial.println(F("Send 7 bit ASCII character with PulseDistanceWidth LSB first"));
|
||||
@@ -635,23 +518,12 @@ void loop() {
|
||||
# if defined(DECODE_MAGIQUEST)
|
||||
Serial.println(F("Send MagiQuest 0x6BCDFF00, 0x176 as 55 bit PulseDistanceWidth MSB first"));
|
||||
Serial.flush();
|
||||
# if __INT_WIDTH__ < 32
|
||||
tRawData[0] = 0x01AF37FC; // We have 1 header (start) bit and 7 start bits and 31 address bits for MagiQuest, so 0x6BCDFF00 is shifted 2 left
|
||||
tRawData[1] = 0x017619; // We send only 23 bits here! 0x19 is the checksum
|
||||
IrSender.sendPulseDistanceWidthFromArray(38, 287, 864, 576, 576, 287, 864, &tRawData[0], 55,
|
||||
PROTOCOL_IS_MSB_FIRST | SUPPRESS_STOP_BIT, 0, 0);
|
||||
# else
|
||||
// 0xD79BFE00 is 0x6BCDFF00 is shifted 1 left
|
||||
IrSender.sendPulseDistanceWidth(38, 287, 864, 576, 576, 287, 864, 0xD79BFE017619, 55, PROTOCOL_IS_MSB_FIRST, 0, 0);
|
||||
# endif
|
||||
checkReceive(0xFF00, 0x176);
|
||||
if (IrReceiver.decodedIRData.decodedRawData != 0x6BCDFF00) {
|
||||
Serial.print(F("ERROR: Received address=0x"));
|
||||
#if (__INT_WIDTH__ < 32)
|
||||
Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#else
|
||||
PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
|
||||
#endif
|
||||
Serial.println(F(" != sent address=0x6BCDFF00"));
|
||||
Serial.println();
|
||||
}
|
||||
@@ -659,7 +531,6 @@ void loop() {
|
||||
# endif // defined(DECODE_MAGIQUEST)
|
||||
|
||||
}
|
||||
#endif // if FLASHEND >= 0x3FFF
|
||||
|
||||
Serial.println(F("Send Onkyo (NEC with 16 bit command)"));
|
||||
Serial.flush();
|
||||
|
||||
Reference in new issue
Block a user