Formatting
This commit is contained in:
parent
0670fbc35f
commit
bb665628a7
@ -28,7 +28,8 @@ void setup()
|
|||||||
|
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
Serial.println("Connecting");
|
Serial.println("Connecting");
|
||||||
while(WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED)
|
||||||
|
{
|
||||||
delay(1000);
|
delay(1000);
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
}
|
}
|
||||||
@ -43,7 +44,8 @@ void setup()
|
|||||||
hibernate_and_restart();
|
hibernate_and_restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void fetchAndDrawImage(const char* url) {
|
void fetchAndDrawImage(const char *url)
|
||||||
|
{
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
|
|
||||||
http.begin(url);
|
http.begin(url);
|
||||||
@ -52,7 +54,8 @@ void fetchAndDrawImage(const char* url) {
|
|||||||
http.addHeader("Content-Type", "application/json");
|
http.addHeader("Content-Type", "application/json");
|
||||||
int httpCode = http.POST(einkDisplayProperties);
|
int httpCode = http.POST(einkDisplayProperties);
|
||||||
|
|
||||||
if (httpCode > 0) {
|
if (httpCode > 0)
|
||||||
|
{
|
||||||
int length = http.getSize();
|
int length = http.getSize();
|
||||||
|
|
||||||
Serial.print("Length of payload: ");
|
Serial.print("Length of payload: ");
|
||||||
@ -64,14 +67,17 @@ void fetchAndDrawImage(const char* url) {
|
|||||||
drawImage(payload);
|
drawImage(payload);
|
||||||
|
|
||||||
delete[] payload;
|
delete[] payload;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Serial.println("Error on HTTP request");
|
Serial.println("Error on HTTP request");
|
||||||
}
|
}
|
||||||
|
|
||||||
http.end();
|
http.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void hibernate_and_restart() {
|
void hibernate_and_restart()
|
||||||
|
{
|
||||||
// Go to sleep and wake up later
|
// Go to sleep and wake up later
|
||||||
Serial.print("Begining hibernation. Waking up in ");
|
Serial.print("Begining hibernation. Waking up in ");
|
||||||
Serial.print(HIBERNATE_TIME_SEC);
|
Serial.print(HIBERNATE_TIME_SEC);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user