watchy lib 1.3 fixes
This commit is contained in:
@@ -19,10 +19,6 @@ const unsigned char *pieces[19] = {
|
||||
const float MAX_VBAT = 4.20;
|
||||
const float MIN_VBAT = 3.80;
|
||||
|
||||
WatchyTetris::WatchyTetris()
|
||||
{
|
||||
} //constructor
|
||||
|
||||
void WatchyTetris::drawWatchFace()
|
||||
{
|
||||
readWorldTime();
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
class WatchyTetris : public WatchySynced
|
||||
{
|
||||
public:
|
||||
WatchyTetris();
|
||||
void drawWatchFace();
|
||||
void drawNumber(int x, int y, int value, int max_digits);
|
||||
double random();
|
||||
using WatchySynced::WatchySynced;
|
||||
public:
|
||||
void drawWatchFace();
|
||||
void drawNumber(int x, int y, int value, int max_digits);
|
||||
double random();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
//Weather Settings
|
||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
||||
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id=" //open weather api
|
||||
#define TEMP_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||
#define TEMP_LANG "en"
|
||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||
//NTP Settings
|
||||
#define NTP_SERVER "pool.ntp.org"
|
||||
#define GMT_OFFSET_SEC 3600 * 1 //New York is UTC -5
|
||||
#define DST_OFFSET_SEC 3600
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC,
|
||||
DST_OFFSET_SEC
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Watchy_Tetris.h"
|
||||
#include "settings.h"
|
||||
|
||||
WatchyTetris watchy;
|
||||
WatchyTetris watchy(settings);
|
||||
|
||||
void setup()
|
||||
{
|
||||
|
||||
@@ -20,14 +20,13 @@ void WatchySynced::readWorldTime()
|
||||
JSONVar responseObject = JSON.parse(payload);
|
||||
tmElements_t tm;
|
||||
String datetime = String((const char *)responseObject["datetime"]);
|
||||
tm.Year = datetime.substring(0, 4).toInt() - YEAR_OFFSET;
|
||||
tm.Year = y2kYearToTm(datetime.substring(0, 4).toInt());
|
||||
tm.Month = datetime.substring(5, 7).toInt();
|
||||
tm.Day = datetime.substring(8, 10).toInt();
|
||||
tm.Hour = datetime.substring(11, 13).toInt();
|
||||
tm.Minute = datetime.substring(14, 16).toInt();
|
||||
tm.Second = 0;
|
||||
time_t t = makeTime(tm);
|
||||
RTC.set(t);
|
||||
RTC.set(tm);
|
||||
RTC.read(currentTime);
|
||||
worldTimeIntervalCounter = WTA_UPDATE_LONG_INTERVAL;
|
||||
}
|
||||
@@ -40,4 +39,4 @@ void WatchySynced::readWorldTime()
|
||||
{
|
||||
worldTimeIntervalCounter = worldTimeIntervalCounter < 0 ? 0 : worldTimeIntervalCounter - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
|
||||
class WatchySynced : public Watchy
|
||||
{
|
||||
public:
|
||||
void readWorldTime();
|
||||
using Watchy::Watchy;
|
||||
public:
|
||||
void readWorldTime();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user