File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515coredump_report.txt
1616coredump.bin
1717logs /
18- elf_archive /
18+ elf_archive /
19+ src /SomfyController.ino.cpp
Original file line number Diff line number Diff line change @@ -4878,6 +4878,15 @@ bool Transceiver::begin() {
48784878 return true ;
48794879}
48804880void Transceiver::loop () {
4881+ // Dispatch deferred frequency scan requests from the main task so that
4882+ // attachInterrupt/detachInterrupt cross-core IPCs don't race with WiFi.
4883+ if (_pendingScan >= 0 ) {
4884+ int8_t pending = _pendingScan;
4885+ _pendingScan = -1 ;
4886+ if (pending == 1 ) this ->beginFrequencyScan ();
4887+ else this ->endFrequencyScan ();
4888+ return ;
4889+ }
48814890 somfy_rx_t rx;
48824891 if (noiseDetected && rxmode != 3 && this ->config .noiseDetection ) {
48834892 if (millis () - noiseStart > 100 ) {
Original file line number Diff line number Diff line change @@ -490,6 +490,10 @@ class Transceiver {
490490 bool _received = false ;
491491 somfy_frame_t frame;
492492 public:
493+ // -1 = none pending, 1 = beginFrequencyScan pending, 0 = endFrequencyScan pending.
494+ // Set from the async_tcp task; consumed by loop() on the main task to avoid
495+ // concurrent cross-core IPC races with the WiFi stack (EXCCAUSE_LOAD_PROHIBITED).
496+ volatile int8_t _pendingScan = -1 ;
493497 transceiver_config_t config;
494498 bool printBuffer = false ;
495499 // bool toJSON(JsonObject& obj);
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -2406,7 +2406,7 @@ void Web::begin() {
24062406 }));
24072407
24082408 asyncServer.on (" /beginFrequencyScan" , HTTP_GET, [](AsyncWebServerRequest *request) {
2409- somfy.transceiver .beginFrequencyScan ();
2409+ somfy.transceiver ._pendingScan = 1 ; // deferred to main task — see Transceiver::loop()
24102410 AsyncJsonResp resp;
24112411 resp.beginResponse (request, g_async_content, sizeof (g_async_content));
24122412 resp.beginObject ();
@@ -2416,7 +2416,7 @@ void Web::begin() {
24162416 });
24172417
24182418 asyncServer.on (" /endFrequencyScan" , HTTP_GET, [](AsyncWebServerRequest *request) {
2419- somfy.transceiver .endFrequencyScan ();
2419+ somfy.transceiver ._pendingScan = 0 ; // deferred to main task — see Transceiver::loop()
24202420 AsyncJsonResp resp;
24212421 resp.beginResponse (request, g_async_content, sizeof (g_async_content));
24222422 resp.beginObject ();
You can’t perform that action at this time.
0 commit comments