|
|
@@ -98,7 +98,8 @@ static void IRAM_ATTR gpio_isr_handler(void *arg)
|
|
|
|
|
|
GpioResult result = {};
|
|
|
result.gpio = context->gpio;
|
|
|
- result.value = gpio_get_level(context->gpio);
|
|
|
+ // Read the pin level in task context; keep the IRAM ISR minimal.
|
|
|
+ result.value = 0;
|
|
|
result.stopEvent = false;
|
|
|
|
|
|
BaseType_t higherPriorityTaskWoken = pdFALSE;
|
|
|
@@ -277,6 +278,13 @@ void GpioHandler::init()
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // An empty board whitelist (or no enabled user pins) needs no queue or worker.
|
|
|
+ if (gpioMap->empty()) {
|
|
|
+ _isEnabled = false;
|
|
|
+ ESP_LOGI(TAG, "GPIO handler disabled: no user GPIO pins are configured or available");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// Each handler owns its queue; ISR callbacks never use a process-global queue.
|
|
|
_eventQueue = xQueueCreate(16, sizeof(GpioResult));
|
|
|
if (_eventQueue == NULL) {
|
|
|
@@ -425,6 +433,7 @@ void GpioHandler::workerLoop() {
|
|
|
if (result.stopEvent) {
|
|
|
running = false;
|
|
|
} else {
|
|
|
+ result.value = gpio_get_level(result.gpio);
|
|
|
gpioInterrupt(&result);
|
|
|
}
|
|
|
}
|