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
a0fb5247
Commit
a0fb5247
authored
9 years ago
by
Max Horn
Browse files
Options
Downloads
Patches
Plain Diff
Fix warnings
parent
59883d4d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RCSwitch.cpp
+12
-27
12 additions, 27 deletions
RCSwitch.cpp
with
12 additions
and
27 deletions
RCSwitch.cpp
+
12
−
27
View file @
a0fb5247
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include
"RCSwitch.h"
#include
"RCSwitch.h"
#if not defined( RCSwitchDisableReceiving )
#if not defined( RCSwitchDisableReceiving )
unsigned
long
RCSwitch
::
nReceivedValue
=
NULL
;
unsigned
long
RCSwitch
::
nReceivedValue
=
0
;
unsigned
int
RCSwitch
::
nReceivedBitlength
=
0
;
unsigned
int
RCSwitch
::
nReceivedBitlength
=
0
;
unsigned
int
RCSwitch
::
nReceivedDelay
=
0
;
unsigned
int
RCSwitch
::
nReceivedDelay
=
0
;
unsigned
int
RCSwitch
::
nReceivedProtocol
=
0
;
unsigned
int
RCSwitch
::
nReceivedProtocol
=
0
;
...
@@ -50,7 +50,7 @@ RCSwitch::RCSwitch() {
...
@@ -50,7 +50,7 @@ RCSwitch::RCSwitch() {
#if not defined( RCSwitchDisableReceiving )
#if not defined( RCSwitchDisableReceiving )
this
->
nReceiverInterrupt
=
-
1
;
this
->
nReceiverInterrupt
=
-
1
;
this
->
setReceiveTolerance
(
60
);
this
->
setReceiveTolerance
(
60
);
RCSwitch
::
nReceivedValue
=
NULL
;
RCSwitch
::
nReceivedValue
=
0
;
#endif
#endif
}
}
...
@@ -622,8 +622,8 @@ void RCSwitch::enableReceive(int interrupt) {
...
@@ -622,8 +622,8 @@ void RCSwitch::enableReceive(int interrupt) {
void
RCSwitch
::
enableReceive
()
{
void
RCSwitch
::
enableReceive
()
{
if
(
this
->
nReceiverInterrupt
!=
-
1
)
{
if
(
this
->
nReceiverInterrupt
!=
-
1
)
{
RCSwitch
::
nReceivedValue
=
NULL
;
RCSwitch
::
nReceivedValue
=
0
;
RCSwitch
::
nReceivedBitlength
=
NULL
;
RCSwitch
::
nReceivedBitlength
=
0
;
attachInterrupt
(
this
->
nReceiverInterrupt
,
handleInterrupt
,
CHANGE
);
attachInterrupt
(
this
->
nReceiverInterrupt
,
handleInterrupt
,
CHANGE
);
}
}
}
}
...
@@ -637,11 +637,11 @@ void RCSwitch::disableReceive() {
...
@@ -637,11 +637,11 @@ void RCSwitch::disableReceive() {
}
}
bool
RCSwitch
::
available
()
{
bool
RCSwitch
::
available
()
{
return
RCSwitch
::
nReceivedValue
!=
NULL
;
return
RCSwitch
::
nReceivedValue
!=
0
;
}
}
void
RCSwitch
::
resetAvailable
()
{
void
RCSwitch
::
resetAvailable
()
{
RCSwitch
::
nReceivedValue
=
NULL
;
RCSwitch
::
nReceivedValue
=
0
;
}
}
unsigned
long
RCSwitch
::
getReceivedValue
()
{
unsigned
long
RCSwitch
::
getReceivedValue
()
{
...
@@ -673,7 +673,7 @@ bool RCSwitch::receiveProtocol1(unsigned int changeCount){
...
@@ -673,7 +673,7 @@ bool RCSwitch::receiveProtocol1(unsigned int changeCount){
unsigned
long
delay
=
RCSwitch
::
timings
[
0
]
/
31
;
unsigned
long
delay
=
RCSwitch
::
timings
[
0
]
/
31
;
unsigned
long
delayTolerance
=
delay
*
RCSwitch
::
nReceiveTolerance
*
0.01
;
unsigned
long
delayTolerance
=
delay
*
RCSwitch
::
nReceiveTolerance
*
0.01
;
for
(
int
i
=
1
;
i
<
changeCount
;
i
=
i
+
2
)
{
for
(
unsigned
int
i
=
1
;
i
<
changeCount
;
i
=
i
+
2
)
{
if
(
RCSwitch
::
timings
[
i
]
>
delay
-
delayTolerance
&&
RCSwitch
::
timings
[
i
]
<
delay
+
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
>
delay
*
3
-
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
<
delay
*
3
+
delayTolerance
)
{
if
(
RCSwitch
::
timings
[
i
]
>
delay
-
delayTolerance
&&
RCSwitch
::
timings
[
i
]
<
delay
+
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
>
delay
*
3
-
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
<
delay
*
3
+
delayTolerance
)
{
code
=
code
<<
1
;
code
=
code
<<
1
;
...
@@ -694,13 +694,7 @@ bool RCSwitch::receiveProtocol1(unsigned int changeCount){
...
@@ -694,13 +694,7 @@ bool RCSwitch::receiveProtocol1(unsigned int changeCount){
RCSwitch
::
nReceivedProtocol
=
1
;
RCSwitch
::
nReceivedProtocol
=
1
;
}
}
if
(
code
==
0
){
return
code
!=
0
;
return
false
;
}
else
if
(
code
!=
0
){
return
true
;
}
}
}
bool
RCSwitch
::
receiveProtocol2
(
unsigned
int
changeCount
){
bool
RCSwitch
::
receiveProtocol2
(
unsigned
int
changeCount
){
...
@@ -709,7 +703,7 @@ bool RCSwitch::receiveProtocol2(unsigned int changeCount){
...
@@ -709,7 +703,7 @@ bool RCSwitch::receiveProtocol2(unsigned int changeCount){
unsigned
long
delay
=
RCSwitch
::
timings
[
0
]
/
10
;
unsigned
long
delay
=
RCSwitch
::
timings
[
0
]
/
10
;
unsigned
long
delayTolerance
=
delay
*
RCSwitch
::
nReceiveTolerance
*
0.01
;
unsigned
long
delayTolerance
=
delay
*
RCSwitch
::
nReceiveTolerance
*
0.01
;
for
(
int
i
=
1
;
i
<
changeCount
;
i
=
i
+
2
)
{
for
(
unsigned
int
i
=
1
;
i
<
changeCount
;
i
=
i
+
2
)
{
if
(
RCSwitch
::
timings
[
i
]
>
delay
-
delayTolerance
&&
RCSwitch
::
timings
[
i
]
<
delay
+
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
>
delay
*
2
-
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
<
delay
*
2
+
delayTolerance
)
{
if
(
RCSwitch
::
timings
[
i
]
>
delay
-
delayTolerance
&&
RCSwitch
::
timings
[
i
]
<
delay
+
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
>
delay
*
2
-
delayTolerance
&&
RCSwitch
::
timings
[
i
+
1
]
<
delay
*
2
+
delayTolerance
)
{
code
=
code
<<
1
;
code
=
code
<<
1
;
...
@@ -730,12 +724,7 @@ bool RCSwitch::receiveProtocol2(unsigned int changeCount){
...
@@ -730,12 +724,7 @@ bool RCSwitch::receiveProtocol2(unsigned int changeCount){
RCSwitch
::
nReceivedProtocol
=
2
;
RCSwitch
::
nReceivedProtocol
=
2
;
}
}
if
(
code
==
0
){
return
code
!=
0
;
return
false
;
}
else
if
(
code
!=
0
){
return
true
;
}
}
}
/** Protocol 3 is used by BL35P02.
/** Protocol 3 is used by BL35P02.
...
@@ -747,7 +736,7 @@ bool RCSwitch::receiveProtocol3(unsigned int changeCount){
...
@@ -747,7 +736,7 @@ bool RCSwitch::receiveProtocol3(unsigned int changeCount){
unsigned
long
delay
=
RCSwitch
::
timings
[
0
]
/
PROTOCOL3_SYNC_FACTOR
;
unsigned
long
delay
=
RCSwitch
::
timings
[
0
]
/
PROTOCOL3_SYNC_FACTOR
;
unsigned
long
delayTolerance
=
delay
*
RCSwitch
::
nReceiveTolerance
*
0.01
;
unsigned
long
delayTolerance
=
delay
*
RCSwitch
::
nReceiveTolerance
*
0.01
;
for
(
int
i
=
1
;
i
<
changeCount
;
i
=
i
+
2
)
{
for
(
unsigned
int
i
=
1
;
i
<
changeCount
;
i
=
i
+
2
)
{
if
(
RCSwitch
::
timings
[
i
]
>
delay
*
PROTOCOL3_0_HIGH_CYCLES
-
delayTolerance
if
(
RCSwitch
::
timings
[
i
]
>
delay
*
PROTOCOL3_0_HIGH_CYCLES
-
delayTolerance
&&
RCSwitch
::
timings
[
i
]
<
delay
*
PROTOCOL3_0_HIGH_CYCLES
+
delayTolerance
&&
RCSwitch
::
timings
[
i
]
<
delay
*
PROTOCOL3_0_HIGH_CYCLES
+
delayTolerance
...
@@ -774,11 +763,7 @@ bool RCSwitch::receiveProtocol3(unsigned int changeCount){
...
@@ -774,11 +763,7 @@ bool RCSwitch::receiveProtocol3(unsigned int changeCount){
RCSwitch
::
nReceivedProtocol
=
3
;
RCSwitch
::
nReceivedProtocol
=
3
;
}
}
if
(
code
==
0
){
return
code
!=
0
;
return
false
;
}
else
if
(
code
!=
0
){
return
true
;
}
}
}
void
RCSwitch
::
handleInterrupt
()
{
void
RCSwitch
::
handleInterrupt
()
{
...
...
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