-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raspberry PI drawUTF8Button, method not found #2602
Comments
This is the most basic example I could test with #include "U8g2lib.h"
#define I2C_BUS 1
#define I2C_ADDRESS 0x3c * 2
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE);
int main() {
u8g2.initI2cHw(I2C_BUS);
u8g2.setI2CAddress(I2C_ADDRESS);
u8g2.begin();
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_6x13_tr); // choose a suitable font
u8g2.drawButtonUTF8(42, 50, U8G2_BTN_INV | U8G2_BTN_SHADOW2 | U8G2_BTN_HCENTER | U8G2_BTN_BW1, 0, 2, 2, "Yes");
u8g2.sendBuffer();
u8g2.doneI2c();
u8g2.doneUserData();
return 0;
} make -j $(nproc)
arm-linux-gnueabihf-g++ -c -o obj/main.cpp.o main.cpp -I ./lib/u8g2/sys/arm-linux/drivers -I ./lib/u8g2/sys/arm-linux/drivers -I ./lib/u8g2/sys/arm-linux/port -I ./lib/u8g2/csrc -I ./lib/pixel-view/src -W -Wall -D __ARM_LINUX__ -L ./lib -lm
main.cpp: In function ‘int main()’:
main.cpp:16:8: error: ‘class U8G2_SH1106_128X64_NONAME_F_HW_I2C’ has no member named ‘drawButtonUTF8’; did you mean ‘drawExtUTF8’?
16 | u8g2.drawButtonUTF8(42, 50, U8G2_BTN_INV | U8G2_BTN_SHADOW2 | U8G2_BTN_HCENTER | U8G2_BTN_BW1, 0, 2, 2, "Yes");
| ^~~~~~~~~~~~~~
| drawExtUTF8
make: *** [Makefile:56: obj/main.cpp.o] Error 1
. This is my project structure if it helps:
|
Okay I think it's just that |
Yup, I've fixed it temporarily by copying the following code block into /* u8g2_button.c */
void drawButtonUTF8(u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t flags, u8g2_uint_t width, u8g2_uint_t padding_h, u8g2_uint_t padding_v, const char *text) {
u8g2_DrawButtonUTF8(&u8g2, x, y, flags, width, padding_h, padding_v, text); } |
hmm ok, you fixed it... but usually the code should be there... |
I couldn't find it in the port file :(. unless I'm doing something wrong |
Which port file? |
this file. There's no |
oh, I see. Those ports are just contributed codes from other people. I actually don't update them, thats why it is missing. |
ah okay, that makes sense, if possible I'll make a PR |
TLDR:
u8g2.drawButtonUTF8()
doesn't work on raspberry pi zero 2 w. Possible issue is thatport/U8g2lib.h
is outdated from the maincppsrc/
Helllllo, I was porting my library to the raspberry pi (it depends on u8g2). In one of the functions I use
u8g2.drawButtonUTF8(...)
. It works perfectly normally on the microcontrollers I've tested it with, but it can't find that method on the pi zero 2w.u8g2 is a pointer because of the way the library is structured.
This is my Makefile
The only thing I could conclude is that
port/U8g2lib.h
is outdated.The text was updated successfully, but these errors were encountered: