From 86bf05834a9c9df5cd1ba82da062c82dab719e9d Mon Sep 17 00:00:00 2001 From: Luis Carvalho <56938310+LuisMiCa@users.noreply.github.com> Date: Sun, 30 Jan 2022 16:33:28 +0000 Subject: [PATCH] Insert the missing defined() Macro operator It was causing some issues with VSCode IntelliSense --- src/IRsmallDProtocolStructs.h | 10 +++++----- src/IRsmallD_SIRC_basic.h | 6 +++--- src/IRsmallDecoder.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/IRsmallDProtocolStructs.h b/src/IRsmallDProtocolStructs.h index bd93673..cad30bc 100644 --- a/src/IRsmallDProtocolStructs.h +++ b/src/IRsmallDProtocolStructs.h @@ -7,34 +7,34 @@ #ifndef IRsmallD_ProtocolStructs_h #define IRsmallD_ProtocolStructs_h - #if IR_SMALLD_NEC || IR_SMALLD_RC5 || IR_SMALLD_SAMSUNG32 + #if defined(IR_SMALLD_NEC) || defined(IR_SMALLD_RC5) || defined(IR_SMALLD_SAMSUNG32) struct irSmallD_t { uint8_t addr; uint8_t cmd; bool keyHeld; }; - #elif IR_SMALLD_NECx || IR_SMALLD_SAMSUNG + #elif defined(IR_SMALLD_NECx) || defined(IR_SMALLD_SAMSUNG) struct irSmallD_t { uint16_t addr; uint8_t cmd; bool keyHeld; }; - #elif IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15 + #elif defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15) struct irSmallD_t { uint8_t addr; uint8_t cmd; }; - #elif IR_SMALLD_SIRC20 + #elif defined(IR_SMALLD_SIRC20) struct irSmallD_t { uint8_t ext; //extended data uint8_t addr; uint8_t cmd; }; - #elif IR_SMALLD_SIRC + #elif defined(IR_SMALLD_SIRC) struct irSmallD_t { uint8_t ext; uint8_t addr; diff --git a/src/IRsmallD_SIRC_basic.h b/src/IRsmallD_SIRC_basic.h index 6020102..34cd860 100644 --- a/src/IRsmallD_SIRC_basic.h +++ b/src/IRsmallD_SIRC_basic.h @@ -70,7 +70,7 @@ void IRsmallDecoder::irISR() { //executed every time the IR signal goes down (bu static uint8_t bitCount; static unsigned long startTime = -1; //FFFF... static union { //received bits are stored in reversed order (11000101... -> ...10100011) - #if (IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15) + #if defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15) uint16_t all = 0; //Arduino uses Little Endian so, if all=ABCD then in memory it's CDAB (hex format) uint8_t byt[2]; //then we get byt[0]=CD and byt[1]=AB (type punning with a union...) #else //it must be IR_SMALLD_SIRC20 @@ -101,7 +101,7 @@ void IRsmallDecoder::irISR() { //executed every time the IR signal goes down (bu irSignal.all >>= 1; //push a 0 from left to right (will be left at 0 if it's M0) bitCount++; if (duration >= c_M1min) { //it's a bit 1 mark, change Most Significant bit to 1 - #if (IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15) + #if defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15) irSignal.byt[1] |= 0x80; #else //IR_SMALLD_SIRC20 uses 4 bytes irSignal.byt[3] |= 0x80; @@ -112,7 +112,7 @@ void IRsmallDecoder::irISR() { //executed every time the IR signal goes down (bu #if defined(IR_SMALLD_SIRC12) irSignal.all >>= 3; //adjust address in the high byte (SIRC15/20 don't need this) #endif - #if (IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15) + #if defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15) irSignal.byt[0] >>= 1; //adjust command in the low byte _irData.addr = irSignal.byt[1]; //Little-Endian puts high byte in the array's second position _irData.cmd = irSignal.byt[0]; diff --git a/src/IRsmallDecoder.h b/src/IRsmallDecoder.h index f48a95e..bf78da2 100644 --- a/src/IRsmallDecoder.h +++ b/src/IRsmallDecoder.h @@ -46,10 +46,10 @@ // **************************************************************************** // IR_ISR_MODE definition based on protocol: -#if IR_SMALLD_SAMSUNG || IR_SMALLD_SAMSUNG32 +#if defined(IR_SMALLD_SAMSUNG) || defined(IR_SMALLD_SAMSUNG32) #define IR_ISR_MODE FALLING -#elif IR_SMALLD_SIRC12 || IR_SMALLD_SIRC15 || IR_SMALLD_SIRC20 || \ - IR_SMALLD_SIRC || IR_SMALLD_NEC || IR_SMALLD_NECx +#elif defined(IR_SMALLD_SIRC12) || defined(IR_SMALLD_SIRC15) || defined(IR_SMALLD_SIRC20) || \ + defined(IR_SMALLD_SIRC) || defined(IR_SMALLD_NEC) || defined(IR_SMALLD_NECx) #define IR_ISR_MODE RISING #elif IR_SMALLD_RC5 #define IR_ISR_MODE CHANGE @@ -164,7 +164,7 @@ bool IRsmallDecoder::dataAvailable() { // ---------------------------------------------------------------------------- // Conditional inclusion of protocol specific ISR implementations: -#if IR_SMALLD_NEC || IR_SMALLD_NECx +#if defined(IR_SMALLD_NEC) || defined(IR_SMALLD_NECx) #include "IRsmallD_NEC.h" #elif IR_SMALLD_RC5 #include "IRsmallD_RC5.h"