diff --git a/.gitignore b/.gitignore index ee55dbd..f06112f 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,10 @@ sdkconfig.* # Ignore temporary backup files *.orig *.bak +data/ +build/ +coredump_report.txt +coredump.bin +logs/ +elf_archive/ +src/SomfyController.ino.cpp diff --git a/data-src/appversion b/data-src/appversion index f1cb5ae..e4a0720 100644 --- a/data-src/appversion +++ b/data-src/appversion @@ -1 +1 @@ -3.0.10 \ No newline at end of file +3.0.11 \ No newline at end of file diff --git a/data-src/index.html b/data-src/index.html index ed72d80..3875bb3 100644 --- a/data-src/index.html +++ b/data-src/index.html @@ -8,9 +8,9 @@ - - - + + + @@ -114,7 +114,7 @@ rel="apple-touch-startup-image"> - +
diff --git a/src/Somfy.cpp b/src/Somfy.cpp index 0466520..f508aa3 100644 --- a/src/Somfy.cpp +++ b/src/Somfy.cpp @@ -4879,6 +4879,15 @@ bool Transceiver::begin() { return true; } void Transceiver::loop() { + // Dispatch deferred frequency scan requests from the main task so that + // attachInterrupt/detachInterrupt cross-core IPCs don't race with WiFi. + if(_pendingScan >= 0) { + int8_t pending = _pendingScan; + _pendingScan = -1; + if(pending == 1) this->beginFrequencyScan(); + else this->endFrequencyScan(); + return; + } somfy_rx_t rx; if (noiseDetected && rxmode != 3 && this->config.noiseDetection) { if (millis() - noiseStart > 100) { diff --git a/src/Somfy.h b/src/Somfy.h index 6630db6..66512b9 100644 --- a/src/Somfy.h +++ b/src/Somfy.h @@ -490,6 +490,10 @@ class Transceiver { bool _received = false; somfy_frame_t frame; public: + // -1 = none pending, 1 = beginFrequencyScan pending, 0 = endFrequencyScan pending. + // Set from the async_tcp task; consumed by loop() on the main task to avoid + // concurrent cross-core IPC races with the WiFi stack (EXCCAUSE_LOAD_PROHIBITED). + volatile int8_t _pendingScan = -1; transceiver_config_t config; bool printBuffer = false; //bool toJSON(JsonObject& obj); diff --git a/src/Web.cpp b/src/Web.cpp index 71c063c..eea0bc8 100644 --- a/src/Web.cpp +++ b/src/Web.cpp @@ -2406,7 +2406,7 @@ void Web::begin() { })); asyncServer.on("/beginFrequencyScan", HTTP_GET, [](AsyncWebServerRequest *request) { - somfy.transceiver.beginFrequencyScan(); + somfy.transceiver._pendingScan = 1; // deferred to main task — see Transceiver::loop() AsyncJsonResp resp; resp.beginResponse(request, g_async_content, sizeof(g_async_content)); resp.beginObject(); @@ -2416,7 +2416,7 @@ void Web::begin() { }); asyncServer.on("/endFrequencyScan", HTTP_GET, [](AsyncWebServerRequest *request) { - somfy.transceiver.endFrequencyScan(); + somfy.transceiver._pendingScan = 0; // deferred to main task — see Transceiver::loop() AsyncJsonResp resp; resp.beginResponse(request, g_async_content, sizeof(g_async_content)); resp.beginObject();