arduino to IDF newbie help managing mulitple apps inline
Posted: Sat Mar 16, 2024 10:22 pm
I have a project, it was all built in an arduino framework. It gets info from child boards via ESP now & displays it on a screen. I was nearly done, when I decided I wanted a clock on the screen. Between the display & espNow, I dont have enough DRAM to add the WIFI to get an update on the clock. I tried to do the clock update in setup(), but no matter what tried (every deinit & stop command I could find), I couldn’t get the memory to release…ands its a lot, like 56,000 bytes in a standard station mode. I dont need, or want it to be connected to wifi past it getting the time.
So now I’ve graduated to a native IDF framework. spent a few days setting up IDF for both vscode & platformIO. So far I like the PIO-IDF system better(except for menuconfig!), but I can use either if needed.
so what I would like to do is something like:
startup (bootloader app ?)
app1();
kill app1 completely
app2();
then I’ll schedule a restart once a day triggering the time to sync.
I have a basic understanding of task scheduling and I have studied the startup file in freeRTOS that links to the main app. I’m just not clear on how to implement a second app…or really what to search for on that subject. Please advice!
If there is a better general strategy towards doing this, I’m all ears.
PS
on a separate but related note: the NPT example in IDF is EXACTLY what that first app should be. There are notes in there that the “example_connect” function is simplified & should not be used in real work applications. How serious should I take that note? This isn’t a commercial product or anything & the clock is not super critical, can I get away with just using the example as is? I ask because, every time I try to add NTP to a working WIFI init & connect, it refuses to connect. Also, where is the actual code behind "example_connect" ? all I can find is the prototype.
PSS-- for a newb like me, do yall recommend I limit things to 1 core? Thats my understanding of how arduino was running it & without wifi, it handled it just fine. Seems people do that, at least at the beginning?
So now I’ve graduated to a native IDF framework. spent a few days setting up IDF for both vscode & platformIO. So far I like the PIO-IDF system better(except for menuconfig!), but I can use either if needed.
so what I would like to do is something like:
startup (bootloader app ?)
app1();
kill app1 completely
app2();
then I’ll schedule a restart once a day triggering the time to sync.
I have a basic understanding of task scheduling and I have studied the startup file in freeRTOS that links to the main app. I’m just not clear on how to implement a second app…or really what to search for on that subject. Please advice!
If there is a better general strategy towards doing this, I’m all ears.
PS
on a separate but related note: the NPT example in IDF is EXACTLY what that first app should be. There are notes in there that the “example_connect” function is simplified & should not be used in real work applications. How serious should I take that note? This isn’t a commercial product or anything & the clock is not super critical, can I get away with just using the example as is? I ask because, every time I try to add NTP to a working WIFI init & connect, it refuses to connect. Also, where is the actual code behind "example_connect" ? all I can find is the prototype.
PSS-- for a newb like me, do yall recommend I limit things to 1 core? Thats my understanding of how arduino was running it & without wifi, it handled it just fine. Seems people do that, at least at the beginning?