mathertel / OneButton

An Arduino library for using a single button for multiple purpose input.
http://www.mathertel.de/Arduino/OneButtonLibrary.aspx
Other
920 stars 230 forks source link

ESP32 and FreeRTOS #103

Closed mitchsf closed 2 years ago

mitchsf commented 2 years ago

Has anyone else tried this? When tick() is run in a task, the function crashes with errors that I'm not clear on. Lines 56 and 199 of OneButton.cpp indicate it has something to do with pinMode or digitalRead, according to the Exception Decoder.

It works perfectly if tick() is in loop(), but with FreeRTOS, it's not the best idea to have anything running there.

mitchsf commented 2 years ago

I tried using a semaphore to block anything else from running, to no effect.

void RunFunctions( void * parameter) { for (;;) { xSemaphoreTake(buttonMutex, portMAX_DELAY); button.tick(); xSemaphoreGive(buttonMutex); vTaskDelay(10); } }

mathertel commented 2 years ago

I am not aware of such a problem. Can you please investigate more and share your findings ?

mitchsf commented 2 years ago

Sorry, I don't know enough about FreeRTOS to figure this one out. I just left tick() in loop().

mathertel commented 2 years ago

At least I checked with ESP32 Arduino environment and it works. FreeRTOS is another environment so I close this issue for now.