neu-rah / ArduinoMenu

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

Show graphics on the display #368

Open Astar76 opened 2 years ago

Astar76 commented 2 years ago

Is it possible to display graphics on the display through Adafruit GFX? I have an OLED display SSD1306. The menu is displayed well, but there was a need to show the battery charge in the upper right corner, since there is a lot of free space. Now the menu is displayed through the SSD1306AsciiWire library.

DisDis commented 1 year ago

Hi, Try to use #include <menuIO/adafruitGfxOut.h> and will change initialization

#define gfxWidth 128
#define gfxHeight 64
#define fontX 7
#define fontY 10
MENU_OUTPUTS(out, MAX_DEPTH, ADAGFX_OUT(display, colors, fontX, fontY, {0, 0, gfxWidth / fontX, gfxHeight / fontY}), SERIAL_OUT(Serial));

But I faced with issue incorrect draw menu item

martykube commented 1 year ago

Hi, I have a similar use case. @neu-rah do you have any guidance on drawing?

We want to have menu selections that lead to plotting a sensor value on the menu screen.

The use case might be select temperature sensors from the top menu, and then select a sensor, and then plot the selected sensor values.

I'm not asking for the plotting part, I can do that with the underlying output driver (U8g). I am asking if that approach will work well with the menu system.

Thanks!

neu-rah commented 1 year ago

@martykube use a read only numeric field tied to a variable where the sensor read is stored, it will automatically update its value whenever the sensor read changes...

To use custom draw.. there is a project that monitors servos that does indeed an inline plot.

AM4 is line based, the plot is restricted to a single line... next version will not.

keldonin commented 1 year ago

@neu-rah, I suppose you are referring to this sketch: https://github.com/jarkman/ServoBox/blob/master/ServoBox.ino, is that correct?