Comments (15)
Nice find.... I have been looking a lot for this.
Will try this later today, to see if it solves the problem.
from rc-switch.
Seems to solve my instability issue.
from rc-switch.
I tried to fix this in 90d00c1 based on your description. Could you please verify whether that actually works for you?
from rc-switch.
Yes,
thanks, works
I like the implementation.
from rc-switch.
I had to do this to the .cpp file to get it to work on a ESP8266-01 with the data connected to GPIO-02
#ifdef ESP8266
void ICACHE_RAM_ATTR RCSwitch::handleInterrupt() {
#else
//void RCSwitch::handleInterrupt() {
void RECEIVE_ATTR RCSwitch::handleInterrupt() {
#endif
Otherwise, thanks heaps.
I am making a range extender for a CareAlert smart dialer using 2x EPS8266 with a 434Mhz Receicer on one unit and a 434Mhz transmitter on the other.
Which now works....
from rc-switch.
@WheresWally , this shouldn't be necessary, as you can see in the macro starting at line 43, where RECEIVE_ATTR
is already substituted with ICACHE_RAM_ATTR
for ESP8266:
#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
from rc-switch.
I also have similar issue on ESP8266 that random crash happens when interrupt is called. I also added ICACHE_RAM_ATTR to RCSwitch::handleInterrupt() and now problem is solved.
from rc-switch.
@gadget1999 Well, we already have a fix for that in the code -- are you using the latest version of rc-switch? If so, can you please test whether ESP8266 is #defined for you? E.g. put this into your code, and compile it:
#ifdef ESP8266
#error ESP8266 is defined
#else
#error ESP8266 is NOT defined
#endif
If the issue persists with the latest rc-switch, as taken from this repository, please open a new issue for this, instead of adding to an old, already closed one.
from rc-switch.
@fingolfin , thanks for the direction, I can reproduce the issue with "#error ESP8266 is defined". I'll open a new issue then.
from rc-switch.
@gadget1999 Well, we already have a fix for that in the code -- are you using the latest version of rc-switch?
The fix is not on the latest release (v2.52) which is what is used with for example platformio library manager.
Could you please pick a branch/revision with code you consider stable and hit the create release button :)
from rc-switch.
sorry never used github to commit code before, I'll need to learn how to do it first and make the change later. All the change I made locally was the same as @WheresWally did above:
#ifdef ESP8266
void ICACHE_RAM_ATTR RCSwitch::handleInterrupt() {
#else
//void RCSwitch::handleInterrupt() {
void RECEIVE_ATTR RCSwitch::handleInterrupt() {
#endif
from rc-switch.
Here is the actual bug:
/* helper function for the receiveProtocol method */
static inline unsigned int diff(int A, int B) {
//return abs(A - B); // it's not a language build in function and not declared with RECEIVE_ATTR
//replacement:
if ((A - B)>0) return (A - B); else return -(A - B) ;
}
from rc-switch.
Someone should fix this bug in the master lib and release a new version. I'm not currently willing to be in charge of such a release myself. If you are the right person to do it, please go ahead, but don’t mention me in the release, please.
from rc-switch.
Ok, I get it (having received a few messags from people that happen to know me). I need to explain further, so here comes...
The C library function int abs(int x) returns the absolute value of int x.
Note that it is a library function (stdlib.h) not a build in compiler function!
Since it is part of stdlib.h it is almost always available to you and usually there is no reason to concern yourself with using it. However in this special case we are dealing with an interrupt routine that has to always be available! If some other software has locked the memory that it needs you will be faced with a fubar if/when the interrupt occurs. It is therefore NOT ok to use a libary function in your interrupt routine!
Note:
In case you dont't know , 'fubar' is old millitary slang. It stand for "Fucked Up Beyond All Recogniction".
from rc-switch.
Sadly the use of micros() within an interrupt routine also seem to be unsafe, certainly on ESP32 platforms. Unfortunately this is not so easy to replace and I have yet to figure out what to suggest doing about it. At the moment I can’t even suggest a workaround. Also at the moment I lean towards thinking that this should be solved outside the scope of this project as the use of micros() in an interrupt routine is so fundamental that my thinking is that it really needs to be addressed in the platform lib not in a project lib.
Comments welcome please!
from rc-switch.
Related Issues (20)
- How to send()? HOT 1
- How the ISR function handle the filtering out first high pulse in SYNC bit
- void RCSwitch::disableReceive()
- ReceiveDemo_Advanced work with Platform.IO and VSCode HOT 1
- How can i modify this protocol? HOT 5
- Cant receive anything with receive demo HOT 1
- Small contribution
- SURNICE: receiver and transmitter HOT 1
- Protocol 6 optimization doubt
- A modest proposal - expose the interrupt so a user can write a callback function.
- How to add a new protocol for my RF receiver HOT 1
- SimpleRCScanner return error 500
- Switch does not respond
- SimpleRCScanner returning random numbers with no RF signal (no button pressed) HOT 1
- 433MHz 4-button code copy
- Repeat received code
- Dooya DD2702H two way protocol
- Can it support sending 5 bytes of data
- I am a little stuck as I think I have a variable bit count protocol appears manchester?
- Have anyone try Rcswitch with esp32c3 supermini HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rc-switch.