From 83cebe9f7ca48b89d9f8b43c56a28b7f3a508215 Mon Sep 17 00:00:00 2001 From: Valentin Manea Date: Sun, 19 Feb 2017 20:10:32 +0200 Subject: [PATCH] Add support for ClassOhlson Nexa remotes Extend the possible number of changes to 133 and allow a slightly longer syncronization sequence --- RCSwitch.cpp | 16 +++++++++------- RCSwitch.h | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/RCSwitch.cpp b/RCSwitch.cpp index 6389dbb..e1310e5 100644 --- a/RCSwitch.cpp +++ b/RCSwitch.cpp @@ -73,12 +73,13 @@ static const RCSwitch::Protocol proto[] = { #else static const RCSwitch::Protocol PROGMEM proto[] = { #endif - { 350, { 1, 31 }, { 1, 3 }, { 3, 1 }, false }, // protocol 1 - { 650, { 1, 10 }, { 1, 2 }, { 2, 1 }, false }, // protocol 2 - { 100, { 30, 71 }, { 4, 11 }, { 9, 6 }, false }, // protocol 3 - { 380, { 1, 6 }, { 1, 3 }, { 3, 1 }, false }, // protocol 4 - { 500, { 6, 14 }, { 1, 2 }, { 2, 1 }, false }, // protocol 5 - { 450, { 23, 1 }, { 1, 2 }, { 2, 1 }, true } // protocol 6 (HT6P20B) + { 350, { 1, 31 }, { 1, 3 }, { 3, 1 }, false, 0 }, // protocol 1 + { 650, { 1, 10 }, { 1, 2 }, { 2, 1 }, false, 0 }, // protocol 2 + { 100, { 30, 71 }, { 4, 11 }, { 9, 6 }, false, 0 }, // protocol 3 + { 380, { 1, 6 }, { 1, 3 }, { 3, 1 }, false, 0 }, // protocol 4 + { 500, { 6, 14 }, { 1, 2 }, { 2, 1 }, false, 0 }, // protocol 5 + { 450, { 23, 1 }, { 1, 2 }, { 2, 1 }, true, 0 }, // protocol 6 (HT6P20B) + { 220, { 1, 46 }, { 1, 6 }, { 1, 1 }, false, 2 } // protocol 7 (NEXA) }; enum { @@ -625,7 +626,8 @@ bool RECEIVE_ATTR RCSwitch::receiveProtocol(const int p, unsigned int changeCoun * * The 2nd saved duration starts the data */ - const unsigned int firstDataTiming = (pro.invertedSignal) ? (2) : (1); + const unsigned int firstDataTiming = (pro.invertedSignal) ? (2) : (1) + + pro.skipPulses; for (unsigned int i = firstDataTiming; i < changeCount - 1; i += 2) { code <<= 1; diff --git a/RCSwitch.h b/RCSwitch.h index 27e44ec..523f45a 100644 --- a/RCSwitch.h +++ b/RCSwitch.h @@ -58,7 +58,7 @@ // Number of maximum High/Low changes per packet. // We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync -#define RCSWITCH_MAX_CHANGES 67 +#define RCSWITCH_MAX_CHANGES 133 class RCSwitch { @@ -114,6 +114,7 @@ class RCSwitch { HighLow one; /** @brief if true inverts the high and low logic levels in the HighLow structs */ bool invertedSignal; + int skipPulses; }; void setProtocol(Protocol protocol);