diff --git a/firmware/lib/epd7in3f/epd7in3f.cpp b/firmware/lib/epd7in3f/epd7in3f.cpp index 470452e..35493d4 100644 --- a/firmware/lib/epd7in3f/epd7in3f.cpp +++ b/firmware/lib/epd7in3f/epd7in3f.cpp @@ -34,14 +34,10 @@ #include #include "epd7in3f.h" -Epd::~Epd(){}; +Epd::Epd(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height) + : EpdIf(reset_pin, dc_pin, cs_pin, busy_pin, width, height) {} -Epd::Epd(UWORD width, UWORD height, int busyPin, int restPin, int dcPin, int csPin) - : EpdIf(busyPin, restPin, dcPin, csPin) -{ - width = width; - height = height; -}; +Epd::~Epd(){}; /****************************************************************************** function : Initialize the e-Paper register diff --git a/firmware/lib/epd7in3f/epd7in3f.h b/firmware/lib/epd7in3f/epd7in3f.h index 41c9bb2..e4d48ce 100644 --- a/firmware/lib/epd7in3f/epd7in3f.h +++ b/firmware/lib/epd7in3f/epd7in3f.h @@ -53,7 +53,7 @@ Color Index class Epd : EpdIf { public: - Epd(UWORD width, UWORD height, int busyPin, int restPin, int dcPin, int csPin); + Epd(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height); ~Epd(); int Init(void); void EPD_7IN3F_BusyHigh(void); @@ -67,10 +67,6 @@ public: void SendData(unsigned char data); void Sleep(void); void Clear(UBYTE color); - -private: - unsigned long width; - unsigned long height; }; #endif /* EPD5IN83B_HD_H */ diff --git a/firmware/lib/epd7in3f/epdif.cpp b/firmware/lib/epd7in3f/epdif.cpp index 633e32d..5b59b5a 100644 --- a/firmware/lib/epd7in3f/epdif.cpp +++ b/firmware/lib/epd7in3f/epdif.cpp @@ -30,15 +30,15 @@ #ifdef EPD7IN3F -EpdIf::EpdIf(int busyPin, int restPin, int dcPin, int csPin) -{ - reset_pin = restPin; - dc_pin = dcPin; - cs_pin = csPin; - busy_pin = busyPin; -}; +EpdIf::EpdIf(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height) + : reset_pin(reset_pin), + dc_pin(dc_pin), + cs_pin(cs_pin), + busy_pin(busy_pin), + width(width), + height(height) {} -EpdIf::~EpdIf(){}; +EpdIf::~EpdIf() {} void EpdIf::DigitalWrite(int pin, int value) { diff --git a/firmware/lib/epd7in3f/epdif.h b/firmware/lib/epd7in3f/epdif.h index e5a338b..bfb08ad 100644 --- a/firmware/lib/epd7in3f/epdif.h +++ b/firmware/lib/epd7in3f/epdif.h @@ -28,25 +28,35 @@ #ifndef EPDIF_H #define EPDIF_H +// #define DISPLAY_WIDTH 800 +// #define DISPLAY_HEIGHT 480 + +// #define BUSY_PIN 26 +// #define RST_PIN 27 +// #define DC_PIN 15 +// #define CS_PIN 14 + #include class EpdIf { public: - EpdIf(int busyPin, int restPin, int dcPin, int csPin); - ~EpdIf(void); + EpdIf(int reset_pin, int dc_pin, int cs_pin, int busy_pin, int width, int height); + ~EpdIf(); - int IfInit(void); + int IfInit(); void DigitalWrite(int pin, int value); int DigitalRead(int pin); void DelayMs(unsigned int delaytime); void SpiTransfer(unsigned char data); protected: - unsigned int reset_pin; - unsigned int dc_pin; - unsigned int cs_pin; - unsigned int busy_pin; + int reset_pin; + int dc_pin; + int cs_pin; + int busy_pin; + int width; + int height; }; #endif diff --git a/firmware/src/displays/color7.h b/firmware/src/displays/color7.h index aed3377..ac3fc78 100644 --- a/firmware/src/displays/color7.h +++ b/firmware/src/displays/color7.h @@ -47,7 +47,7 @@ const char *einkDisplayProperties = R"json( } )json"; -Epd epd(DISPLAY_WIDTH, DISPLAY_HEIGHT, BUSY_PIN, RST_PIN, DC_PIN, CS_PIN); +Epd epd(RST_PIN, DC_PIN, CS_PIN, BUSY_PIN, DISPLAY_WIDTH, DISPLAY_HEIGHT); void initDisplay() { @@ -60,8 +60,6 @@ void initDisplay() void drawImage(uint8_t *image) { - Serial.println("Wake up display"); - epd.Reset(); Serial.println("Draw image"); epd.EPD_7IN3F_Display(image); Serial.println("Put display to sleep"); diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp index 643e4fd..69164d1 100644 --- a/firmware/src/main.cpp +++ b/firmware/src/main.cpp @@ -5,25 +5,27 @@ #include "eink.h" #include "network.h" -void fetchAndDrawImage(); +void fetchAndDrawImage(const char *url); void hibernate_and_restart(); const char *ssid = WIFI_SSID; const char *password = WIFI_PASSWORD; -#define HIBERNATE_TIME_SEC 120 // hibernate time in seconds +#define HIBERNATE_TIME_SEC 5 // hibernate time in seconds +// #define HIBERNATE_TIME_SEC 120 // hibernate time in seconds -const char *serverName = "http://192.168.3.133:8080/fetchImage"; +const char *clearImage = "http://192.168.3.192:8080/clearImage"; +const char *fetchImage = "http://192.168.3.192:8080/fetchImage"; +const char *calibrationImage = "http://192.168.3.192:8080/calibrationImage"; void setup() { - // put your setup code here, to run once: Serial.begin(9600); - initDisplay(); - delay(3000); + initDisplay(); + WiFi.begin(ssid, password); Serial.println("Connecting"); while(WiFi.status() != WL_CONNECTED) {