From b6cc0797c8243b30187da6c881b7e1f4df41b654 Mon Sep 17 00:00:00 2001 From: Paul Warren Date: Mon, 30 Dec 2019 19:13:01 +1100 Subject: [PATCH] Current internal/exernal temp working --- esp_time.ino | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/esp_time.ino b/esp_time.ino index 821c489..c043eb5 100644 --- a/esp_time.ino +++ b/esp_time.ino @@ -63,9 +63,9 @@ void wait(void) { delay(1500);} // globals for the temperature :( -float current_outside; -float current_bedroom; -float current_lounge; +const char* current_outside; +const char* current_bedroom; +const char* current_lounge; void setup() { pinMode(led, OUTPUT); @@ -231,13 +231,12 @@ void printDateTime(int update_epd) wait(); } - sprintf(buf, "%s %.2d %s %d Ext: %.2f Int: %.2f", + sprintf(buf, "%s %.2d %s %d", dayShortStr(weekday(t)), day(t), m, - year(t), - current_outside, - current_lounge); + year(t)); + Serial.println(buf); if (update_epd > 0) { @@ -245,10 +244,21 @@ void printDateTime(int update_epd) epd_disp_string(buf, 5, 225); 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) { - 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); http.begin(ds_url); 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_max = day_after["max"]; // "33" - JsonObject current = doc["current"]; - current_outside = current["outside"]; - current_bedroom = current["bedroom"]; - current_lounge = current["lounge"]; + JsonObject& current = root["current"]; + current_outside = current["outside"]; + current_bedroom = current["bedroom"]; + 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);