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
90d00c1c
Commit
90d00c1c
authored
8 years ago
by
Max Horn
Browse files
Options
Downloads
Patches
Plain Diff
Fix ESP8266 crashes with receiver enabled
This should fix #46
parent
43db1b27
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RCSwitch.cpp
+19
-3
19 additions, 3 deletions
RCSwitch.cpp
with
19 additions
and
3 deletions
RCSwitch.cpp
+
19
−
3
View file @
90d00c1c
...
@@ -40,6 +40,15 @@
...
@@ -40,6 +40,15 @@
#define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
#define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
#endif
#endif
#ifdef ESP8266
// interrupt handler and related code must be in RAM on ESP8266,
// according to issue #46.
#define RECEIVE_ATTR ICACHE_RAM_ATTR
#else
#define RECEIVE_ATTR
#endif
/* Format for protocol definitions:
/* Format for protocol definitions:
* {pulselength, Sync bit, "0" bit, "1" bit}
* {pulselength, Sync bit, "0" bit, "1" bit}
*
*
...
@@ -59,7 +68,11 @@
...
@@ -59,7 +68,11 @@
*
*
* These are combined to form Tri-State bits when sending or receiving codes.
* These are combined to form Tri-State bits when sending or receiving codes.
*/
*/
#ifdef ESP8266
static
const
RCSwitch
::
Protocol
proto
[]
=
{
#else
static
const
RCSwitch
::
Protocol
PROGMEM
proto
[]
=
{
static
const
RCSwitch
::
Protocol
PROGMEM
proto
[]
=
{
#endif
{
350
,
{
1
,
31
},
{
1
,
3
},
{
3
,
1
}
},
// protocol 1
{
350
,
{
1
,
31
},
{
1
,
3
},
{
3
,
1
}
},
// protocol 1
{
650
,
{
1
,
10
},
{
1
,
2
},
{
2
,
1
}
},
// protocol 2
{
650
,
{
1
,
10
},
{
1
,
2
},
{
2
,
1
}
},
// protocol 2
{
100
,
{
30
,
71
},
{
4
,
11
},
{
9
,
6
}
},
// protocol 3
{
100
,
{
30
,
71
},
{
4
,
11
},
{
9
,
6
}
},
// protocol 3
...
@@ -621,10 +634,13 @@ static inline unsigned int diff(int A, int B) {
...
@@ -621,10 +634,13 @@ static inline unsigned int diff(int A, int B) {
/**
/**
*
*
*/
*/
bool
RCSwitch
::
receiveProtocol
(
const
int
p
,
unsigned
int
changeCount
)
{
bool
RECEIVE_ATTR
RCSwitch
::
receiveProtocol
(
const
int
p
,
unsigned
int
changeCount
)
{
#ifdef ESP8266
const
Protocol
&
pro
=
proto
[
p
-
1
];
#else
Protocol
pro
;
Protocol
pro
;
memcpy_P
(
&
pro
,
&
proto
[
p
-
1
],
sizeof
(
Protocol
));
memcpy_P
(
&
pro
,
&
proto
[
p
-
1
],
sizeof
(
Protocol
));
#endif
unsigned
long
code
=
0
;
unsigned
long
code
=
0
;
const
unsigned
int
delay
=
RCSwitch
::
timings
[
0
]
/
pro
.
syncFactor
.
low
;
const
unsigned
int
delay
=
RCSwitch
::
timings
[
0
]
/
pro
.
syncFactor
.
low
;
...
@@ -655,7 +671,7 @@ bool RCSwitch::receiveProtocol(const int p, unsigned int changeCount) {
...
@@ -655,7 +671,7 @@ bool RCSwitch::receiveProtocol(const int p, unsigned int changeCount) {
return
true
;
return
true
;
}
}
void
RCSwitch
::
handleInterrupt
()
{
void
RECEIVE_ATTR
RCSwitch
::
handleInterrupt
()
{
static
unsigned
int
changeCount
=
0
;
static
unsigned
int
changeCount
=
0
;
static
unsigned
long
lastTime
=
0
;
static
unsigned
long
lastTime
=
0
;
...
...
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