diff --git a/app/modules/u8g2.c b/app/modules/u8g2.c index 3d7c5e09..9bdf8496 100644 --- a/app/modules/u8g2.c +++ b/app/modules/u8g2.c @@ -12,6 +12,7 @@ #include "u8g2_fonts.h" #ifdef ESP_PLATFORM +// ESP32 #include "spi_common.h" #include "sdkconfig.h" @@ -659,12 +660,14 @@ static int ldisplay_spi( lua_State *L, display_setup_fn_t setup_fn ) int stack = 0; #ifndef ESP_PLATFORM + // ESP8266 typedef struct { int host; } lspi_host_t; lspi_host_t host_elem; lspi_host_t *host = &host_elem; #else + // ESP32 lspi_host_t *host = NULL; #endif int host_ref = LUA_NOREF; @@ -680,12 +683,12 @@ static int ldisplay_spi( lua_State *L, display_setup_fn_t setup_fn ) /* reference host object to avoid automatic gc */ lua_pushvalue( L, stack ); host_ref = luaL_ref( L, LUA_REGISTRYINDEX ); - get_spi_pins = TRUE; + get_spi_pins = 1; } else if (lua_type( L, stack ) == LUA_TNUMBER) { host->host = luaL_checkint( L, stack ); - get_spi_pins = TRUE; + get_spi_pins = 1; } else { - get_spi_pins = FALSE; + get_spi_pins = 0; stack--; } diff --git a/docs/en/modules/u8g2.md b/docs/en/modules/u8g2.md index 88896bd7..1f2b43bf 100644 --- a/docs/en/modules/u8g2.md +++ b/docs/en/modules/u8g2.md @@ -3,7 +3,7 @@ | :----- | :-------------------- | :---------- | :------ | | 2017-06-02 | [Oli Kraus](https://github.com/olikraus/u8glib), [Arnim Läuger](https://github.com/devsaurus) | [Arnim Läuger](https://github.com/devsaurus) | [u8g2.c](../../../apps/modules/u8g2.c)| -U8g2 is a graphics library developed at [olikraus/u8g2](https://github.com/olikraus/u8g2) with support for many different displays. It is the successor of [U8glib](https://github.com/olikraus/u8glib) which is not developed any further. +U8g2 is a graphics library developed at [olikraus/u8g2](https://github.com/olikraus/u8g2) with support for many different displays. It is the successor of [U8glib](https://github.com/olikraus/u8glib) which is not developed any further. Please see [How to port U8g code](https://github.com/olikraus/u8g2/wiki/u8gvsu8g2) for generic porting instructions. The NodeMCU firmware supports the following displays in I²C and SPI mode: @@ -40,7 +40,7 @@ SPI only: - st75256 - jlx172104 and jlx256128 variants - uc1701 - dogs102 and mini12864 variants -This integration is based on [v2.19.8](https://github.com/olikraus/U8g2_Arduino/releases/tag/2.19.8). +This integration uses full "RAM" memory buffer without picture loop and calls u8g2's `begin()` internally when creating a display object. It is based on [v2.19.8](https://github.com/olikraus/U8g2_Arduino/releases/tag/2.19.8). ## Overview