|
|
|
@ -265,46 +265,48 @@ void weatherUpdate(void) {
|
|
|
|
|
|
|
|
|
|
const char* today_day = jsonBuffer["today"]["day"]; // "Wednesday"
|
|
|
|
|
const char* today_icon = jsonBuffer["today"]["icon"]; // "sunny.jpg"
|
|
|
|
|
const char* today_max = jsonBuffer["today"]["max"]; // "27"
|
|
|
|
|
int today_max = jsonBuffer["today"]["max"]; // "27"
|
|
|
|
|
|
|
|
|
|
const char* tomorrow_day = jsonBuffer["tomorrow"]["day"]; // "Thursday"
|
|
|
|
|
const char* tomorrow_icon = jsonBuffer["tomorrow"]["icon"]; // "sunny.jpg"
|
|
|
|
|
const char* tomorrow_max = jsonBuffer["tomorrow"]["max"]; // "31"
|
|
|
|
|
int tomorrow_max = jsonBuffer["tomorrow"]["max"]; // "31"
|
|
|
|
|
|
|
|
|
|
const char* day_after_day = jsonBuffer["day_after"]["day"]; // "Friday"
|
|
|
|
|
const char* day_after_icon = jsonBuffer["day_after"]["icon"]; // "pcloud.jpg"
|
|
|
|
|
const char* day_after_max = jsonBuffer["day_after"]["max"]; // "33"
|
|
|
|
|
int day_after_max = jsonBuffer["day_after"]["max"]; // "33"
|
|
|
|
|
|
|
|
|
|
current_outside = jsonBuffer["current"]["outside"];
|
|
|
|
|
current_bedroom = jsonBuffer["current"]["bedroom"];
|
|
|
|
|
current_lounge = jsonBuffer["current"]["lounge"];
|
|
|
|
|
int current_outside = jsonBuffer["current"]["outside"];
|
|
|
|
|
int current_bedroom = jsonBuffer["current"]["bedroom"];
|
|
|
|
|
int current_lounge = jsonBuffer["current"]["lounge"];
|
|
|
|
|
|
|
|
|
|
Serial.println("Updating EPD with weather");
|
|
|
|
|
|
|
|
|
|
epd_set_en_font(ASCII64);
|
|
|
|
|
|
|
|
|
|
//Today
|
|
|
|
|
epd_disp_bitmap(today_icon, 0, 290);
|
|
|
|
|
epd_disp_bitmap(today_icon, 0, 290);
|
|
|
|
|
epd_disp_string(today_day, 0, 536);
|
|
|
|
|
epd_disp_string(today_max, 75, 460);
|
|
|
|
|
|
|
|
|
|
sprintf(buf, "%d", today_max);
|
|
|
|
|
epd_disp_string(buf, 75, 460);
|
|
|
|
|
|
|
|
|
|
//Tomorrow
|
|
|
|
|
epd_disp_bitmap(tomorrow_icon, 267, 290);
|
|
|
|
|
epd_disp_string(tomorrow_day, 260, 536);
|
|
|
|
|
epd_disp_string(tomorrow_max, 352, 460);
|
|
|
|
|
sprintf(buf, "%d", tomorrow_max);
|
|
|
|
|
epd_disp_string(buf, 352, 460);
|
|
|
|
|
|
|
|
|
|
//Day After
|
|
|
|
|
epd_disp_bitmap(day_after_icon, 533, 290);
|
|
|
|
|
epd_disp_string(day_after_day, 533, 536);
|
|
|
|
|
epd_disp_string(day_after_max, 615, 460);
|
|
|
|
|
|
|
|
|
|
Serial.println("Adding Temps");
|
|
|
|
|
sprintf(buf, "E: %s I: %s",
|
|
|
|
|
sprintf(buf, "%d", day_after_max);
|
|
|
|
|
epd_disp_string(buf, 615, 460);
|
|
|
|
|
|
|
|
|
|
//Serial.println("Adding Temps");
|
|
|
|
|
sprintf(buf, "E: %d I: %d",
|
|
|
|
|
current_outside,
|
|
|
|
|
current_lounge);
|
|
|
|
|
Serial.println(buf);
|
|
|
|
|
|
|
|
|
|
epd_disp_string(buf, 500, 225);
|
|
|
|
|
//Serial.println(buf);
|
|
|
|
|
epd_disp_string(buf, 500, 225);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Serial.print("Error on HTTP Request: ");
|
|
|
|
@ -331,17 +333,23 @@ void loop() {
|
|
|
|
|
Serial.print("Weather details sent: ");
|
|
|
|
|
Serial.println(second(now()));
|
|
|
|
|
printDateTime(1);
|
|
|
|
|
|
|
|
|
|
Serial.println("Waiting on minute to change");
|
|
|
|
|
while (second(now()) != 0) {
|
|
|
|
|
delay(500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Serial.println("EPD Update");
|
|
|
|
|
epd_update();
|
|
|
|
|
delay(1500);
|
|
|
|
|
delay(4000);
|
|
|
|
|
Serial.println("EPD Stop");
|
|
|
|
|
epd_enter_stopmode();
|
|
|
|
|
|
|
|
|
|
sleep_seconds = wakeup_seconds - second(now());
|
|
|
|
|
|
|
|
|
|
if (sleep_seconds < 0) {
|
|
|
|
|
sleep_seconds = 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Serial.print("Sleeping for: ");
|
|
|
|
|
Serial.println(sleep_seconds);
|
|
|
|
|