You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get this library set-up so that I can initialize a rather complex menu structure in a separate file. How can I do this? It doesn't seem possible that I can return nav:
MenuConfig.cpp
Menu::navRoot CreateMenu()
{
// create menu structureNAVROOT(nav, mainMenu, MAX_DEPTH, in, out);
return nav;
}
main.cpp
Menu::navRoot nav = CreateMenu();
voidsetup(void)
{
// set up Serial, etc.
}
voidloop(void)
{
nav.poll();
}
I've tried several ways, like passing references, etc. The program seems to crash in the loop.
Is there a way to do this or do am I forced to have a gigantic main.cpp file?!
The text was updated successfully, but these errors were encountered:
I found issue #293. This gives a great start, but I'm not sure how to do this within a helper function? The OP of that issue has an unresolved question on how to provide the return type. I've been struggling with trying to wrap my head on how to get the references in and out of a call to the function. I'm a C# dev so grasping how pointers and references work in this situation such that anything created locally in the function isn't destroyed is killing me.
I'm trying to get this library set-up so that I can initialize a rather complex menu structure in a separate file. How can I do this? It doesn't seem possible that I can return nav:
MenuConfig.cpp
main.cpp
I've tried several ways, like passing references, etc. The program seems to crash in the loop.
Is there a way to do this or do am I forced to have a gigantic
main.cpp
file?!The text was updated successfully, but these errors were encountered: