mirror of https://github.com/sqfmi/Watchy.git
Merge branch 'master' into fix/gmtOffset_from_weather
commit
472eee733d
|
@ -15,8 +15,9 @@ Visit [**https://watchy.sqfmi.com**](https://watchy.sqfmi.com) for documentation
|
|||
2. Install this library (search for **Watchy** in the library manager), and any other dependencies when prompted
|
||||
3. Check out the examples under ```Examples``` -> ```Watchy```
|
||||
4. Compile & Upload with these board settings:
|
||||
* Board: "ESP32 Dev Module"
|
||||
* Board: "Watchy"
|
||||
* Partition Scheme: "Huge App"
|
||||
* Board Revision: Choose your Watchy version
|
||||
* All Other Settings: leave to default
|
||||
|
||||
You may also have to install the [CP2104 USB to Serial drivers](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers) if the port is not automatically detected.
|
||||
|
|
|
@ -13,14 +13,15 @@
|
|||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC
|
||||
.cityID = CITY_ID,
|
||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||
.weatherURL = OPENWEATHERMAP_URL,
|
||||
.weatherUnit = TEMP_UNIT,
|
||||
.weatherLang = TEMP_LANG,
|
||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||
.ntpServer = NTP_SERVER,
|
||||
.gmtOffset = GMT_OFFSET_SEC,
|
||||
.vibrateOClock = true,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC
|
||||
.cityID = CITY_ID,
|
||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||
.weatherURL = OPENWEATHERMAP_URL,
|
||||
.weatherUnit = TEMP_UNIT,
|
||||
.weatherLang = TEMP_LANG,
|
||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||
.ntpServer = NTP_SERVER,
|
||||
.gmtOffset = GMT_OFFSET_SEC,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC
|
||||
.cityID = CITY_ID,
|
||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||
.weatherURL = OPENWEATHERMAP_URL,
|
||||
.weatherUnit = TEMP_UNIT,
|
||||
.weatherLang = TEMP_LANG,
|
||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||
.ntpServer = NTP_SERVER,
|
||||
.gmtOffset = GMT_OFFSET_SEC,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC
|
||||
.cityID = CITY_ID,
|
||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||
.weatherURL = OPENWEATHERMAP_URL,
|
||||
.weatherUnit = TEMP_UNIT,
|
||||
.weatherLang = TEMP_LANG,
|
||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||
.ntpServer = NTP_SERVER,
|
||||
.gmtOffset = GMT_OFFSET_SEC,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC
|
||||
.cityID = CITY_ID,
|
||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||
.weatherURL = OPENWEATHERMAP_URL,
|
||||
.weatherUnit = TEMP_UNIT,
|
||||
.weatherLang = TEMP_LANG,
|
||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||
.ntpServer = NTP_SERVER,
|
||||
.gmtOffset = GMT_OFFSET_SEC,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC
|
||||
.cityID = CITY_ID,
|
||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||
.weatherURL = OPENWEATHERMAP_URL,
|
||||
.weatherUnit = TEMP_UNIT,
|
||||
.weatherLang = TEMP_LANG,
|
||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||
.ntpServer = NTP_SERVER,
|
||||
.gmtOffset = GMT_OFFSET_SEC,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||
|
||||
watchySettings settings{
|
||||
CITY_ID,
|
||||
OPENWEATHERMAP_APIKEY,
|
||||
OPENWEATHERMAP_URL,
|
||||
TEMP_UNIT,
|
||||
TEMP_LANG,
|
||||
WEATHER_UPDATE_INTERVAL,
|
||||
NTP_SERVER,
|
||||
GMT_OFFSET_SEC
|
||||
.cityID = CITY_ID,
|
||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||
.weatherURL = OPENWEATHERMAP_URL,
|
||||
.weatherUnit = TEMP_UNIT,
|
||||
.weatherLang = TEMP_LANG,
|
||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||
.ntpServer = NTP_SERVER,
|
||||
.gmtOffset = GMT_OFFSET_SEC,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,6 +13,7 @@ RTC_DATA_ATTR weatherData currentWeather;
|
|||
RTC_DATA_ATTR int weatherIntervalCounter = -1;
|
||||
RTC_DATA_ATTR bool displayFullInit = true;
|
||||
RTC_DATA_ATTR long gmtOffset = 0;
|
||||
RTC_DATA_ATTR bool alreadyInMenu = true;
|
||||
|
||||
void Watchy::init(String datetime) {
|
||||
esp_sleep_wakeup_cause_t wakeup_reason;
|
||||
|
@ -28,9 +29,26 @@ void Watchy::init(String datetime) {
|
|||
|
||||
switch (wakeup_reason) {
|
||||
case ESP_SLEEP_WAKEUP_EXT0: // RTC Alarm
|
||||
if (guiState == WATCHFACE_STATE) {
|
||||
RTC.read(currentTime);
|
||||
RTC.read(currentTime);
|
||||
switch (guiState) {
|
||||
case WATCHFACE_STATE:
|
||||
showWatchFace(true); // partial updates on tick
|
||||
if (settings.vibrateOClock) {
|
||||
if (currentTime.Minute == 0) {
|
||||
// The RTC wakes us up once per minute
|
||||
vibMotor(75, 4);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MAIN_MENU_STATE:
|
||||
// Return to watchface if in menu for more than one tick
|
||||
if (alreadyInMenu) {
|
||||
guiState = WATCHFACE_STATE;
|
||||
showWatchFace(false);
|
||||
} else {
|
||||
alreadyInMenu = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ESP_SLEEP_WAKEUP_EXT1: // button Press
|
||||
|
@ -42,6 +60,7 @@ void Watchy::init(String datetime) {
|
|||
gmtOffset = settings.gmtOffset;
|
||||
RTC.read(currentTime);
|
||||
showWatchFace(false); // full update on reset
|
||||
vibMotor(75, 4);
|
||||
break;
|
||||
}
|
||||
deepSleep();
|
||||
|
@ -259,6 +278,7 @@ void Watchy::showMenu(byte menuIndex, bool partialRefresh) {
|
|||
display.display(partialRefresh);
|
||||
|
||||
guiState = MAIN_MENU_STATE;
|
||||
alreadyInMenu = false;
|
||||
}
|
||||
|
||||
void Watchy::showFastMenu(byte menuIndex) {
|
||||
|
|
|
@ -35,6 +35,8 @@ typedef struct watchySettings {
|
|||
String ntpServer;
|
||||
int gmtOffset;
|
||||
int dstOffset;
|
||||
//
|
||||
bool vibrateOClock;
|
||||
} watchySettings;
|
||||
|
||||
class Watchy {
|
||||
|
|
Loading…
Reference in New Issue