Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rc-switch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
c3pb
rc-switch
Commits
5605db32
Commit
5605db32
authored
9 years ago
by
Robert ter Vehn
Browse files
Options
Downloads
Patches
Plain Diff
Solution for issue #14, reduced the cut-off/ignore time limit between received codes
parent
94d25fce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
RCSwitch.cpp
+7
-3
7 additions, 3 deletions
RCSwitch.cpp
RCSwitch.h
+1
-0
1 addition, 0 deletions
RCSwitch.h
with
8 additions
and
3 deletions
RCSwitch.cpp
+
7
−
3
View file @
5605db32
...
...
@@ -35,6 +35,10 @@ unsigned int RCSwitch::nReceivedBitlength = 0;
unsigned
int
RCSwitch
::
nReceivedDelay
=
0
;
unsigned
int
RCSwitch
::
nReceivedProtocol
=
0
;
int
RCSwitch
::
nReceiveTolerance
=
60
;
unsigned
int
RCSwitch
::
nSeparationLimit
=
4600
;
// 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.
#endif
unsigned
int
RCSwitch
::
timings
[
RCSWITCH_MAX_CHANGES
];
...
...
@@ -362,7 +366,7 @@ char* RCSwitch::getCodeWordC(char sFamily, int nGroup, int nDevice, boolean bSta
*
* @param sGroup Name of the switch group (A..D, resp. a..d)
* @param nDevice Number of the switch itself (1..3)
* @param bStatus Wether to switch on (true) or off (false)
* @param bStatus W
h
ether to switch on (true) or off (false)
*
* @return char[13]
*/
...
...
@@ -788,7 +792,7 @@ void RCSwitch::handleInterrupt() {
long
time
=
micros
();
duration
=
time
-
lastTime
;
if
(
duration
>
5000
&&
duration
>
RCSwitch
::
timings
[
0
]
-
200
&&
duration
<
RCSwitch
::
timings
[
0
]
+
200
)
{
if
(
duration
>
RCSwitch
::
nSeparationLimit
&&
duration
>
RCSwitch
::
timings
[
0
]
-
200
&&
duration
<
RCSwitch
::
timings
[
0
]
+
200
)
{
repeatCount
++
;
changeCount
--
;
if
(
repeatCount
==
2
)
{
...
...
@@ -802,7 +806,7 @@ void RCSwitch::handleInterrupt() {
repeatCount
=
0
;
}
changeCount
=
0
;
}
else
if
(
duration
>
5000
)
{
}
else
if
(
duration
>
RCSwitch
::
nSeparationLimit
)
{
changeCount
=
0
;
}
...
...
This diff is collapsed.
Click to expand it.
RCSwitch.h
+
1
−
0
View file @
5605db32
...
...
@@ -132,6 +132,7 @@ class RCSwitch {
static
unsigned
int
nReceivedBitlength
;
static
unsigned
int
nReceivedDelay
;
static
unsigned
int
nReceivedProtocol
;
static
unsigned
int
nSeparationLimit
;
#endif
/*
* timings[0] contains sync timing, followed by a number of bits
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment