nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.64k stars 3.12k forks source link

setContrast not working with NodeMCU and ST7565 board #3483

Closed JohannieK closed 2 years ago

JohannieK commented 2 years ago

Expected behavior

Contrast of the display should change when calling setContrast

Actual behavior

no change in display contrast

Test code

include

include

ifdef U8X8_HAVE_HW_SPI

include

endif

ifdef U8X8_HAVE_HW_I2C

include

endif

U8G2_ST7565_JLX12864_F_4W_HW_SPI u8g2(U8G2_R0, / cs=/ D3, / dc=/ D2, / reset=/ D4);

void u8g2_prepare(void) { u8g2.setFont(u8g2_font_6x10_tf); u8g2.setFontRefHeightExtendedText(); u8g2.setDrawColor(1); u8g2.setFontPosTop(); u8g2.setFontDirection(0); }

void setup(void) { Serial.begin(115200); Serial.println(" "); Serial.println("Starting up"); u8g2.begin();

Serial.println("Started up"); }

byte ct = 0; char buff[10];

void loop(void) { Serial.print("Contrast : "); Serial.println(ct); // picture loop
u8g2.setContrast(ct); u8g2.clearBuffer(); u8g2_prepare(); dtostrf(ct,5,0,buff); u8g2.drawStr(1,1,buff); u8g2.sendBuffer();

ct++; if (ct>=255) ct = 0;

// deley between each page delay(100);

}

NodeMCU startup banner

I don't know how to get this. This is the board I'm using: https://www.banggood.com/5Pcs-NodeMcu-Lua-WIFI-Internet-Things-Development-Board-Based-ESP8266-CP2102-Wireless-Module-p-1121408.html?rmmds=myorder&cur_warehouse=CN

Hardware

NodeMCU board: https://www.banggood.com/5Pcs-NodeMcu-Lua-WIFI-Internet-Things-Development-Board-Based-ESP8266-CP2102-Wireless-Module-p-1121408.html?rmmds=myorder&cur_warehouse=CN St7565 Display: https://www.banggood.com/OPEN-SMART-3_3V-2_4-inch-128+64-Serial-SPI-Monochrome-LCD-Display-Board-Module-without-Backlight-for-Arduino-UN0-Nano-p-1901540.html?rmmds=myorder&cur_warehouse=CN

JohannieK commented 2 years ago

Sorry for posting here. Should have been in the u8g2 project.