Skip to content

Commit

Permalink
Add a macro for nSeparationLimit and restore previous value to avoid …
Browse files Browse the repository at this point in the history
…regressions (#7)

see 1technophile/OpenMQTTGateway#1108
DIGOO SD10 will need to be configured manually through RCSWITCH_SEPARATION_LIMIT
1technophile authored Dec 20, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6fdb7ea commit 98537e9
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/RCSwitch.cpp
Original file line number Diff line number Diff line change
@@ -150,7 +150,7 @@ static const RCSwitch::Protocol PROGMEM proto[] = {
{ 400, 0, { 0, 0 }, 1, { 1, 1 }, { 1, 2 }, { 2, 1 }, false, 43 }, // 31 (Mertik Maxitrol G6R-H4T1)
{ 365, 0, { 0, 0 }, 1, { 18, 1 }, { 3, 1 }, { 1, 3 }, true, 0 }, // 32 (1ByOne Doorbell) from @Fatbeard https://github.com/sui77/rc-switch/pull/277
{ 340, 0, { 0, 0 }, 1, { 14, 4 }, { 1, 2 }, { 2, 1 }, false, 0 }, // 33 (Dooya Control DC2708L)
{ 120, 0, { 0, 0 }, 1, { 1, 28 }, { 1, 3 }, { 3, 1 }, false, 0 } // 34 DIGOO SD10
{ 120, 0, { 0, 0 }, 1, { 1, 28 }, { 1, 3 }, { 3, 1 }, false, 0 } // 34 DIGOO SD10 - so as to use this protocol RCSWITCH_SEPARATION_LIMIT must be set to 2600
};

enum {
@@ -163,11 +163,7 @@ volatile unsigned int RCSwitch::nReceivedBitlength = 0;
volatile unsigned int RCSwitch::nReceivedDelay = 0;
volatile unsigned int RCSwitch::nReceivedProtocol = 0;
int RCSwitch::nReceiveTolerance = 60;
const unsigned int VAR_ISR_ATTR RCSwitch::nSeparationLimit = 2600; // 4300 default
// separationLimit: minimum microseconds between received codes, closer codes are ignored.
// according to discussion on issue #14 it might be more suitable to set the separation
// limit to the same time as the 'low' part of the sync signal for the current protocol.
// should be set to the minimum value of pulselength * the sync signal
const unsigned int VAR_ISR_ATTR RCSwitch::nSeparationLimit = RCSWITCH_SEPARATION_LIMIT;
unsigned int RCSwitch::timings[RCSWITCH_MAX_CHANGES];
unsigned int RCSwitch::buftimings[4];
#endif
7 changes: 6 additions & 1 deletion src/RCSwitch.h
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@

#include <stdint.h>


// At least for the ATTiny X4/X5, receiving has to be disabled due to
// missing libm depencies (udivmodhi4)
#if defined( __AVR_ATtinyX5__ ) or defined ( __AVR_ATtinyX4__ )
@@ -61,6 +60,12 @@
// Для keeloq нужно увеличить RCSWITCH_MAX_CHANGES до 23+1+66*2+1=157
#define RCSWITCH_MAX_CHANGES 67 // default 67

// separationLimit: minimum microseconds between received codes, closer codes are ignored.
// according to discussion on issue #14 it might be more suitable to set the separation
// limit to the same time as the 'low' part of the sync signal for the current protocol.
// should be set to the minimum value of pulselength * the sync signal
#define RCSWITCH_SEPARATION_LIMIT 4100

class RCSwitch {

public:

0 comments on commit 98537e9

Please sign in to comment.