Compare commits

...

18 Commits

Author SHA1 Message Date
sqfmi e5556cb700 Merge branch 'dev' 2022-12-30 02:01:35 -05:00
SQFMI 83aada6452
Merge pull request #201 from sukhpalhub/wifi-feature
Issue #89 Added mac address and local ip
2022-12-30 01:57:52 -05:00
Sukhpal Singh 3a7eff4a8e Remove wifi setup guide from readme 2022-12-30 14:23:32 +10:00
Sukhpal Singh 9ac9aeded9 Issue #89 Added mac address and local ip
- Displayed mac address when setting up wifi
- Display local ip when wifi is connected from the setup
2022-12-28 01:12:48 +10:00
SQFMI ef0534e92b Update to version 1.4.5 2022-12-27 03:39:09 +00:00
SQFMI 2cdfeaa0d1
Merge pull request #199 from sqfmi/dev
Dev
2022-12-26 12:53:02 -05:00
SQFMI 9a64af8b3d
Merge pull request #178 from DarkZeros/OptimizeDisplay
Optimise GxEPD2 Display
2022-12-26 12:21:00 -05:00
SQFMI 5921655691
Merge pull request #188 from shtrom/fix/gmtOffset_from_weather
Set GMT offset from weatherdata. Will override GMT offset in settings after API call.
2022-12-26 12:16:40 -05:00
SQFMI 472eee733d
Merge branch 'master' into fix/gmtOffset_from_weather 2022-12-26 12:15:56 -05:00
SQFMI 6e41b9c982
Merge pull request #190 from shtrom/feature/exit-inactive-menu
Exit menu after some inactive time
2022-12-26 12:07:11 -05:00
Olivier Mehani dd3797f2d5
Exit menu after some inactive time
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
2022-12-07 22:27:34 +11:00
SQFMI c5344d9d42
Merge pull request #189 from shtrom/feature/vibrate-o-clock
Vibrate every hour on the dot
2022-11-13 04:18:05 -05:00
Olivier Mehani cbb4820d85
fixup! Add opion to vibrate every hour (and on reset) 2022-10-26 23:31:36 +11:00
Olivier Mehani c750754e8a
fixup! Get gmtOffset from weather data, for use in all NTP requests 2022-10-24 22:20:12 +11:00
Olivier Mehani 5f07f2ec63
Add opion to vibrate every hour (and on reset)
Set watchySettings.vibrateOClock to true

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
2022-10-16 22:30:49 +11:00
Olivier Mehani b0e405e187
Use designated initialisers for watchySettings
This [0] allows to skip obsolete fields, and generally not have to rely
on field ordering.

[0] https://www.cppstories.com/2021/designated-init-cpp20/

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
2022-10-16 22:30:21 +11:00
Olivier Mehani 2bd89ef250
Get gmtOffset from weather data, for use in all NTP requests
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
2022-10-16 22:29:21 +11:00
SQFMI eb43be0634
Update README.md 2022-10-14 22:37:50 -04:00
12 changed files with 115 additions and 77 deletions

View File

@ -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.
@ -24,3 +25,8 @@ You may also have to install the [CP2104 USB to Serial drivers](https://www.sila
### Have Fun! :)
### Got Questions?
Join our [Discord](https://discord.gg/ZXDegGV8E7)

View File

@ -10,17 +10,18 @@
#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 * -5 //New York is UTC -5 EST, -4 EDT
#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
#endif

View File

@ -10,17 +10,17 @@
#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 * -5 //New York is UTC -5 EST, -4 EDT
#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
#endif

View File

@ -10,17 +10,17 @@
#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 * -5 //New York is UTC -5 EST, -4 EDT
#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
#endif

View File

@ -10,17 +10,17 @@
#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 * -5 //New York is UTC -5 EST, -4 EDT
#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
#endif

View File

@ -10,17 +10,17 @@
#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 * -5 //New York is UTC -5 EST, -4 EDT
#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
#endif

View File

@ -10,17 +10,17 @@
#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 * -5 //New York is UTC -5 EST, -4 EDT
#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
#endif

View File

@ -10,17 +10,17 @@
#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 * -5 //New York is UTC -5 EST, -4 EDT
#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
#endif

View File

@ -1,6 +1,6 @@
{
"name": "Watchy",
"version": "1.4.3",
"version": "1.4.5",
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
"authors": [
{

View File

@ -1,5 +1,5 @@
name=Watchy
version=1.4.3
version=1.4.5
author=SQFMI
maintainer=SQFMI
sentence=Watchy - An Open Source E-Paper Watch by SQFMI

View File

@ -12,6 +12,8 @@ RTC_DATA_ATTR bool BLE_CONFIGURED;
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;
@ -27,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
@ -38,8 +57,10 @@ void Watchy::init(String datetime) {
default: // reset
RTC.config(datetime);
_bmaConfig();
gmtOffset = settings.gmtOffset;
RTC.read(currentTime);
showWatchFace(false); // full update on reset
vibMotor(75, 4);
break;
}
deepSleep();
@ -257,6 +278,7 @@ void Watchy::showMenu(byte menuIndex, bool partialRefresh) {
display.display(partialRefresh);
guiState = MAIN_MENU_STATE;
alreadyInMenu = false;
}
void Watchy::showFastMenu(byte menuIndex) {
@ -620,7 +642,8 @@ weatherData Watchy::getWeatherData(String cityID, String units, String lang,
JSONVar::stringify(responseObject["weather"][0]["main"]);
currentWeather.external = true;
// sync NTP during weather API call and use timezone of city
syncNTP(long(responseObject["timezone"]));
gmtOffset = int(responseObject["timezone"]);
syncNTP(gmtOffset);
} else {
// http error
}
@ -786,6 +809,8 @@ void Watchy::setupWifi() {
} else {
display.println("Connected to");
display.println(WiFi.SSID());
display.println("Local IP:");
display.println(WiFi.localIP());
}
display.display(false); // full refresh
// turn off radios
@ -807,6 +832,8 @@ void Watchy::_configModeCallback(WiFiManager *myWiFiManager) {
display.println(WIFI_AP_SSID);
display.print("IP: ");
display.println(WiFi.softAPIP());
display.println("MAC address:");
display.println(WiFi.softAPmacAddress().c_str());
display.display(false); // full refresh
}
@ -942,6 +969,8 @@ void Watchy::showSyncNTP() {
display.setTextColor(GxEPD_WHITE);
display.setCursor(0, 30);
display.println("Syncing NTP... ");
display.print("GMT offset: ");
display.println(gmtOffset);
display.display(false); // full refresh
if (connectWiFi()) {
if (syncNTP()) {
@ -979,7 +1008,7 @@ void Watchy::showSyncNTP() {
bool Watchy::syncNTP() { // NTP sync - call after connecting to WiFi and
// remember to turn it back off
return syncNTP(settings.gmtOffset,
return syncNTP(gmtOffset,
settings.ntpServer.c_str());
}

View File

@ -37,6 +37,8 @@ typedef struct watchySettings {
String ntpServer;
int gmtOffset;
int dstOffset;
//
bool vibrateOClock;
} watchySettings;
class Watchy {