mathertel/OneButton

ESP32 and FreeRTOS

mitchsf opened this issue · 4 comments

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.

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); } }

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

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

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