Screen does not update after gfx.commit()
mattncsu opened this issue · 1 comments
mattncsu commented
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.
squix78 commented
I honestly didn't have too much time yet to test the 2.9" display intensively. But two things strike me: only call setRotation and init() once in the setup and not with every iteration and see if this has an effect...
…Sent from my iPhone
On 8 Aug 2017, at 05:48, mattncsu ***@***.***> wrote:
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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.