Current Lua downloadable firmware will be posted here

User avatar
By pjexposito
#35881 Hello,

I'm trying to drive a Nokia 3310 with PCD8544 chip with NodeMCU but I can't even load the library. This is the message I get when I run the program:

Code: Select alllua: init.lua:26: attempt to call field 'pcd8544_84x48_hw_spi' (a nil value)
stack traceback:
   init.lua:26: in function 'init_spi_display'
   init.lua:152: in main chunk
   [C]: ?


I'm using a custom 1.4 NodeMCU firmware with all these modules:
modules: node,file,gpio,wifi,net,pwm,i2c,spi,tmr,uart,u8g,cjson,ws2801

What I'm doing wrong?

Thanks
User avatar
By devsaurus
#35902 Only a small subset of the available display drivers is compiled in by default. You'd need to enable the uncomment driver in app/include/u8g_config.h and recompile the firmware.
User avatar
By devsaurus
#36100 Just change the definition of U8G_DISPLAY_TABLE_SPI in app/include/u8g_config.h. You can also remove the I2C display driver to save memory space. In the end, all you need is (based on current master and dev branches):

Code: Select all#ifndef __U8G_CONFIG_H__
#define __U8G_CONFIG_H__


// ***************************************************************************
// Configure U8glib fonts
//
// Add a U8G_FONT_TABLE_ENTRY for each font you want to compile into the image
#define U8G_FONT_TABLE_ENTRY(font)
#define U8G_FONT_TABLE                          \
    U8G_FONT_TABLE_ENTRY(font_6x10)             \
    U8G_FONT_TABLE_ENTRY(font_chikita)
#undef U8G_FONT_TABLE_ENTRY
//
// ***************************************************************************


// ***************************************************************************
// Enable display drivers
//
// Uncomment the U8G_DISPLAY_TABLE_ENTRY for the device(s) you want to
// compile into the firmware.
// Stick to the assignments to *_I2C and *_SPI tables.
//
// I2C based displays go into here:
//    U8G_DISPLAY_TABLE_ENTRY(sh1106_128x64_i2c)          \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_i2c)         \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1306_64x48_i2c)          \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1309_128x64_i2c)         \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1327_96x96_gr_i2c)       \
//    U8G_DISPLAY_TABLE_ENTRY(uc1611_dogm240_i2c)         \
//    U8G_DISPLAY_TABLE_ENTRY(uc1611_dogxl240_i2c)        \

#define U8G_DISPLAY_TABLE_ENTRY(device)
#define U8G_DISPLAY_TABLE_I2C                           \

// SPI based displays go into here:
//    U8G_DISPLAY_TABLE_ENTRY(ld7032_60x32_hw_spi)                \
//    U8G_DISPLAY_TABLE_ENTRY(pcd8544_84x48_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(pcf8812_96x65_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(sh1106_128x64_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1306_128x64_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1306_64x48_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1309_128x64_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1322_nhd31oled_bw_hw_spi)        \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1322_nhd31oled_gr_hw_spi)        \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1325_nhd27oled_bw_hw_spi)        \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1325_nhd27oled_gr_hw_spi)        \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1327_96x96_gr_hw_spi)            \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128_332_hw_spi)         \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128gh_332_hw_spi)       \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128_hicolor_hw_spi)     \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1351_128x128gh_hicolor_hw_spi)   \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1353_160x128_332_hw_spi)         \
//    U8G_DISPLAY_TABLE_ENTRY(ssd1353_160x128_hicolor_hw_spi)     \
//    U8G_DISPLAY_TABLE_ENTRY(st7565_64128n_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(st7565_dogm128_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(st7565_dogm132_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(st7565_lm6059_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(st7565_lm6063_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(st7565_nhd_c12832_hw_spi)           \
//    U8G_DISPLAY_TABLE_ENTRY(st7565_nhd_c12864_hw_spi)           \
//    U8G_DISPLAY_TABLE_ENTRY(uc1601_c128032_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(uc1608_240x128_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(uc1608_240x64_hw_spi)               \
//    U8G_DISPLAY_TABLE_ENTRY(uc1610_dogxl160_bw_hw_spi)          \
//    U8G_DISPLAY_TABLE_ENTRY(uc1610_dogxl160_gr_hw_spi)          \
//    U8G_DISPLAY_TABLE_ENTRY(uc1611_dogm240_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(uc1611_dogxl240_hw_spi)             \
//    U8G_DISPLAY_TABLE_ENTRY(uc1701_dogs102_hw_spi)              \
//    U8G_DISPLAY_TABLE_ENTRY(uc1701_mini12864_hw_spi)            \

#define U8G_DISPLAY_TABLE_SPI                                   \
    U8G_DISPLAY_TABLE_ENTRY(pcd8544_84x48_hw_spi)              \

#undef U8G_DISPLAY_TABLE_ENTRY
//
// ***************************************************************************


#endif   /* __U8G_CONFIG_H__ */


The fonts are not related to the display drivers at all - include whatever font you fancy. A comprehensive list is in u8glib's wiki: https://github.com/olikraus/u8glib/wiki/fontsize. The preselection is just for matching the example scripts in lua_examples/u8glib/.