Fix time synchronization (1970 00:00:00) issue

This commit is contained in:
Daniel Eichhorn
2017-08-17 08:23:00 +02:00
parent 4473b5c7bd
commit 0cd773058c
2 changed files with 5 additions and 6 deletions

View File

@@ -156,6 +156,7 @@ void setup() {
gfx.fillBuffer(MINI_BLACK); gfx.fillBuffer(MINI_BLACK);
gfx.commit(); gfx.commit();
connectWifi();
ts.begin(); ts.begin();
@@ -248,8 +249,7 @@ void loop() {
// Update the internet based information and update screen // Update the internet based information and update screen
void updateData() { void updateData() {
WiFi.mode(WIFI_STA);
connectWifi();
gfx.fillBuffer(MINI_BLACK); gfx.fillBuffer(MINI_BLACK);
gfx.setFont(ArialRoundedMTBold_14); gfx.setFont(ArialRoundedMTBold_14);
@@ -275,7 +275,6 @@ void updateData() {
astronomyClient = nullptr; astronomyClient = nullptr;
moonAgeImage = String((char) (65 + 26 * (((15 + astronomy.moonAge.toInt()) % 30) / 30.0))); moonAgeImage = String((char) (65 + 26 * (((15 + astronomy.moonAge.toInt()) % 30) / 30.0)));
WiFi.mode(WIFI_OFF);
delay(1000); delay(1000);
} }

View File

@@ -24,7 +24,7 @@ See more at http://blog.squix.ch
#define WIFI_SSID "yourssid" #define WIFI_SSID "yourssid"
#define WIFI_PASS "yourpassw0rd" #define WIFI_PASS "yourpassw0rd"
const int UPDATE_INTERVAL_SECS = 10 * 60; // Update every 10 minutes const int UPDATE_INTERVAL_SECS = 15 * 60; // Update every 10 minutes
const int SLEEP_INTERVAL_SECS = 0; // Going to Sleep after idle times, set 0 for dont sleep const int SLEEP_INTERVAL_SECS = 0; // Going to Sleep after idle times, set 0 for dont sleep
@@ -45,8 +45,8 @@ const int SLEEP_INTERVAL_SECS = 0; // Going to Sleep after idle times, set 0 f
// e.g. http://api.wunderground.com/api/808ba87ed77c4511/conditions/q/CH/Zurich.json // e.g. http://api.wunderground.com/api/808ba87ed77c4511/conditions/q/CH/Zurich.json
// e.g. http://api.wunderground.com/api/808ba87ed77c4511/conditions/q/CA/SAN_FRANCISCO.json <- note that in the US you use the state instead of country code // e.g. http://api.wunderground.com/api/808ba87ed77c4511/conditions/q/CA/SAN_FRANCISCO.json <- note that in the US you use the state instead of country code
const String DISPLAYED_CITY_NAME = "Zürich"; const String DISPLAYED_CITY_NAME = "Zurich";
const String WUNDERGRROUND_API_KEY = "<WUNDERGRROUND_API_KEY>"; const String WUNDERGRROUND_API_KEY = "<YOUR_WUNDERGROUND_API_KEY>";
const String WUNDERGRROUND_LANGUAGE = "EN"; const String WUNDERGRROUND_LANGUAGE = "EN";
const String WUNDERGROUND_COUNTRY = "CH"; const String WUNDERGROUND_COUNTRY = "CH";
const String WUNDERGROUND_CITY = "Zurich"; const String WUNDERGROUND_CITY = "Zurich";