Closed ristomatti closed 4 years ago
This is not a code issue with this software, it's a hardware issue when trying to drive a 3-colour display. There has to be enough RAM to hold programme variables and 3xscreen buffers rather than 2 for B/W. You can use the half-size buffer options of the GxEPD2, otherwise there is little than can be done to solve the problem. I have already moved as many constants and little used variables to flash, and in any event adding more won't save a screen full of RAM required to drive the display.
It wasn't my intention to indicate this as a code problem but rather ask a question. I will look into the half-size buffer options, thanks for the tip and the quick response!
OK, I understand, try the half-size buffer option, it works. Each screen (B/W/R) requires about 30K so ~90K total, so actually you should have enough RAM. The JSON decoding should drop it's buffer after use, so before drawing, maybe try display the heap and stack size on the serial port to see what the issue might be, may not be memory.
@G6EJD I admit this is a more than a little over my head but the code compiles after changing the constructor to:
GxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT / 2> display(GxEPD2_750c_Z08(/*CS=*/ EPD_CS, /*DC=*/ EPD_DC, /*RST=*/ EPD_RST, /*BUSY=*/ EPD_BUSY)); // 3-colour displays
The display also updates to black color but (unsurprisingly) draws only the top side of the display. Maybe this was not what you meant? :grin:
Nevermind, I found the link to https://github.com/olikraus/u8glib/wiki/tpictureloop from GxEPD2 documentation. I managed to get the display to draw after replacing display(false);
in setup()
with the below snippet. I suppose this is what you were after? It seems to work pretty much just as fast.
if (RxWeather && RxForecast)
{ // Only if received both Weather or Forecast proceed
StopWiFi(); // Reduces power consumption
display.firstPage();
do {
DisplayWeather();
} while (display.nextPage());
}
OK, glad you go it running OK.
I'm having issues compiling for Waveshare 7.5" color display using PlatformIO. The compilation fails with the below message:
So it appears the code doesn't fit to DRAM. Any tips on reducing the memory consumption?
I was able to compile it with
#include <GxEPD2_BW.h>
and using theGxEPD2_3C<GxEPD2_750c_Z08, GxEPD2_750c_Z08::HEIGHT> display
constructor. However using the graphics/text end up being dim red. When the screen refreshes it goes through a nice crisp black which it then replaces with dark red and eventually a pale red color.To compile I have done the following changes:
platformio.ini
:Added forward declarations to functions (PIO compiles as
.cpp
)Included
GxEPD2_3C.h
:Changed display initialization: