Current internal/exernal temp working

This commit is contained in:
Paul Warren 2019-12-30 19:13:01 +11:00
parent f2a4654804
commit b6cc0797c8

View file

@ -63,9 +63,9 @@ void wait(void) { delay(1500);}
// globals for the temperature :( // globals for the temperature :(
float current_outside; const char* current_outside;
float current_bedroom; const char* current_bedroom;
float current_lounge; const char* current_lounge;
void setup() { void setup() {
pinMode(led, OUTPUT); pinMode(led, OUTPUT);
@ -231,13 +231,12 @@ void printDateTime(int update_epd)
wait(); wait();
} }
sprintf(buf, "%s %.2d %s %d Ext: %.2f Int: %.2f", sprintf(buf, "%s %.2d %s %d",
dayShortStr(weekday(t)), dayShortStr(weekday(t)),
day(t), day(t),
m, m,
year(t), year(t));
current_outside,
current_lounge);
Serial.println(buf); Serial.println(buf);
if (update_epd > 0) { if (update_epd > 0) {
@ -245,10 +244,21 @@ void printDateTime(int update_epd)
epd_disp_string(buf, 5, 225); epd_disp_string(buf, 5, 225);
wait(); wait();
} }
sprintf(buf, "E: %s I: %s",
current_outside,
current_lounge);
Serial.println(buf);
if (update_epd > 0) {
epd_disp_string(buf, 500, 225);
wait();
}
} }
void weatherUpdate(void) { void weatherUpdate(void) {
const size_t capacity = 4*JSON_OBJECT_SIZE(3) + 150; const size_t capacity = 4*JSON_OBJECT_SIZE(3) + JSON_OBJECT_SIZE(4) + 150;
DynamicJsonBuffer jsonBuffer(capacity); DynamicJsonBuffer jsonBuffer(capacity);
http.begin(ds_url); http.begin(ds_url);
int httpCode = http.GET(); int httpCode = http.GET();
@ -276,12 +286,16 @@ void weatherUpdate(void) {
const char* day_after_icon = day_after["icon"]; // "pcloud.jpg" const char* day_after_icon = day_after["icon"]; // "pcloud.jpg"
const char* day_after_max = day_after["max"]; // "33" const char* day_after_max = day_after["max"]; // "33"
JsonObject current = doc["current"]; JsonObject& current = root["current"];
current_outside = current["outside"]; current_outside = current["outside"];
current_bedroom = current["bedroom"]; current_bedroom = current["bedroom"];
current_lounge = current["lounge"]; current_lounge = current["lounge"];
Serial.println(current_outside);
Serial.println(current_lounge);
Serial.println(current_bedroom);
Serial.println("Updating EPD"); Serial.println("Updating EPD with weather");
epd_set_en_font(ASCII64); epd_set_en_font(ASCII64);