A possible Platform IO u8g2 library issue

I installed u8g2 arduino library from the platform io library installer and when using that version my display is shifted to right by about 20 pixels and seems to roll over ghosted. [Display = SSD1322_NHD_256X64_F_4W_HW_SPI] However if I overwrite the platform IO library manually with same version of u8g2 from the authors github everything works fine. Seems as if there might be an issue with library that platform IO downloads.

Then the overwritten version has different code after all.

Can you share your exact PIO project (platformio.ini and source files)?

1 Like

Yeah sure, I was just testing out my screen choice for my project when ran into the bugged library. It took me a while to figure out why the code worked perfectly when built in Arduino ide but not in PlatformIO.
zip of project files and libraries

tl;dr #define U8G2_16BIT had been enabled by the OP, hence why things were behaving differently.

As far as I can tell, the only real difference the two libraries is the one you say is from GitHub has been modified to uncomment #define U8G2_16BIT on line 72 of GITHUB Downloaded Library/U8g2/src/clib/u8g2.h which is commented out by default on the actual version on Github, which is the same as the PlatformIO hosted version, and that the examples/full_buffer/GraphicsTest/GraphicsTest.ino has been modified… that latter was probably when you were testing the display.

$ diff -qyr GITHUB\ Downloaded\ Library/U8g2/ PlatfromIO\ Downloaded\ Library/U8g2_ID942/
Files GITHUB Downloaded Library/U8g2/examples/full_buffer/GraphicsTest/GraphicsTest.ino and PlatfromIO Downloaded Library/U8g2_ID942/examples/full_buffer/GraphicsTest/GraphicsTest.ino differ
Only in GITHUB Downloaded Library/U8g2/: extras
Only in PlatfromIO Downloaded Library/U8g2_ID942/: .library.json
Files GITHUB Downloaded Library/U8g2/src/clib/u8g2.h and PlatfromIO Downloaded Library/U8g2_ID942/src/clib/u8g2.h differ

A diff test against the platformIO folder you provided, and a freshly downloaded copy of the library from github gives only inconsequential differences.

$ diff -qyr PlatfromIO\ Downloaded\ Library/U8g2_ID942/ U8g2_Arduino-2.26.14/
Only in U8g2_Arduino-2.26.14/: extras
Only in PlatfromIO Downloaded Library/U8g2_ID942/: .library.json

A case of mistaken identity, I think! :laughing:

btw, you may be able to use the build_flags parameter in your platformio.ini so that you don’t even need to modify the stock library files … e.g. build_flags = -D U8G2_16BIT to set it, or -U name to unset something already set.

1 Like

Yeah your 100% correct, I remember now enabling that u8g2_16bit on the Arduino library. Sorry for wasting your time. Oh well maybe it will help out some other dummy in the future.
Alright I will give that a shot and maybe it is time to commit to PlatformIO and stop having two library locations.

1 Like

Yes, you should, else you’ll be set upon by a thousand savage drop bears (otherwise known as the Australian Koala)! :laughing:

At least you know what not to do next time… I know lots of them! :wink: