Current internal/exernal temp working
This commit is contained in:
parent
f2a4654804
commit
b6cc0797c8
1 changed files with 27 additions and 13 deletions
34
esp_time.ino
34
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"];
|
||||
JsonObject& current = root["current"];
|
||||
current_outside = current["outside"];
|
||||
current_bedroom = current["bedroom"];
|
||||
current_lounge = current["lounge"];
|
||||
|
||||
Serial.println("Updating EPD");
|
||||
Serial.println(current_outside);
|
||||
Serial.println(current_lounge);
|
||||
Serial.println(current_bedroom);
|
||||
|
||||
Serial.println("Updating EPD with weather");
|
||||
|
||||
epd_set_en_font(ASCII64);
|
||||
|
||||
|
|
Loading…
Reference in a new issue