olikraus / U8g2_for_Adafruit_GFX

Add U8g2 fonts to any Adafruit GFX based graphics library.
Other
103 stars 32 forks source link

Use a pointer to a display object for begin #20

Closed rlightner closed 4 years ago

rlightner commented 4 years ago

I'm using a pointer to an object:

display->init();
u8g2Fonts->begin(display);

where display is:

GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> *display;
U8G2_FOR_ADAFRUIT_GFX *u8g2Fonts;

But I'm getting an error: no matching function for call to 'U8G2_FOR_ADAFRUIT_GFX::begin(GxEPD2_BW<GxEPD2_270, 264u>*&)'

Any thoughts? Thanks!

olikraus commented 4 years ago

You have to pass the object instead of the pointer: u8g2Fonts->begin(*display);

rlightner commented 4 years ago

I originally tried that, but got an error: Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled. which of course I had no idea what that means.

I'll keep working on this :/

ZinggJM commented 4 years ago

@rlightner

I think your u8g2Fonts is a NULL pointer, unless you have assigned the address of an U8G2_FOR_ADAFRUIT_GFX instance anywhere. Don't wake sleeping Guru's.

rlightner commented 4 years ago

Sorry, this was asked back in September, you’ve been sleeping a while!

olikraus commented 4 years ago

So you fixed this problem meanwhile?

rlightner commented 4 years ago

I ended up refactoring the code to a specific module so I didn't pass around display. @ZinggJM hope you didn't take my comment the wrong way! I think of you as a Guru, so when I saw the "Don't wake sleeping Guru's." comment, I thought you were referring to yourself and not the actual bug!