Arduino PROGMEM

Started by StevenMartin, December 15, 2020, 03:00:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

StevenMartin

Does anyone know of a library for an LCD menu/sub-menu system that uses PROGMEM as much as possible?

I have been using this library previously https://github.com/jonblack/arduino-menusystem which has been working great but the menu I need to add for my project has 700+ submenus/items, plus a handful of menus to hold them and it's smashing the SRAM big time.

I guess the basic functionality would need to be simply:

-Left (scroll menus or items)
-Right (scroll menus or items)
-Select (enter down into a sub-menu, or if it's an item then activate a function)
-Back (go back up to the previous menu)

I've had some success with storing/retrieving strings (const char []'s) in PROGMEM previously but with my very limited knowledge I can't get the menus/items from the library I mentioned above into Progmem too. I suspect it's not even possible.

If anyone knows of a better library to use, or is able to help me get my example code into PROGMEM using the library I've been using, that would be even better.

I've attached the code in a zip. It's written with Visual Studio Code and the Platformio extension and includes both the menu library and also the PROGMEM_readAnything library I've also been trying to mess with to achieve this.

I've also been reading this, which has been quite helpful http://www.gammon.com.au/progmem (the PROGMEM_readAnything is also mentioned below the article), but so far, no luck!

Thanks for any help/suggestions!!

gumtown

I am not seeing why the need to force your text strings into PROGMEM, just use a static cast in your code as required.

I have attached some code used to run a Katana amp USB foot controller with a simple <>v^ button & LCD menu system.
It might be useful to review.
Free "GR-55 FloorBoard" editor software from https://sourceforge.net/projects/grfloorboard/

sixeight

It is not really a library, but I do use PROGMEM for the actual library structure on the VController.

https://github.com/sixeight7/VController_v3/blob/master/Firmware/VController_v3/Menu.ino

StevenMartin

Quote from: gumtown on December 15, 2020, 03:45:03 AM
I am not seeing why the need to force your text strings into PROGMEM, just use a static cast in your code as required.

Ah, because I've already gone so far as to getting all of the effect types into stored/printed and now I'm going one step further and trying to basically get every parameter (reverb predelay, high-cut/low-cut, spring colour etc etc etc) editable too. A full BTS basically but in menu form.

The data required at least an unsigned long, char[] for name, bytes for min/max/and index etc for every possible parameter take up a looooooot. Add onto that menu titles/text for each, and arrays of strings for parameters where an index number doesn't make sense (in the same way that an ampType=7 might not. We need the string associated to see what that means.