Skip to content

Commit

Permalink
fix: implement workaround for known GPIO issue
Browse files Browse the repository at this point in the history
GPIO 36 and 39 trigger false ISR's in esp-idf v4.2.0.
This caused the button task to run too much, starving other tasks.

See espressif/esp-idf#1096.
  • Loading branch information
n-vr committed Sep 26, 2023
1 parent 61c2f23 commit 9e314e0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/util/buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ namespace Buttons
*/
void IRAM_ATTR ISRHandlerGPIO(void *pvParams)
{
auto button = reinterpret_cast<Button *>(pvParams);

// Button was not actually pressed.
// This is a workaround for a know error for some GPIO's with the ISR in esp-idf v4.4.0.
// See https://github.com/espressif/esp-idf/issues/1096.
if (gpio_get_level(button->gpioNum) != button->trigger)
return;

xQueueSendFromISR(s_gpioEventQueue, pvParams, NULL);
}

Expand Down

0 comments on commit 9e314e0

Please sign in to comment.