Closed poorandunlucky closed 5 years ago
Instructions in the u8g2_displays.h are actually a bit misleading and should be:
// Uncomment the U8G2_DISPLAY_TABLE_ENTRY for the device(s) you want to // compile into the firmware and place it in the corresponding table.
Try this:
#define U8G2_DISPLAY_TABLE_I2C \
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_noname_f, ssd1306_i2c_128x64_noname) \
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1305_i2c_128x32_noname_f, ssd1305_i2c_128x32_noname) \
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x32_univision_f, ssd1306_i2c_128x32_univision) \
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1601_i2c_128x32_f, uc1601_i2c_128x32) \
#else
Keep empty line before #else
statement, because \
symbol is used to split #define
statement across several lines.
@sonaux Thank you very much, that worked...
`// I2C displays can be defined in an external file.
U8G2_DISPLAY_TABLE_I2C_EXTRA`
What is this for, then? I thought it would override the default display driver selection if any lines were uncommented in U8G2_DISPLAY_TABLE_I2C_EXTRA...
I spent so much time on this, it's incredible... -_- I tried putting the variable up, but not the values down... I probably had a syntax error somewhere, so I still couldn't load the driver, and ended-up here...
The latest "dev" issue puts display name with "xxx" into firmware so there is no chance to put correct name to the: disp = u8g2.ssd1306_i2c_128x64_noname(id, sla)" The "master" release works perfectly.
What is this for, then?
@poorandunlucky take a look at the big picture without the commented lines.
#ifndef U8G2_DISPLAY_TABLE_I2C_EXTRA
#define U8G2_DISPLAY_TABLE_I2C \
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_noname_f, ssd1306_i2c_128x64_noname) \
#else
// I2C displays can be defined in an external file.
#define U8G2_DISPLAY_TABLE_I2C \
U8G2_DISPLAY_TABLE_I2C_EXTRA
#endif
That basically means: "if U8G2_DISPLAY_TABLE_I2C_EXTRA
is not defined anywhere (e.g. external file) then set U8G2_DISPLAY_TABLE_I2C
inline here. Otherwise, use U8G2_DISPLAY_TABLE_I2C_EXTRA
for U8G2_DISPLAY_TABLE_I2C
as defined elsewhere".
@Michal78S I don't understand what you mean, sorry. If you think there is a (new) bug in the firmware please create a separate issue.
8<------------------------ BUG REPORT -----------------------------------------
Expected behavior
I have a 0.91" 128 x 32 monochrome OLED display that works with the default ssd1306_i2c_128x64 driver, however, it doesn't work with drivers for its size whether the ssd1306_i2c_128x32_univision, ssd1305_i2c_128x32_noname, or the uc1601_i2c_128x32 (there are only 3 drivers for 128 x 32 I2C devices).
Actual behavior
Trying to use the appropriate drivers (after enabling them in u8g2_displays.h) yields:
display_test.lua:13: attempt to call field 'ssd1305_i2c_128x32_noname' (a nil value)
Using the 128x64 driver makes so only 1/3 pixels is displayed, I think... 6 px font becomes 3 px high...
Test code
u8g2_displays.h
display_test.lua
NodeMCU version
2.2.1 Master
Hardware
ESP8266MOD on a dev board, connected to a generic I2C OLED.
8<------------------------ END BUG REPORT -------------------------------------