ThingPulse/minigrafx

Screen does not update after gfx.commit()

mattncsu opened this issue · 1 comments

I have my screen updating code in a function and it works fine 95% of the time on the first time it is called, however, if I update some variables and call my refreshDisplay() function. I see a lot of output on the serial monitor but the display never refreshes.

#include <SPI.h>
#include "EPD_WaveShare.h"
#include "MiniGrafx.h"
#include "DisplayDriver.h"
uint16_t palette[] = {0, 1};
EPD_WaveShare epd(EPD2_9, CS, RST, DC, BUSY);
MiniGrafx gfx = MiniGrafx(&epd, BITS_PER_PIXEL, palette);

void refreshDisplay(){
uint32_t getVcc = ESP.getVcc();
float voltage=getVcc*(5.0/3204.0);
gfx.setRotation(0);
gfx.setTextRotation(0);
gfx.fillBuffer(1);
gfx.setColor(0);
gfx.setTextAlignment(TEXT_ALIGN_LEFT);
gfx.drawLine(0, 225, 296, 225);
gfx.drawLine(0, 224, 296, 224);
gfx.setFont(ArialMT_Plain_10);
gfx.drawString(90,286,(String)voltage+"V");
gfx.drawString(1,286, WiFi.localIP().toString());
gfx.setTextAlignment(TEXT_ALIGN_CENTER_BOTH);
gfx.setFont(Dialog_bold_18);
gfx.drawString(gfx.getWidth()/2, gfx.getHeight()/2+30, (String)random(1,10000));
gfx.commit();
}

At the end of setup() I call the refreshDisplay as such:

  gfx.init();
  refreshDisplay();

I'm using the Waveshare 2.9" EPD. Hopefully I am just missing something basic here. There is no difference in serial output between a cycle that refreshes and one that doesn't. Sometimes instead of not refreshing, the screen just gets darker and darker until I do a power cycle of the ESP8266.