Skip to content

Incompatible with Arduino core for ESP8266 version 3 #1496

Open
@Yveaux

Description

@Yveaux

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:

  • MySensors takes over the startup code of a platform, which has changed significantly with core 3.
    • Just updating the MySensors startup code to the core 3 version doesn't seem to work out of the box
  • Interrupt handlers need to be defined using IRAM_ATTR instead of ICACHE_RAM_ATTR
  • Implementation of MY_CRITICAL_SECTION needs reviewing
  • Part of ESP8266 code is shared with ESP32 code; make sure this doesn't break

Quick hack to get things working again:

  • MyHwHal.h
    • Replace #define IRQ_HANDLER_ATTR ICACHE_RAM_ATTR by #define IRQ_HANDLER_ATTR IRAM_ATTR
  • MySensors.h
    • Comment the line #include "hal/architecture/ESP8266/MyMainESP8266.cpp"
  • Delete the file MySensors/hal/architecture/ESP8266/MyMainESP8266.cpp

Change your sketch as follows:

void setup()
{
    static bool runonce = true;
    if (runonce)
    {
        runonce = false;
        Serial.begin(MY_BAUD_RATE, SERIAL_8N1, MY_ESP8266_SERIAL_MODE, 1);
        _begin();
    }
    // ...your regular setup() code...
}

void loop()
{
    // ...your regular loop() code...
    wait(0);        // At start/end of loop, Important!
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ESP8266enhancementrelease-notesIssues that have information that should be included in the release notes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions