mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-04-20 11:02:14 +02:00
Merge branch 'main' into main
This commit is contained in:
commit
bb3ec52e89
6 changed files with 27 additions and 7 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue