Ticker vs tasks
Posted: Thu Oct 01, 2020 4:03 pm
I'm trying to work out the "best" thing to use between timers and tasks.
I want to call a function every 60 seconds, this will do some updates to a tft screen plugged into my esp32. This update performs some i2c calls and then spits out updates to the screen over spi.
I just learned about tasks and as they were shiny and new to me I looked to use that first, but I want to not use too much of my heap and it looks like running a task takes up a fair bit. I had set one up with a loop to call the update function, then delay for 60 seconds.
Could anyone explain the pros and cons of the 2 methods with any advice on the one that has the lowest system usage?
My criteria is:
Lowest memory usage
Can run in the "background"
Runs every 60 seconds ish*
*This is only roughly, it could be a second or 2 off every 60 seconds without causing issues
Cheers
Sol
I want to call a function every 60 seconds, this will do some updates to a tft screen plugged into my esp32. This update performs some i2c calls and then spits out updates to the screen over spi.
I just learned about tasks and as they were shiny and new to me I looked to use that first, but I want to not use too much of my heap and it looks like running a task takes up a fair bit. I had set one up with a loop to call the update function, then delay for 60 seconds.
Could anyone explain the pros and cons of the 2 methods with any advice on the one that has the lowest system usage?
My criteria is:
Lowest memory usage
Can run in the "background"
Runs every 60 seconds ish*
*This is only roughly, it could be a second or 2 off every 60 seconds without causing issues
Cheers
Sol