-
-
Notifications
You must be signed in to change notification settings - Fork 894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatible with Arduino core for ESP8266 version 3 #1496
Comments
and replace ICACHE_RAM_ATTR by IRAM_ATTR
@Yveaux Good finding and nice workaround! Yes since core 3.0.2 the MySensors dev lib is buildable again (no PRIu8 and PSTR errors anymore), The code of MyMainESP8266 HAL is basically a copy from Arduino ESP8266 core - Additionally I added a check for the ESP8266 core major version 3 and added some #if #else Then I have also replaced the code locations for your point 2. to use IRAM_ATTR with core 3. So only your last both points 3. and 4. are still open. May be you can explain more what to do here. It would also be great if you could take a look into my commit above and maybe give it a try. |
@virtual-maker hey man, you beat me to it! 👍 On the other hand, I'm not happy with including files from the Arduino core (also for other architectures) as part of the MySensors stack. The main esp8266 startup code is being modified on a regular basis (see https://github.com/esp8266/Arduino/commits/master/cores/esp8266/core_esp8266_main.cpp) so we will always struggle to keep up. I did some experiments using the core's preinit()-hook, which we might be able to use as startup entrypoint, or to register a one-time task that runs just before setup() is called. So far I couldn't get it running, but maybe my esp knowledge is just lacking... However, I did manage to implement the loop()-hook, which is required to update the stack, by overriding the loop_end() function; i.e.
Still some esp-core code in there, but 2 lines are better than a complete file. We could pursue this path to become, to some degree, less dependent on Arduino core changes, or even remove all the magic (for all platforms) and just call some MySensors function in setup() and another one in loop() as MySensors did in the past (and all other libraries do...) |
@Yveaux I completely agree with this copy/paste maintenance nightmare. Unfortunately I have no experience with ESP tasks but what's about something like this? MySensors\hal\architecture\ESP8266\MyMainESP8266.cpp inline void _my_sensors_loop()
{
// Process incoming data
_process();
// Call of loop() in the Arduino sketch
loop();
}
/*
* Use preprocessor defines for code injection of the MySensors calls to _begin() and _process().
* This is the "magic" how the MySensors stack is setup and executed in background without
* need for explicit calls from the Arduino sketch.
*/
// Start up MySensors library including call of setup() in the Arduino sketch
#define setup _begin
// Helper function to _process() and call of loop() in the Arduino sketch
#define loop _my_sensors_loop
#include <core_esp8266_main.cpp>
// Tidy up code injection defines
#undef loop
#undef setup
This way only the included filename |
@Yveaux Remove of the MySensors magic would be a clean solution, especially for newcomers. |
I come from my issues #1509 (comment) |
Hi, extern "C" void loop_end (void)
{
// Handle the ESP ARduino core
run_scheduled_functions();
run_scheduled_recurrent_functions();
// Handle the MySensors stack
_process();
} They allow to automatically call a function (here
Could the above respond to this consideration ? It is not clear to me whether other changes in 3.0.2 (regarding 2.7.4) are preventing compatibility with this library. |
I've tested the #1513 fix and it appears to fix the issue, see #1513 (comment) |
CI is failing #1513 for an unknown reason to me, can someone help me fix it ? |
Hi Kaspars,
When I follow the link to your test project from the issue comment I get a 404. Thank you |
@virtual-maker Sorry for the confusion! It was indeed private. Could you please test it again? |
@kasparsd Thanks, now the link works. I see, you use the ESP as a node which only sends messages. Something like this:
I have seen you have defined MY_DEBUG.
Can you check this? Thank you |
Is there any progress on this issue? I think I am hitting the same issue. I am building an ESP8266 gateway (ESP12) and I am not getting anything on serial monitor. I can't even print messages. However, if I comment out #include <MySensors.h> statement, serial messages work. I am using MySensors 2.3.2. |
I had the same issue in one of my projects today.
This means: use the old espressif8266 platform - version 3 does not work. |
There are attempts to resolve this in #1513. Pinning the Arduino core to 2.6.3 as suggested above is the fix until that gets merged. |
and replace ICACHE_RAM_ATTR by IRAM_ATTR
and replace ICACHE_RAM_ATTR by IRAM_ATTR
When compiling against arduino core 3.x, MySensors startup code seems to hang during startup, without producing any output.
What needs to be fixed in MySensors:
Quick hack to get things working again:
#define IRQ_HANDLER_ATTR ICACHE_RAM_ATTR
by#define IRQ_HANDLER_ATTR IRAM_ATTR
#include "hal/architecture/ESP8266/MyMainESP8266.cpp"
MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp
Change your sketch as follows:
The text was updated successfully, but these errors were encountered: