Documentation + improved Samsung

This commit is contained in:
Armin 2024-04-25 21:16:40 +02:00
parent d781c17620
commit 4c4f66c1be
39 changed files with 238 additions and 298 deletions

View File

@ -36,12 +36,13 @@
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || 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 || 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.
// 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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600
# 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 750
# endif
#endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -35,7 +35,7 @@
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#if FLASHEND <= 0x1FFF || (RAMEND <= 0x4FF || RAMSIZE < 0x4FF) // For 8k flash or 512 bytes RAM or less, like ATtiny85, ATtiny167
#if FLASHEND <= 0x1FFF || (defined(RAMEND) && RAMEND <= 0x4FF) || (defined(RAMSIZE) && RAMSIZE < 0x4FF) // For 8k flash or 512 bytes RAM or less, like ATtiny85, ATtiny167
#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
#define EXCLUDE_EXOTIC_PROTOCOLS
#endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -31,6 +31,21 @@
*/
#include <Arduino.h>
/*
* !!! The value of RAW_BUFFER_LENGTH (and some other macros) must be the same in all compile units !!!
* Otherwise you may get warnings like "type 'struct IRData' itself violates the C++ One Definition Rule"
*/
#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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600
# else
#define RAW_BUFFER_LENGTH 750
# endif
#endif
#include "IRremoteExtensionClass.h"
IRExtensionClass::IRExtensionClass(IRrecv *aIrReceiver) {

View File

@ -33,12 +33,13 @@
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || 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 || RAMSIZE < 0x8FF
#define RAW_BUFFER_LENGTH 500 // 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.
// 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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600
# 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 750
# endif
#endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -67,12 +67,13 @@
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || 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 || RAMSIZE < 0x8FF
#define RAW_BUFFER_LENGTH 500 // 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.
// 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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600
# 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 750
# endif
#endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -22,7 +22,7 @@
************************************************************************************
* MIT License
*
* Copyright (c) 2009-2023 Ken Shirriff, Armin Joachimsmeyer
* Copyright (c) 2009-2024 Ken Shirriff, 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
@ -69,11 +69,15 @@
//#define DECODE_WHYNTER
//#define DECODE_FAST
//
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || RAMSIZE < 0x4FF
#define RAW_BUFFER_LENGTH 120
# elif RAMEND <= 0xAFF || RAMSIZE < 0xAFF // 0xAFF for LEONARDO
// 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 120 // 180 is too much here, because we have additional uint8_t rawCode[RAW_BUFFER_LENGTH];
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 400 // 600 is too much here, because we have additional uint8_t rawCode[RAW_BUFFER_LENGTH];
# elif (defined(RAMEND) && RAMEND <= 0xAFF) || (defined(RAMSIZE) && RAMSIZE < 0xAFF)
#define RAW_BUFFER_LENGTH 500 // 750 is too much here, because we have additional uint8_t rawCode[RAW_BUFFER_LENGTH];
# else
#define RAW_BUFFER_LENGTH 750
# endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -56,10 +56,11 @@
#define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance width protocols
//
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || RAMSIZE < 0x4FF
#define RAW_BUFFER_LENGTH 120
# elif RAMEND <= 0xAFF || RAMSIZE < 0xAFF // 0xAFF for LEONARDO
#define RAW_BUFFER_LENGTH 400 // 600 is too much here, because we have additional uint8_t rawCode[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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600
# else
#define RAW_BUFFER_LENGTH 750
# endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -73,14 +73,13 @@
//
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || RAMSIZE < 0x4FF
#define RAW_BUFFER_LENGTH 130 // 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
#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
# elif RAMEND <= 0x8FF || 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.
// 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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600
# 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 750
# endif
#endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -36,12 +36,13 @@
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || 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 || 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.
// 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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 600
# 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 750
# endif
#endif

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -60,6 +60,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
// disableLEDFeedback(); // Disable 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
@ -132,7 +133,7 @@ void loop() {
delay(DELAY_AFTER_SEND);
if (sRepeats == 0) {
#if FLASHEND >= 0x3FFF && (RAMEND >= 0x4FF || RAMSIZE >= 0x4FF) // For 16k flash or more, like ATtiny1604. Code does not fit in program memory of ATtiny85 etc.
#if FLASHEND >= 0x3FFF && ((defined(RAMEND) && RAMEND > 0x6FF) || (defined(RAMSIZE) && RAMSIZE > 0x6FF)) // For 16k flash or more, like ATtiny1604. Code does not fit in program memory of ATtiny85 etc.
/*
* Send constant values only once in this demo
*/
@ -334,7 +335,7 @@ void loop() {
IrSender.sendRC6(sAddress, sCommand, sRepeats, true);
delay(DELAY_AFTER_SEND);
#if FLASHEND >= 0x3FFF && (RAMEND >= 0x4FF || RAMSIZE >= 0x4FF) // For 16k flash or more, like ATtiny1604. Code does not fit in program memory of ATtiny85 etc.
#if FLASHEND >= 0x3FFF && ((defined(RAMEND) && RAMEND > 0x4FF) || (defined(RAMSIZE) && RAMSIZE > 0x4FF)) // For 16k flash or more, like ATtiny1604. Code does not fit in program memory of ATtiny85 etc.
/*
* Next example how to use the IrSender.write function
*/

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -331,12 +331,6 @@ void noTone(uint8_t aPinNumber){
#if !defined (FLASHEND)
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
#endif
#if !defined (RAMEND)
#define RAMEND 0xFFFF // Dummy value for platforms where RAMEND is not defined
#endif
#if !defined (RAMSIZE)
#define RAMSIZE 0xFFFF // Dummy value for platforms where RAMSIZE is not defined
#endif
/*
* Helper macro for getting a macro definition as string

View File

@ -36,12 +36,13 @@
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#if !defined(RAW_BUFFER_LENGTH)
# if RAMEND <= 0x4FF || 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 || RAMSIZE < 0x8FF
#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.
// 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 180
# elif (defined(RAMEND) && RAMEND <= 0x8FF) || (defined(RAMSIZE) && RAMSIZE < 0x8FF)
#define RAW_BUFFER_LENGTH 200 // 600 is too much here, because then variables are overwritten. 500 is OK without Pronto and 200 is OK with Pronto
# else
#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.
#define RAW_BUFFER_LENGTH 750
# endif
#endif
@ -55,6 +56,8 @@
// to compensate for the signal forming of different IR receiver modules. See also IRremote.hpp line 142.
//#define MARK_EXCESS_MICROS 20 // Adapt it to your IR receiver module. 40 is taken for the cheap VS1838 module her, since we have high intensity.
//#define RECORD_GAP_MICROS 12000 // Default is 8000. Activate it for some LG air conditioner protocols.
//#define TRACE // For internal usage
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
@ -80,9 +83,9 @@
#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:88:2
//#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 // always get the complete frame in the receive buffer
#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
@ -137,6 +140,9 @@ void setup() {
Serial.println(F("at pin " STR(IR_RECEIVE_PIN)));
#endif
Serial.println(F("Use ReceiveCompleteCallback"));
Serial.println(F("Receive buffer length is " STR(RAW_BUFFER_LENGTH)));
#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)
@ -279,7 +285,7 @@ void checkReceivedArray(IRRawDataType *aRawDataArrayPointer, uint8_t aArraySize)
/*
* Test callback function
* Has the same functionality as available()
* Has the same functionality as a check with available()
*/
void ReceiveCompleteCallbackHandler() {
sDataJustReceived = true;
@ -287,7 +293,14 @@ void ReceiveCompleteCallbackHandler() {
void checkReceive(uint16_t aSentAddress, uint16_t aSentCommand) {
// wait until signal has received
uint16_t tTimeoutCounter = 1000; // gives 10 seconds timeout
while (!sDataJustReceived) {
delay(10);
if (tTimeoutCounter == 0) {
Serial.println(F("Receive timeout happened"));
break;
}
tTimeoutCounter--;
}
sDataJustReceived = false;
@ -397,12 +410,13 @@ 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.
# 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
*/
Serial.println(F("Send NEC Pronto data with 8 bit address 0x80 and command 0x45 and no repeats"));
Serial.flush();
// This is copied to stack/ram internally
IrSender.sendPronto(F("0000 006D 0022 0000 015E 00AB " /* Pronto header + start bit */
"0017 0015 0017 0015 0017 0017 0015 0017 0017 0015 0017 0015 0017 0015 0017 003F " /* Lower address byte */
"0017 003F 0017 003E 0017 003F 0015 003F 0017 003E 0017 003F 0017 003E 0017 0015 " /* Upper address byte (inverted at 8 bit mode) */
@ -662,15 +676,15 @@ void loop() {
#endif
#if defined(DECODE_SAMSUNG)
Serial.println(F("Send Samsung 8 bit command"));
Serial.println(F("Send Samsung 8 bit command and 8 bit address"));
Serial.flush();
IrSender.sendSamsung(sAddress, sCommand, 0);
checkReceive(sAddress, sCommand);
IrSender.sendSamsung(sAddress & 0xFF, sCommand, 0);
checkReceive(sAddress & 0xFF, sCommand);
delay(DELAY_AFTER_SEND);
Serial.println(F("Send Samsung 16 bit command"));
Serial.println(F("Send Samsung 16 bit command and address"));
Serial.flush();
IrSender.sendSamsung(sAddress, s16BitCommand, 0);
IrSender.sendSamsung16BitAddressAndCommand(sAddress, s16BitCommand, 0);
checkReceive(sAddress, s16BitCommand);
delay(DELAY_AFTER_SEND);
@ -733,7 +747,7 @@ void loop() {
Serial.println(getProtocolString(IRSendData.protocol));
Serial.flush();
IrSender.write(&IRSendData, 0);
checkReceive(IRSendData.address, IRSendData.command);
checkReceive(IRSendData.address & 0xFF, IRSendData.command);
delay(DELAY_AFTER_SEND);
#endif
@ -761,7 +775,8 @@ void loop() {
IrSender.sendBangOlufsen(sAddress & 0x0FF, sCommand, 0);
# if defined(ENABLE_BEO_WITHOUT_FRAME_GAP)
delay((RECORD_GAP_MICROS / 1000) + 1);
Serial.println(F("- ENABLE_BEO_WITHOUT_FRAME_GAP is enabled. PrintRaw and try to decode"));
Serial.println(F("- ENABLE_BEO_WITHOUT_FRAME_GAP is enabled"));
Serial.println(F("- Now print raw data and try to decode it, which must fail!"));
IrReceiver.printIRResultRawFormatted(&Serial, true);
uint8_t tOriginalRawlen = IrReceiver.decodedIRData.rawlen;
IrReceiver.decodedIRData.rawlen = 6;
@ -769,8 +784,11 @@ void loop() {
IrReceiver.decode();
IrReceiver.printIRResultShort(&Serial);
// Remove trailing 6 entries for next decode try
Serial.println(F("- Remove trailing 6 entries for next decode try"));
// Remove trailing 6 entries for second decode try
Serial.println();
Serial.println(
F(
"- Remove trailing 6 entries, which is equivalent to define RECORD_GAP_MICROS < 15000, to enable successful B&O decode"));
IrReceiver.decodedIRData.rawlen = tOriginalRawlen - 6;
for (uint_fast8_t i = 0; i < IrReceiver.decodedIRData.rawlen; ++i) {
IrReceiver.decodedIRData.rawDataPtr->rawbuf[i] = IrReceiver.decodedIRData.rawDataPtr->rawbuf[i + 6];

View File

@ -1,6 +1,8 @@
START ../src/UnitTest.cpp from Feb 22 2023
Using library version 4.1.0
Ready to receive IR signals of protocols: NEC/NEC2/Onkyo/Apple, Panasonic/Kaseikyo, Denon/Sharp, Sony, RC5, RC6, LG, JVC, Samsung, Bang & Olufsen, FAST, Bosewave , MagiQuest, Universal Pulse Distance Width, Hash at pin 2
Use ReceiveCompleteCallback
Receive buffer length is 200
Send IR signals at pin 3
If you connect debug pin 5 to ground, raw data is always printed
Send signal mark duration for 38kHz is 8 us, pulse narrowing correction is 3000 ns, total period is 26 us
@ -436,60 +438,60 @@ rawData[42]:
+1200,- 550 +1200,- 600 +1250,- 600 +1200
Sum: 35350
Send Samsung 8 bit command
Protocol=Samsung Address=0xFFF1 Command=0x76 Raw-Data=0x8976FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x76, <numberOfRepeats>);
Send Samsung 8 bit command and 8 bit address
Protocol=Samsung Address=0xF1 Command=0x76 Raw-Data=0x8976F1F1 32 bits LSB first
Send with: IrSender.sendSamsung(0xF1, 0x76, <numberOfRepeats>);
rawData[68]:
-1039650
+4400,-4450
+ 550,-1700 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,- 550 + 550,-1650 + 600,-1650 + 600,- 550
+ 550,-1650 + 600,-1650 + 550,-1700 + 550,- 550
+ 600,-1650 + 550,- 550 + 600,- 550 + 600,-1600
+ 600,- 550 + 600,- 550 + 550,- 550 + 600,-1650
+ 600
Sum: 68750
-1045200
+4500,-4400
+ 650,-1600 + 650,- 500 + 600,- 500 + 650,- 500
+ 600,-1600 + 650,-1600 + 650,-1600 + 650,-1600
+ 650,-1600 + 600,- 500 + 650,- 500 + 650,- 450
+ 650,-1600 + 650,-1600 + 600,-1650 + 600,-1600
+ 650,- 500 + 600,-1650 + 600,-1600 + 650,- 500
+ 600,-1600 + 650,-1600 + 650,-1600 + 650,- 500
+ 600,-1600 + 650,- 500 + 650,- 450 + 650,-1600
+ 650,- 500 + 600,- 500 + 650,- 500 + 600,-1600
+ 650
Sum: 65600
Send Samsung 16 bit command
Send Samsung 16 bit command and address
Protocol=Samsung Address=0xFFF1 Command=0x9876 Raw-Data=0x9876FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x9876, <numberOfRepeats>);
rawData[68]:
-1056350
+4400,-4400
+ 600,-1650 + 550,- 550 + 600,- 550 + 550,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1600
+ 600,-1650 + 600,-1650 + 600,-1650 + 550,-1650
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,- 500 + 550,-1700 + 600,-1650 + 550,- 550
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,-1650
+ 550,-1650 + 600,- 550 + 600,- 550 + 550,-1650
+ 600
Sum: 68650
-1060350
+4500,-4400
+ 650,-1600 + 600,- 500 + 650,- 500 + 600,- 500
+ 650,-1600 + 650,-1600 + 650,-1600 + 600,-1600
+ 650,-1600 + 650,-1600 + 650,-1600 + 600,-1650
+ 600,-1600 + 600,-1650 + 650,-1600 + 650,-1600
+ 650,- 500 + 600,-1600 + 650,-1600 + 600,- 550
+ 600,-1600 + 650,-1600 + 600,-1650 + 650,- 450
+ 650,- 500 + 600,- 500 + 650,- 500 + 600,-1650
+ 600,-1600 + 600,- 550 + 600,- 500 + 650,-1600
+ 650
Sum: 68950
Send Samsung48 16 bit command
Protocol=Samsung48 Address=0xFFF1 Command=0x9876 Raw-Data=0x6798 48 bits LSB first
Send with: IrSender.sendSamsung48(0xFFF1, 0x9876, <numberOfRepeats>);
rawData[100]:
-1056750
+4450,-4450
+ 600,-1650 + 600,- 500 + 600,- 550 + 550,- 550
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,-1650 + 550,-1700 + 550,-1700 + 550,-1650
+ 600,- 550 + 550,-1700 + 550,-1650 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 600,- 500
+ 600,-1650 + 600,- 500 + 600,- 550 + 600,-1650
+ 550,- 550 + 600,- 550 + 550,- 550 + 550,-1700
+ 600,- 550 + 600,- 500 + 600,- 550 + 600,-1650
+ 550,-1650 + 600,- 550 + 550,- 550 + 600,-1650
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,- 550
+ 550,- 550 + 600,-1650 + 550,-1650 + 600,- 550
+ 550
Sum: 95650
-1060200
+4550,-4350
+ 650,-1600 + 650,- 500 + 600,- 500 + 650,- 500
+ 650,-1600 + 600,-1600 + 650,-1600 + 650,-1600
+ 600,-1600 + 650,-1600 + 650,-1600 + 650,-1600
+ 600,-1600 + 650,-1600 + 650,-1600 + 600,-1600
+ 650,- 500 + 650,-1600 + 650,-1600 + 650,- 500
+ 600,-1600 + 650,-1600 + 650,-1600 + 600,- 500
+ 650,-1600 + 650,- 500 + 600,- 500 + 650,-1600
+ 650,- 500 + 600,- 500 + 650,- 500 + 600,-1650
+ 600,- 500 + 650,- 500 + 600,- 500 + 650,-1600
+ 650,-1600 + 650,- 500 + 600,- 500 + 650,-1600
+ 650,-1600 + 650,-1600 + 600,-1600 + 650,- 500
+ 600,- 500 + 650,-1600 + 650,-1600 + 650,- 450
+ 650
Sum: 95900
Send RC5
Protocol=RC5 Address=0x11 Command=0x36 Raw-Data=0x1476 13 bits MSB first
@ -543,18 +545,18 @@ Send Samsung
Protocol=Samsung Address=0xFFF1 Command=0x9876 Raw-Data=0x9876FFF1 32 bits LSB first
Send with: IrSender.sendSamsung(0xFFF1, 0x9876, <numberOfRepeats>);
rawData[68]:
-1036350
+4450,-4400
+ 550,-1700 + 600,- 550 + 550,- 550 + 600,- 550
+ 550,-1650 + 600,-1650 + 600,-1650 + 550,-1650
+ 550,-1700 + 600,-1650 + 550,-1650 + 600,-1650
+ 600,-1650 + 550,-1650 + 600,-1650 + 600,-1650
+ 550,- 550 + 600,-1650 + 550,-1700 + 550,- 550
+ 600,-1650 + 600,-1650 + 550,-1650 + 600,- 550
+ 550,- 550 + 600,- 550 + 550,- 550 + 600,-1650
+ 550,-1650 + 600,- 550 + 600,- 500 + 600,-1700
+ 550
Sum: 68750
-1039800
+4550,-4400
+ 600,-1600 + 650,- 500 + 600,- 500 + 650,- 500
+ 650,-1600 + 650,-1600 + 600,-1600 + 650,-1600
+ 650,-1600 + 650,-1600 + 600,-1600 + 650,-1600
+ 650,-1600 + 650,-1600 + 600,-1650 + 600,-1600
+ 650,- 500 + 600,-1600 + 650,-1600 + 650,- 500
+ 600,-1650 + 600,-1600 + 650,-1600 + 650,- 500
+ 600,- 500 + 650,- 500 + 600,- 500 + 650,-1600
+ 650,-1600 + 600,- 500 + 650,- 500 + 650,-1600
+ 650
Sum: 69000
Send LG
Protocol=LG Address=0xF1 Command=0x9876 Raw-Data=0xF19876E 28 bits MSB first
@ -594,38 +596,40 @@ rawData[112]:
Sum: 63750
Send Bang&Olufsen
- ENABLE_BEO_WITHOUT_FRAME_GAP is enabled. PrintRaw and try to decode
- ENABLE_BEO_WITHOUT_FRAME_GAP is enabled
- Now print raw data and try to decode it, which must fail!
rawData[112]:
-1049800
+ 300,-2900 + 200,-2850 + 250,-15200 + 300,-2850
+ 250,-9000 + 300,-5900 + 300,-5950 + 250,-5950
+ 250,-2850 + 250,-5950 + 250,-5950 + 250,-9000
+ 300,-2850 + 250,-9050 + 250,-5900 + 300,-5950
+ 250,-2850 + 250,-9000 + 300,-5950 + 250,-2850
+ 250,-12100 + 300,- 800 + 650,- 500 + 650,- 500
-1053350
+ 250,-2850 + 250,-2850 + 250,-15250 + 250,-2850
+ 300,-9000 + 300,-5900 + 300,-5950 + 250,-5950
+ 250,-2850 + 250,-5950 + 250,-5950 + 200,-9050
+ 300,-2850 + 200,-9050 + 250,-6000 + 250,-5950
+ 200,-2900 + 200,-9050 + 250,-6000 + 250,-2850
+ 250,-12100 + 250,- 800 + 650,- 500 + 650,- 500
+ 650,- 500 + 650,- 500 + 650,- 500 + 650,- 500
+ 650,- 500 + 650,- 500 + 650,- 500 + 650,- 500
+ 650,- 500 + 650,- 500 + 650,- 500 + 350,- 800
+ 350,- 800 + 350,- 800 + 650,- 500 + 350,- 800
+ 350,- 800 + 350,- 800 + 650,- 550 + 300,- 800
+ 350,- 800 + 650,- 500 + 650,- 500 + 650,- 500
+ 350,- 800 + 650,- 500 + 650,- 500 + 350,- 850
+ 350,- 800 + 350,- 750 + 650,- 500 + 650,- 500
+ 300,- 850 + 650,- 500 + 650,- 500 + 650
+ 350,- 800 + 650,- 500 + 650,- 550 + 300,- 850
+ 300,- 850 + 350,- 800 + 600,- 550 + 600,- 550
+ 300,- 850 + 600,- 550 + 600,- 550 + 650
Sum: 176100
Protocol=UNKNOWN Hash=0x643E0496 22 bits (incl. gap and start) received
- Remove trailing 6 entries for next decode try
Protocol=UNKNOWN Hash=0x4E0DAC41 22 bits (incl. gap and start) received
- Remove trailing 6 entries, which is equivalent to define RECORD_GAP_MICROS < 15000, to enable successful B&O decode
Protocol=Bang&Olufsen Address=0xF1 Command=0x76 Raw-Data=0xF176 16 bits MSB first
Send with: IrSender.sendBang&Olufsen(0xF1, 0x76, <numberOfRepeats>);
rawData[44]:
-1078450
+ 150,-2850
+ 200,-2900 + 200,-15300 + 200,-2900 + 200,-9100
+ 250,-5950 + 250,-5950 + 250,-5950 + 200,-2900
+ 200,-6000 + 200,-6000 + 200,-9100 + 200,-2900
+ 200,-9100 + 250,-5950 + 250,-5950 + 250,-2850
+ 200,-9100 + 250,-5950 + 250,-2850 + 200,-12200
+ 200
Sum: 136500
-15250
+ 250,-2850
+ 300,-9000 + 300,-5900 + 300,-5950 + 250,-5950
+ 250,-2850 + 250,-5950 + 250,-5950 + 200,-9050
+ 300,-2850 + 200,-9050 + 250,-6000 + 250,-5950
+ 200,-2900 + 200,-9050 + 250,-6000 + 250,-2850
+ 250,-12100 + 250,- 800 + 650,- 500 + 650,- 500
+ 650
Sum: 118700
Send Bosewave with no address and 8 command bits
Protocol=BoseWave Address=0x0 Command=0x76 Raw-Data=0x8976 16 bits LSB first

View File

@ -539,6 +539,7 @@ public:
void sendRC6(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle = true);
void sendSamsungLGRepeat();
void sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);
void sendSamsung16BitAddressAnd8BitCommand(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats);
void sendSamsung16BitAddressAndCommand(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);
void sendSamsung48(uint16_t aAddress, uint32_t aCommand, int_fast8_t aNumberOfRepeats);
void sendSamsungLG(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats);

View File

@ -63,13 +63,15 @@
// It might be that this only happens over IR and not on the datalink protocol
// You can choose to support this or not:
// Alt 1: Mode with gaps between frames
// Set RECORD_GAP_MICROS to at least 16000 to accommodate the unusually long 3. start space
// Can only receive single messages and back to back repeats will result in overflow
// Mode 1: Mode with gaps between frames
// Set RECORD_GAP_MICROS to at least 16000 to accept the unusually long 3. start space
// Can only receive single messages. Back to back repeats will result in overflow
// Alt 2: Break at start mode
// Define ENABLE_BEO_WITHOUT_FRAME_GAP and set RECORD_GAP_MICROS to 13000 to treat the 3. start space as a gap between messages
// The start of a transmission will result in a dummy decode with 0 bits data followed by the actual messages
// Mode 2: Break at start mode
// Define ENABLE_BEO_WITHOUT_FRAME_GAP and set RECORD_GAP_MICROS to less than 15000
// to treat the 3. start space of 15.5 ms as a gap between messages, which makes decoding easier :-).
// The receiving of a transmission will then result in a dummy decode of the first 2 start bits with 0 bits data
// followed by a 15.5 ms gap and a data frame with one start bit (originally sent as 4. start bit).
// If the receiver is not resumed within a ms or so, partial messages will be decoded
// Debug printing in the wrong place is very likely to break reception
// Make sure to check the number of bits to filter dummy and incomplete messages
@ -82,6 +84,7 @@
// Header data with more than 16 bits is stored in decodedIRData.extra
// B&O is a pulse distance protocol, but it has 3 bit values 0, 1 and (equal/repeat) as well as a special start and trailing bit.
//
// MSB first, 4 start bits + 8 to 16? bit address + 8 bit command + 1 special trailing bit + 1 stop bit.
// Address can be longer than 8 bit.
@ -93,12 +96,12 @@
//#define SUPPORT_BEO_DATALINK_TIMING_FOR_DECODE // This also supports headers up to 32 bit. Requires additional 150 bytes program memory.
#if defined(DECODE_BEO)
# if defined(ENABLE_BEO_WITHOUT_FRAME_GAP)
# if RECORD_GAP_MICROS > 13000
#warning If defined ENABLE_BEO_WITHOUT_FRAME_GAP, RECORD_GAP_MICROS must be set to 1300 by "#define RECORD_GAP_MICROS 13000"
# if RECORD_GAP_MICROS > 15000
#warning If defined ENABLE_BEO_WITHOUT_FRAME_GAP, RECORD_GAP_MICROS must be set to <= 15000 by "#define RECORD_GAP_MICROS 13000"
# endif
# else
# if RECORD_GAP_MICROS < 16000
#error If not defined ENABLE_BEO_WITHOUT_FRAME_GAP, RECORD_GAP_MICROS must be set to a value >= 1600 by "#define RECORD_GAP_MICROS 16000"
#error If not defined ENABLE_BEO_WITHOUT_FRAME_GAP, RECORD_GAP_MICROS must be set to a value >= 16000 by "#define RECORD_GAP_MICROS 16000"
# endif
# endif
#endif
@ -313,7 +316,7 @@ bool IRrecv::decodeBangOlufsen() {
#if defined(ENABLE_BEO_WITHOUT_FRAME_GAP)
/*
* Check if we have the AGC part of the first frame in a row
* Check if we have the AGC part of the first frame, i.e. start bit 1 and 2.
*/
if (decodedIRData.rawlen == 6) {
if ((matchMark(decodedIRData.rawDataPtr->rawbuf[3], BEO_IR_MARK)
@ -321,7 +324,7 @@ bool IRrecv::decodeBangOlufsen() {
&& (matchSpace(decodedIRData.rawDataPtr->rawbuf[4], BEO_PULSE_LENGTH_ZERO - BEO_IR_MARK)
|| matchSpace(decodedIRData.rawDataPtr->rawbuf[4], BEO_PULSE_LENGTH_ZERO - BEO_DATALINK_MARK))) {
BEO_TRACE_PRINT(::getProtocolString(BANG_OLUFSEN));
BEO_TRACE_PRINTLN(F("B&O: AGC only part detected"));
BEO_TRACE_PRINTLN(F("B&O: AGC only part (start bits 1 + 2 of 4) detected"));
} else {
return false; // no B&O protocol
}
@ -336,11 +339,11 @@ bool IRrecv::decodeBangOlufsen() {
}
if (matchMark(decodedIRData.rawDataPtr->rawbuf[1], BEO_IR_MARK)) {
#if defined(SUPPORT_BEO_DATALINK_TIMING_FOR_DECODE)
# if defined(SUPPORT_BEO_DATALINK_TIMING_FOR_DECODE)
protocolMarkLength = BEO_IR_MARK;
} else if (matchMark(decodedIRData.rawDataPtr->rawbuf[1], BEO_DATALINK_MARK)) {
protocolMarkLength = BEO_DATALINK_MARK;
#endif
# endif
} else {
BEO_TRACE_PRINT(::getProtocolString(BANG_OLUFSEN));
BEO_TRACE_PRINTLN(F(": mark length is wrong"));
@ -351,7 +354,7 @@ bool IRrecv::decodeBangOlufsen() {
for (uint8_t tRawBufferMarkIndex = 3; tRawBufferMarkIndex < decodedIRData.rawlen; tRawBufferMarkIndex += 2) {
#else
for (uint8_t tRawBufferMarkIndex = 1; tRawBufferMarkIndex < decodedIRData.rawlen; tRawBufferMarkIndex += 2) {
#endif
#endif // defined(ENABLE_BEO_WITHOUT_FRAME_GAP)
uint16_t markLength = decodedIRData.rawDataPtr->rawbuf[tRawBufferMarkIndex];
uint16_t spaceLength = decodedIRData.rawDataPtr->rawbuf[tRawBufferMarkIndex + 1];
@ -380,11 +383,11 @@ bool IRrecv::decodeBangOlufsen() {
} else {
if (tPulseNumber == 3) {
if (matchMark(markLength, BEO_IR_MARK)) {
#if defined(SUPPORT_BEO_DATALINK_TIMING_FOR_DECODE)
# if defined(SUPPORT_BEO_DATALINK_TIMING_FOR_DECODE)
protocolMarkLength = BEO_IR_MARK;
} else if (matchMark(markLength, BEO_DATALINK_MARK)) {
protocolMarkLength = BEO_DATALINK_MARK;
#endif
# endif
} else {
BEO_DEBUG_PRINT(::getProtocolString(BANG_OLUFSEN));
BEO_DEBUG_PRINTLN(F(": 4. (start) mark length is wrong"));
@ -400,7 +403,7 @@ bool IRrecv::decodeBangOlufsen() {
}
}
} else {
#endif
#endif // !defined(ENABLE_BEO_WITHOUT_FRAME_GAP)
/*
* Decode header / data

View File

@ -187,6 +187,9 @@ void IRsend::sendPronto_P(const char *str, int_fast8_t aNumberOfRepeats) {
}
#endif
/*
* Copy flash data to ram buffer in stack
*/
void IRsend::sendPronto(const __FlashStringHelper *str, int_fast8_t aNumberOfRepeats) {
size_t len = strlen_P(reinterpret_cast<const char*>(str));
char work[len + 1];

View File

@ -74,7 +74,9 @@
// Here https://forum.arduino.cc/t/klimaanlage-per-ir-steuern/1051381/10 the address (0xB24D) is also 8 bits and then 8 inverted bits
//
// Here https://github.com/flipperdevices/flipperzero-firmware/blob/master/lib/infrared/encoder_decoder/samsung/infrared_decoder_samsung.c#L18
// Address is 8 bit + same 8 bit if data is 8 bit and ~8 bit.
// Address is 8 bit + same 8 bit if command is 8 bit and ~8 bit.
//
// So we assume 8 bit address, if command is 8 bit and ~8 bit!
//
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:8,~F:8,1,^110)+ ==> 8 bit + 8 bit inverted data - Samsung32
// IRP notation: {38k,5553}<1,-1|1,-3>(8,-8,D:8,S:8,F:16,1,^110)+ ==> 16 bit data - still Samsung32
@ -99,6 +101,7 @@
#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_MAXIMUM_REPEAT_DISTANCE (SAMSUNG_REPEAT_PERIOD + (SAMSUNG_REPEAT_PERIOD / 4)) // 137000 - Just a guess
// 19 byte RAM
struct PulseDistanceWidthProtocolConstants SamsungProtocolConstants = { SAMSUNG, SAMSUNG_KHZ, SAMSUNG_HEADER_MARK,
SAMSUNG_HEADER_SPACE, SAMSUNG_BIT_MARK, SAMSUNG_ONE_SPACE, SAMSUNG_BIT_MARK, SAMSUNG_ZERO_SPACE, PROTOCOL_IS_LSB_FIRST,
(SAMSUNG_REPEAT_PERIOD / MICROS_IN_ONE_MILLI), NULL };
@ -160,17 +163,18 @@ void IRsend::sendSamsungLG(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNu
/**
* Here we send Samsung32
* If we get a command < 0x100, we send command and then ~command
* If we get an address < 0x100, we send address and then address again, this makes it flipper IRDB compatible
* If we get an address < 0x100, we send 8 bit address and then the same 8 bit address again, this makes it flipper IRDB compatible
* !!! Be aware, that this is flexible, but makes it impossible to send e.g. 0x0042 as 16 bit value!!!
* To force send 16 bit address, use: sendSamsung16BitAddressAndCommand().
* @param aNumberOfRepeats If < 0 then only a special repeat frame will be sent
*/
void IRsend::sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) {
LongUnion tSendValue;
if (aAddress < 0x100) {
// This makes it flipper IRDB compatible
// This makes it flipper IRDB compatible:
// https://github.com/flipperdevices/flipperzero-firmware/blob/master/lib/infrared/encoder_decoder/samsung/infrared_decoder_samsung.c#L18
// Duplicate address byte, if data is 8 bit and 8 bit inverted and address is 8bit
// Duplicate address byte, if address is only 8 bit
tSendValue.UBytes[1] = aAddress;
tSendValue.UBytes[0] = aAddress;
} else {
@ -190,6 +194,23 @@ void IRsend::sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumb
sendPulseDistanceWidth(&SamsungProtocolConstants, tSendValue.ULong, SAMSUNG_BITS, aNumberOfRepeats);
}
/**
* Maybe no one needs it in the wild...
* As above, but we are able to send e.g. 0x0042 as 16 bit address
* @param aNumberOfRepeats If < 0 then only a special repeat frame will be sent
*/
void IRsend::sendSamsung16BitAddressAnd8BitCommand(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats) {
LongUnion tSendValue;
// send 16 bit address
tSendValue.UWords[0] = aAddress;
// Send 8 command bits and then 8 inverted command bits LSB first
tSendValue.UBytes[2] = aCommand;
tSendValue.UBytes[3] = ~aCommand;
sendPulseDistanceWidth(&SamsungProtocolConstants, tSendValue.ULong, SAMSUNG_BITS, aNumberOfRepeats);
}
/**
* Maybe no one needs it in the wild...
* As above, but we are able to send e.g. 0x0042 as 16 bit address
@ -205,7 +226,6 @@ void IRsend::sendSamsung16BitAddressAndCommand(uint16_t aAddress, uint16_t aComm
sendPulseDistanceWidth(&SamsungProtocolConstants, tSendValue.ULong, SAMSUNG_BITS, aNumberOfRepeats);
}
/**
* Here we send Samsung48
* We send 2 x (8 bit command and then ~command)
@ -241,6 +261,11 @@ void IRsend::sendSamsung48(uint16_t aAddress, uint32_t aCommand, int_fast8_t aNu
#endif
}
/*
* We cannot decode frames with 8 command bits and then 8 inverted command bits LSB and 16 bit address,
* because in this case we always assume 8 bit address.
* This is, because we did not see 8 bit command and real 16 bit address in the wild.
*/
bool IRrecv::decodeSamsung() {
// Check we have enough data (68). The +4 is for initial gap, start bit mark and space + stop bit mark
@ -322,11 +347,11 @@ bool IRrecv::decodeSamsung() {
* Samsung32
*/
if (tValue.UByte.MidHighByte == (uint8_t)(~tValue.UByte.HighByte)) {
// 8 bit command (and address) protocol
// 8 bit command protocol -> assume 8 bit address
decodedIRData.command = tValue.UByte.MidHighByte; // first 8 bit
decodedIRData.address = tValue.UByte.MidLowByte; // assume LowByte == MidLowByte
decodedIRData.address = tValue.UByte.LowByte; // assume LowByte == MidLowByte
} else {
// 16 bit command protocol
// 16 bit command protocol, address is filled above with the 16 bit value
decodedIRData.command = tValue.UWord.HighWord; // first 16 bit
}
decodedIRData.numberOfBits = SAMSUNG_BITS;