neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
929 stars 189 forks source link

noMacros example should also show how to incorporate inputs and outputs without macros #429

Open ScruffR opened 9 months ago

ScruffR commented 9 months ago

In order to have a comprehensive noMacros example it would be really good to see how to add (at least) two inputs (e.g. Serial and button) and two outputs (e.g. Serial and ADAGFX_OUT) without macros.

While the macros are really helpful for writing concise code it's quite complicated to follow the logic what's going on behind the scene. For that it would be great to have a full-fledged example to understand the bare metal.

That would greatly help and maybe even kick-start possible contributions to extend support for special needs.

i.e. I was trying to have multi font support for AdafruitGfx displays (e.g. ILI9341) but had a hard time to pass in the respective fontMarginY values via the MENU_OUT or ADAGFX_OUT macros. Currently I'm doing it after the fact like this 🤮

  ((gfxOut*)(out.outs[0]))->resY = font.yAdvance;
  ((gfxOut*)(out.outs[0]))->fontMarginY = value;  // value derived from max(font.glyph[i].yOffset)

If I knew how to incorporate this properly into adafruitGfxOut.h and maybe even adapt the ADAGFX_OUT macro to support the extended constructor I'd file a PR.