I just posted this topic but in the wrong section, but its already gone, so here in the right section
I have an OLED shield for the WEMOS D1 mini. I have it in I2C mode connected together with a BME280 sensor on pins D1 and D2.
Everything works!!
However after a 'while' (haven't watched it happen yet) the screen turns black. The ESP is still communicating everthing, so thats still working.
When I reset the Wemos the screen pops on back on again.
2 Questions:
- how do i reset the wemos display ( one solution could simply be resetting the screen every hours or so)
- does anyone know the cause for this problem and how to resolve it?
In case its relevant:
Using U8G2 libs to run the OLED. with the following constructor:
U8G2_SSD1306_64X48_ER_F_HW_I2C u8g2(U8G2_R0);
And here's the code:
void updateOLED(){
char output[16] = "";
//full screen buffer method
u8g2.clearBuffer();
//show the dots on the screen edges
drawOledBoundingboxes();
//draw the current temp LARGE
//arduino does not support floats, so convert to two integers pre and post dot.
int preDot = (int)currentT;
int postDot = int((currentT - int(currentT))*10+0.5);
snprintf(output, sizeof(output), "%d.%d", preDot,postDot);
u8g2.setFont(u8g2_font_helvB24_te);
u8g2.drawStr(1,25,output);
//draw the target temp small
preDot = (int)targetT;
postDot = int((targetT - int(targetT))*10+0.5);
snprintf(output, sizeof(output), "%d.%d", preDot,postDot);
u8g2.setFont(u8g2_font_7x14_tr);
u8g2.drawStr(1,47,output);
/*NOT RELEASED YET: U8G2 VERSION 2.22
u8g2.setFont(open_iconic_thing_2x);
u8g2.drawGlyph(33, 47, 0x004E); // flame
u8g2.setFont(open_iconic_weather_2x);
u8g2.drawGlyph(16, 47, 0x0042); // moon
u8g2.setFont(open_iconic_embedded_2x);
u8g2.drawGlyph(0, 47, 0x0048); // wrench */
//draw the heat and maintenance indicators
u8g2.setFont(u8g2_font_7x14_tr);
u8g2.drawStr(38,47,(maintenanceOn)? "M" : "");
u8g2.drawStr(56,47,(heatOn)? "H" : "");
//if H and M are not shown, show the humidity
snprintf(output, sizeof(output), "%d", (int)currentH);
u8g2.drawStr(36,47,(!heatOn&&!maintenanceOn)? output : "");
//draw screen
u8g2.sendBuffer();
}