mirror of https://github.com/sqfmi/Watchy.git
Compare commits
30 Commits
Author | SHA1 | Date |
---|---|---|
SQFMI | 667d86737d | |
SQFMI | d65738fbaa | |
SQFMI | 2dd98737fb | |
SQFMI | 5a5b343737 | |
sqfmi | 2da3fd9ede | |
SQFMI | acbb6eeece | |
sqfmi | c1c95f9587 | |
sqfmi | bd1657e9c7 | |
sqfmi | fbbcaabbd1 | |
SQFMI | e9854a7fa2 | |
sqfmi | fddbe504c1 | |
sqfmi | aa3528371d | |
sqfmi | 3ffb0f8697 | |
sqfmi | b786f24240 | |
sqfmi | 2528878570 | |
sqfmi | 1b15c1b5fe | |
Daniel Ansorregui | be185cbd54 | |
Daniel Ansorregui | f369b6f207 | |
Daniel Ansorregui | 8103df1499 | |
Daniel Ansorregui | 84c0cd106c | |
Daniel Ansorregui | 3ce125247d | |
Daniel Ansorregui | f2c0c91a61 | |
Daniel Ansorregui | 2b21e50c2f | |
Sudrien | b84ab91c6b | |
Sean M. Collins | b8eeda70c6 | |
Sean M. Collins | a719bfa116 | |
Sean M. Collins | 459cc2a18f | |
Denis Pitzalis | df5fce8d40 | |
SQFMI | 342eb48a49 | |
wjgeorge | 98fd0abfeb |
|
@ -7,14 +7,31 @@ jobs:
|
||||||
release:
|
release:
|
||||||
name: Build and Release
|
name: Build and Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
board-revisions: [v10, v15, v20]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- uses: ArminJo/arduino-test-compile@v3
|
- uses: ArminJo/arduino-test-compile@v3
|
||||||
with:
|
with:
|
||||||
arduino-board-fqbn: esp32:esp32:watchy:Revision=v20,PartitionScheme=min_spiffs,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
|
arduino-board-fqbn: esp32:esp32:watchy:Revision=${{ matrix.board-revisions }},PartitionScheme=min_spiffs,UploadSpeed=921600,DebugLevel=none,EraseFlash=none
|
||||||
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
|
||||||
required-libraries: Adafruit GFX Library,Arduino_JSON,DS3232RTC,NTPClient,Rtc_Pcf8563,GxEPD2,WiFiManager
|
required-libraries: Adafruit GFX Library,Arduino_JSON,DS3232RTC,NTPClient,Rtc_Pcf8563,GxEPD2,WiFiManager
|
||||||
set-build-path: true
|
set-build-path: true
|
||||||
|
- name: Rename binaries with board revision
|
||||||
|
run: |
|
||||||
|
parent_dir="${{ github.workspace }}/examples/WatchFaces"
|
||||||
|
for dir in "$parent_dir"/*; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
cd "$dir/build"
|
||||||
|
for file in *; do
|
||||||
|
name="${file%%.*}"
|
||||||
|
ext="${file#$name.}"
|
||||||
|
mv "$file" "$name-${{ matrix.board-revisions }}.$ext"
|
||||||
|
done
|
||||||
|
cd -
|
||||||
|
fi
|
||||||
|
done
|
||||||
- uses: softprops/action-gh-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
name: "Watchy Arduino Library ${{ github.ref_name }}"
|
name: "Watchy Arduino Library ${{ github.ref_name }}"
|
||||||
|
|
|
@ -125,24 +125,29 @@ void Watchy7SEG::drawWeather(){
|
||||||
display.drawBitmap(165, 110, currentWeather.isMetric ? celsius : fahrenheit, 26, 20, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
display.drawBitmap(165, 110, currentWeather.isMetric ? celsius : fahrenheit, 26, 20, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
||||||
const unsigned char* weatherIcon;
|
const unsigned char* weatherIcon;
|
||||||
|
|
||||||
//https://openweathermap.org/weather-conditions
|
if(WIFI_CONFIGURED){
|
||||||
if(weatherConditionCode > 801){//Cloudy
|
//https://openweathermap.org/weather-conditions
|
||||||
weatherIcon = cloudy;
|
if(weatherConditionCode > 801){//Cloudy
|
||||||
}else if(weatherConditionCode == 801){//Few Clouds
|
weatherIcon = cloudy;
|
||||||
weatherIcon = cloudsun;
|
}else if(weatherConditionCode == 801){//Few Clouds
|
||||||
}else if(weatherConditionCode == 800){//Clear
|
weatherIcon = cloudsun;
|
||||||
weatherIcon = sunny;
|
}else if(weatherConditionCode == 800){//Clear
|
||||||
}else if(weatherConditionCode >=700){//Atmosphere
|
weatherIcon = sunny;
|
||||||
weatherIcon = atmosphere;
|
}else if(weatherConditionCode >=700){//Atmosphere
|
||||||
}else if(weatherConditionCode >=600){//Snow
|
weatherIcon = atmosphere;
|
||||||
weatherIcon = snow;
|
}else if(weatherConditionCode >=600){//Snow
|
||||||
}else if(weatherConditionCode >=500){//Rain
|
weatherIcon = snow;
|
||||||
weatherIcon = rain;
|
}else if(weatherConditionCode >=500){//Rain
|
||||||
}else if(weatherConditionCode >=300){//Drizzle
|
weatherIcon = rain;
|
||||||
weatherIcon = drizzle;
|
}else if(weatherConditionCode >=300){//Drizzle
|
||||||
}else if(weatherConditionCode >=200){//Thunderstorm
|
weatherIcon = drizzle;
|
||||||
weatherIcon = thunderstorm;
|
}else if(weatherConditionCode >=200){//Thunderstorm
|
||||||
}else
|
weatherIcon = thunderstorm;
|
||||||
return;
|
}else
|
||||||
|
return;
|
||||||
|
}else{
|
||||||
|
weatherIcon = chip;
|
||||||
|
}
|
||||||
|
|
||||||
display.drawBitmap(145, 158, weatherIcon, WEATHER_ICON_WIDTH, WEATHER_ICON_HEIGHT, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
display.drawBitmap(145, 158, weatherIcon, WEATHER_ICON_WIDTH, WEATHER_ICON_HEIGHT, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,21 @@ const unsigned char thunderstorm[] PROGMEM = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x01,
|
0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
// 'cputemp', 48x32px
|
||||||
|
const unsigned char cputemp [] PROGMEM = {
|
||||||
|
0x00, 0x01, 0x8c, 0xe7, 0x00, 0x00, 0x00, 0x01, 0x8c, 0xe7, 0x00, 0x00, 0x00, 0x01, 0x8c, 0xe7,
|
||||||
|
0x00, 0x00, 0x00, 0x01, 0x8c, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
|
||||||
|
0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x03, 0xef, 0xff, 0xff, 0xef, 0x80,
|
||||||
|
0x03, 0xef, 0xff, 0xff, 0xef, 0x80, 0x03, 0xef, 0xff, 0xff, 0xe7, 0x80, 0x00, 0x0f, 0xff, 0xff,
|
||||||
|
0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x03, 0xef, 0xff, 0xff, 0xef, 0x80, 0x03, 0xef,
|
||||||
|
0xff, 0xff, 0xef, 0x80, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00,
|
||||||
|
0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x03, 0xef, 0xff, 0xff, 0xef, 0x80, 0x03, 0xef, 0xff, 0xff,
|
||||||
|
0xef, 0x80, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f,
|
||||||
|
0xff, 0xff, 0xe0, 0x00, 0x03, 0xef, 0xff, 0xff, 0xef, 0x80, 0x03, 0xef, 0xff, 0xff, 0xef, 0x80,
|
||||||
|
0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8c, 0xe7, 0x00, 0x00, 0x00, 0x01,
|
||||||
|
0x8c, 0xe7, 0x00, 0x00, 0x00, 0x01, 0x8c, 0xe7, 0x00, 0x00, 0x00, 0x01, 0x8c, 0xe7, 0x00, 0x00
|
||||||
|
};
|
||||||
// 'steps', 19x23px
|
// 'steps', 19x23px
|
||||||
const unsigned char steps [] PROGMEM = {
|
const unsigned char steps [] PROGMEM = {
|
||||||
0x00, 0x03, 0xc0, 0x00, 0x07, 0xe0, 0x00, 0x07, 0xe0, 0x00, 0x0f, 0xe0, 0x78, 0x0f, 0xe0, 0xfc,
|
0x00, 0x03, 0xc0, 0x00, 0x07, 0xe0, 0x00, 0x07, 0xe0, 0x00, 0x0f, 0xe0, 0x78, 0x0f, 0xe0, 0xfc,
|
||||||
|
@ -174,3 +189,19 @@ const unsigned char wifioff [] PROGMEM = {
|
||||||
0x01, 0xff, 0xc0, 0x00, 0x07, 0xe1, 0xc0, 0x00, 0x0f, 0xc0, 0x80, 0x00, 0x1f, 0x0c, 0x00, 0x00,
|
0x01, 0xff, 0xc0, 0x00, 0x07, 0xe1, 0xc0, 0x00, 0x0f, 0xc0, 0x80, 0x00, 0x1f, 0x0c, 0x00, 0x00,
|
||||||
0x3c, 0x1e, 0x00, 0x00, 0xf8, 0x0c, 0x00, 0x00
|
0x3c, 0x1e, 0x00, 0x00, 0xf8, 0x0c, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
// 'chip', 48x32px
|
||||||
|
const unsigned char chip [] PROGMEM = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x48, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x12, 0x48, 0x00, 0x00, 0x00, 0x00, 0x12, 0x48, 0x00, 0x00, 0x00, 0x00, 0x12, 0x48, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x1f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01,
|
||||||
|
0x00, 0x00, 0x00, 0x0f, 0x87, 0xf9, 0xf0, 0x00, 0x00, 0x00, 0x88, 0x09, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x90, 0x09, 0x00, 0x00, 0x00, 0x0f, 0x90, 0x09, 0xf0, 0x00, 0x00, 0x00, 0x90, 0x09, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x90, 0x09, 0x00, 0x00, 0x00, 0x0f, 0x90, 0x09, 0xf0, 0x00, 0x00, 0x00, 0x90, 0x09,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x90, 0x09, 0x00, 0x00, 0x00, 0x0f, 0x9f, 0xf9, 0xf0, 0x00, 0x00, 0x00,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x12, 0x48, 0x00, 0x00, 0x00, 0x00, 0x12, 0x48, 0x00, 0x00, 0x00, 0x00, 0x12, 0x48,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x12, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -24,4 +40,4 @@ watchySettings settings{
|
||||||
.vibrateOClock = true,
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -21,6 +37,7 @@ watchySettings settings{
|
||||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
.ntpServer = NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
.gmtOffset = GMT_OFFSET_SEC,
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -21,6 +37,7 @@ watchySettings settings{
|
||||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
.ntpServer = NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
.gmtOffset = GMT_OFFSET_SEC,
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -21,6 +37,7 @@ watchySettings settings{
|
||||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
.ntpServer = NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
.gmtOffset = GMT_OFFSET_SEC,
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -24,4 +40,4 @@ watchySettings settings{
|
||||||
.vibrateOClock = true,
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -21,6 +37,7 @@ watchySettings settings{
|
||||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
.ntpServer = NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
.gmtOffset = GMT_OFFSET_SEC,
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -21,6 +37,7 @@ watchySettings settings{
|
||||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
.ntpServer = NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
.gmtOffset = GMT_OFFSET_SEC,
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
//Weather Settings
|
//Weather Settings
|
||||||
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
#define CITY_ID "5128581" //New York City https://openweathermap.org/current#cityid
|
||||||
|
|
||||||
|
//You can also use LAT,LON for your location instead of CITY_ID, but not both
|
||||||
|
//#define LAT "40.7127" //New York City, Looked up on https://www.latlong.net/
|
||||||
|
//#define LON "-74.0059"
|
||||||
|
|
||||||
|
#ifdef CITY_ID
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?id={cityID}&lang={lang}&units={units}&appid={apiKey}" //open weather api using city ID
|
||||||
|
#else
|
||||||
|
#define OPENWEATHERMAP_URL "http://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&lang={lang}&units={units}&appid={apiKey}" //open weather api using lat lon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPENWEATHERMAP_APIKEY "f058fe1cad2afe8e2ddc5d063a64cecb" //use your own API key :)
|
#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_UNIT "metric" //metric = Celsius , imperial = Fahrenheit
|
||||||
#define TEMP_LANG "en"
|
#define TEMP_LANG "en"
|
||||||
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
#define WEATHER_UPDATE_INTERVAL 30 //must be greater than 5, measured in minutes
|
||||||
|
@ -13,7 +23,13 @@
|
||||||
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
#define GMT_OFFSET_SEC 3600 * -5 //New York is UTC -5 EST, -4 EDT, will be overwritten by weather data
|
||||||
|
|
||||||
watchySettings settings{
|
watchySettings settings{
|
||||||
.cityID = CITY_ID,
|
#ifdef CITY_ID
|
||||||
|
.cityID = CITY_ID,
|
||||||
|
#else
|
||||||
|
.cityID = "",
|
||||||
|
.lat = LAT,
|
||||||
|
.lon = LON,
|
||||||
|
#endif
|
||||||
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
.weatherAPIKey = OPENWEATHERMAP_APIKEY,
|
||||||
.weatherURL = OPENWEATHERMAP_URL,
|
.weatherURL = OPENWEATHERMAP_URL,
|
||||||
.weatherUnit = TEMP_UNIT,
|
.weatherUnit = TEMP_UNIT,
|
||||||
|
@ -21,6 +37,7 @@ watchySettings settings{
|
||||||
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
.weatherUpdateInterval = WEATHER_UPDATE_INTERVAL,
|
||||||
.ntpServer = NTP_SERVER,
|
.ntpServer = NTP_SERVER,
|
||||||
.gmtOffset = GMT_OFFSET_SEC,
|
.gmtOffset = GMT_OFFSET_SEC,
|
||||||
|
.vibrateOClock = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Watchy",
|
"name": "Watchy",
|
||||||
"version": "1.4.7",
|
"version": "1.4.10",
|
||||||
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
|
"description": "Watchy - An Open Source E-Paper Watch by SQFMI",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name=Watchy
|
name=Watchy
|
||||||
version=1.4.7
|
version=1.4.10
|
||||||
author=SQFMI
|
author=SQFMI
|
||||||
maintainer=SQFMI
|
maintainer=SQFMI
|
||||||
sentence=Watchy - An Open Source E-Paper Watch by SQFMI
|
sentence=Watchy - An Open Source E-Paper Watch by SQFMI
|
||||||
|
|
126
src/Display.cpp
126
src/Display.cpp
|
@ -15,11 +15,44 @@
|
||||||
// Link: https://github.com/sqfmi/Watchy
|
// Link: https://github.com/sqfmi/Watchy
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
WatchyDisplay::WatchyDisplay(int16_t cs, int16_t dc, int16_t rst, int16_t busy) :
|
RTC_DATA_ATTR bool displayFullInit = true;
|
||||||
GxEPD2_EPD(cs, dc, rst, busy, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
|
|
||||||
|
void WatchyDisplay::busyCallback(const void *) {
|
||||||
|
gpio_wakeup_enable((gpio_num_t)DISPLAY_BUSY, GPIO_INTR_LOW_LEVEL);
|
||||||
|
esp_sleep_enable_gpio_wakeup();
|
||||||
|
esp_light_sleep_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
WatchyDisplay::WatchyDisplay() :
|
||||||
|
GxEPD2_EPD(DISPLAY_CS, DISPLAY_DC, DISPLAY_RES, DISPLAY_BUSY, HIGH, 10000000, WIDTH, HEIGHT, panel, hasColor, hasPartialUpdate, hasFastPartialUpdate)
|
||||||
{
|
{
|
||||||
selectSPI(SPI, SPISettings(20000000, MSBFIRST, SPI_MODE0)); // Set SPI to 20Mhz (default is 4Mhz)
|
// Setup callback and SPI by default
|
||||||
|
selectSPI(SPI, SPISettings(20000000, MSBFIRST, SPI_MODE0));
|
||||||
|
setBusyCallback(busyCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchyDisplay::initWatchy() {
|
||||||
|
// Watchy default initialization
|
||||||
|
init(0, displayFullInit, 2, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchyDisplay::asyncPowerOn() {
|
||||||
|
// This is expensive if unused
|
||||||
|
if (!waitingPowerOn && !_hibernating) {
|
||||||
|
_InitDisplay();
|
||||||
|
_PowerOnAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WatchyDisplay::setDarkBorder(bool dark) {
|
||||||
|
if (_hibernating) return;
|
||||||
|
darkBorder = dark;
|
||||||
|
_startTransfer();
|
||||||
|
_transferCommand(0x3C); // BorderWavefrom
|
||||||
|
_transfer(dark ? 0x02 : 0x05);
|
||||||
|
_endTransfer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchyDisplay::clearScreen(uint8_t value)
|
void WatchyDisplay::clearScreen(uint8_t value)
|
||||||
|
@ -324,31 +357,52 @@ void WatchyDisplay::_setPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint1
|
||||||
_endTransfer();
|
_endTransfer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchyDisplay::_PowerOnAsync()
|
||||||
|
{
|
||||||
|
if (_power_is_on)
|
||||||
|
return;
|
||||||
|
_startTransfer();
|
||||||
|
_transferCommand(0x22);
|
||||||
|
_transfer(0xf8);
|
||||||
|
_transferCommand(0x20);
|
||||||
|
_endTransfer();
|
||||||
|
waitingPowerOn = true;
|
||||||
|
_power_is_on = true;
|
||||||
|
}
|
||||||
|
|
||||||
void WatchyDisplay::_PowerOn()
|
void WatchyDisplay::_PowerOn()
|
||||||
{
|
{
|
||||||
if (!_power_is_on)
|
if (waitingPowerOn)
|
||||||
{
|
{
|
||||||
_startTransfer();
|
waitingPowerOn = false;
|
||||||
_transferCommand(0x22);
|
|
||||||
_transfer(0xf8);
|
|
||||||
_transferCommand(0x20);
|
|
||||||
_endTransfer();
|
|
||||||
_waitWhileBusy("_PowerOn", power_on_time);
|
_waitWhileBusy("_PowerOn", power_on_time);
|
||||||
}
|
}
|
||||||
|
if (_power_is_on)
|
||||||
|
return;
|
||||||
|
_startTransfer();
|
||||||
|
_transferCommand(0x22);
|
||||||
|
_transfer(0xf8);
|
||||||
|
_transferCommand(0x20);
|
||||||
|
_endTransfer();
|
||||||
|
_waitWhileBusy("_PowerOn", power_on_time);
|
||||||
_power_is_on = true;
|
_power_is_on = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchyDisplay::_PowerOff()
|
void WatchyDisplay::_PowerOff()
|
||||||
{
|
{
|
||||||
if (_power_is_on)
|
if (waitingPowerOn)
|
||||||
{
|
{
|
||||||
_startTransfer();
|
waitingPowerOn = false;
|
||||||
_transferCommand(0x22);
|
_waitWhileBusy("_PowerOn", power_on_time);
|
||||||
_transfer(0x83);
|
|
||||||
_transferCommand(0x20);
|
|
||||||
_endTransfer();
|
|
||||||
_waitWhileBusy("_PowerOff", power_off_time);
|
|
||||||
}
|
}
|
||||||
|
if (!_power_is_on)
|
||||||
|
return;
|
||||||
|
_startTransfer();
|
||||||
|
_transferCommand(0x22);
|
||||||
|
_transfer(0x83);
|
||||||
|
_transferCommand(0x20);
|
||||||
|
_endTransfer();
|
||||||
|
_waitWhileBusy("_PowerOff", power_off_time);
|
||||||
_power_is_on = false;
|
_power_is_on = false;
|
||||||
_using_partial_mode = false;
|
_using_partial_mode = false;
|
||||||
}
|
}
|
||||||
|
@ -356,23 +410,54 @@ void WatchyDisplay::_PowerOff()
|
||||||
void WatchyDisplay::_InitDisplay()
|
void WatchyDisplay::_InitDisplay()
|
||||||
{
|
{
|
||||||
if (_hibernating) _reset();
|
if (_hibernating) _reset();
|
||||||
_writeCommand(0x12); // soft reset
|
|
||||||
_waitWhileBusy("_SoftReset", 10); // 10ms max according to specs
|
// No need to soft reset, the Display goes to same state after hard reset
|
||||||
|
// _writeCommand(0x12); // soft reset
|
||||||
|
// _waitWhileBusy("_SoftReset", 10); // 10ms max according to specs*/
|
||||||
|
|
||||||
_startTransfer();
|
_startTransfer();
|
||||||
_transferCommand(0x01); // Driver output control
|
_transferCommand(0x01); // Driver output control
|
||||||
_transfer(0xC7);
|
_transfer(0xC7);
|
||||||
_transfer(0x00);
|
_transfer(0x00);
|
||||||
_transfer(0x00);
|
_transfer(0x00);
|
||||||
_transferCommand(0x3C); // BorderWavefrom
|
|
||||||
_transfer(darkBorder ? 0x02 : 0x05);
|
if (reduceBoosterTime) {
|
||||||
|
// SSD1675B controller datasheet
|
||||||
|
_transferCommand(0x0C); // BOOSTER_SOFT_START_CONTROL
|
||||||
|
// Set the driving strength of GDR for all phases to maximun 0b111 -> 0xF
|
||||||
|
// Set the minimum off time of GDR to minimum 0x4 (values below sould be same)
|
||||||
|
_transfer(0xF4); // Phase1 Default value 0x8B
|
||||||
|
_transfer(0xF4); // Phase2 Default value 0x9C
|
||||||
|
_transfer(0xF4); // Phase3 Default value 0x96
|
||||||
|
_transfer(0x00); // Duration of phases, Default 0xF = 0b00 11 11 (40ms Phase 1/2, 10ms Phase 3)
|
||||||
|
}
|
||||||
|
|
||||||
_transferCommand(0x18); // Read built-in temperature sensor
|
_transferCommand(0x18); // Read built-in temperature sensor
|
||||||
_transfer(0x80);
|
_transfer(0x80);
|
||||||
_endTransfer();
|
_endTransfer();
|
||||||
|
|
||||||
|
setDarkBorder(darkBorder);
|
||||||
|
|
||||||
_setPartialRamArea(0, 0, WIDTH, HEIGHT);
|
_setPartialRamArea(0, 0, WIDTH, HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchyDisplay::_reset()
|
||||||
|
{
|
||||||
|
// Call default method if not configured the same way
|
||||||
|
if (_rst < 0 || !_pulldown_rst_mode) {
|
||||||
|
GxEPD2_EPD::_reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
digitalWrite(_rst, LOW);
|
||||||
|
pinMode(_rst, OUTPUT);
|
||||||
|
delay(_reset_duration);
|
||||||
|
pinMode(_rst, INPUT_PULLUP);
|
||||||
|
// Tested calling _powerOn() inmediately, and works ok, no need to sleep
|
||||||
|
// delay(_reset_duration > 10 ? _reset_duration : 0);
|
||||||
|
_hibernating = false;
|
||||||
|
}
|
||||||
|
|
||||||
void WatchyDisplay::_Init_Full()
|
void WatchyDisplay::_Init_Full()
|
||||||
{
|
{
|
||||||
_InitDisplay();
|
_InitDisplay();
|
||||||
|
@ -395,6 +480,7 @@ void WatchyDisplay::_Update_Full()
|
||||||
_transferCommand(0x20);
|
_transferCommand(0x20);
|
||||||
_endTransfer();
|
_endTransfer();
|
||||||
_waitWhileBusy("_Update_Full", full_refresh_time);
|
_waitWhileBusy("_Update_Full", full_refresh_time);
|
||||||
|
displayFullInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchyDisplay::_Update_Part()
|
void WatchyDisplay::_Update_Part()
|
||||||
|
|
|
@ -34,7 +34,13 @@ class WatchyDisplay : public GxEPD2_EPD
|
||||||
static const uint16_t full_refresh_time = 2600; // ms, e.g. 2509602us
|
static const uint16_t full_refresh_time = 2600; // ms, e.g. 2509602us
|
||||||
static const uint16_t partial_refresh_time = 500; // ms, e.g. 457282us
|
static const uint16_t partial_refresh_time = 500; // ms, e.g. 457282us
|
||||||
// constructor
|
// constructor
|
||||||
WatchyDisplay(int16_t cs, int16_t dc, int16_t rst, int16_t busy);
|
WatchyDisplay();
|
||||||
|
void initWatchy();
|
||||||
|
void setDarkBorder(bool darkBorder);
|
||||||
|
void asyncPowerOn();
|
||||||
|
void _PowerOnAsync();
|
||||||
|
bool waitingPowerOn = false;
|
||||||
|
static void busyCallback(const void *);
|
||||||
// methods (virtual)
|
// methods (virtual)
|
||||||
// Support for Bitmaps (Sprites) to Controller Buffer and to Screen
|
// Support for Bitmaps (Sprites) to Controller Buffer and to Screen
|
||||||
void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
|
void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
|
||||||
|
@ -69,6 +75,8 @@ class WatchyDisplay : public GxEPD2_EPD
|
||||||
void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
|
void hibernate(); // turns powerOff() and sets controller to deep sleep for minimum power use, ONLY if wakeable by RST (rst >= 0)
|
||||||
|
|
||||||
bool darkBorder = false; // adds a dark border outside the normal screen area
|
bool darkBorder = false; // adds a dark border outside the normal screen area
|
||||||
|
|
||||||
|
static constexpr bool reduceBoosterTime = true; // Saves ~200ms
|
||||||
private:
|
private:
|
||||||
void _writeScreenBuffer(uint8_t command, uint8_t value);
|
void _writeScreenBuffer(uint8_t command, uint8_t value);
|
||||||
void _writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
|
void _writeImage(uint8_t command, const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
|
||||||
|
@ -83,5 +91,7 @@ class WatchyDisplay : public GxEPD2_EPD
|
||||||
void _Update_Full();
|
void _Update_Full();
|
||||||
void _Update_Part();
|
void _Update_Part();
|
||||||
|
|
||||||
|
void _reset();
|
||||||
|
|
||||||
void _transferCommand(uint8_t command);
|
void _transferCommand(uint8_t command);
|
||||||
};
|
};
|
||||||
|
|
105
src/Watchy.cpp
105
src/Watchy.cpp
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
WatchyRTC Watchy::RTC;
|
WatchyRTC Watchy::RTC;
|
||||||
GxEPD2_BW<WatchyDisplay, WatchyDisplay::HEIGHT> Watchy::display(
|
GxEPD2_BW<WatchyDisplay, WatchyDisplay::HEIGHT> Watchy::display(
|
||||||
WatchyDisplay(DISPLAY_CS, DISPLAY_DC, DISPLAY_RES, DISPLAY_BUSY));
|
WatchyDisplay{});
|
||||||
|
|
||||||
RTC_DATA_ATTR int guiState;
|
RTC_DATA_ATTR int guiState;
|
||||||
RTC_DATA_ATTR int menuIndex;
|
RTC_DATA_ATTR int menuIndex;
|
||||||
|
@ -11,10 +11,11 @@ RTC_DATA_ATTR bool WIFI_CONFIGURED;
|
||||||
RTC_DATA_ATTR bool BLE_CONFIGURED;
|
RTC_DATA_ATTR bool BLE_CONFIGURED;
|
||||||
RTC_DATA_ATTR weatherData currentWeather;
|
RTC_DATA_ATTR weatherData currentWeather;
|
||||||
RTC_DATA_ATTR int weatherIntervalCounter = -1;
|
RTC_DATA_ATTR int weatherIntervalCounter = -1;
|
||||||
RTC_DATA_ATTR bool displayFullInit = true;
|
|
||||||
RTC_DATA_ATTR long gmtOffset = 0;
|
RTC_DATA_ATTR long gmtOffset = 0;
|
||||||
RTC_DATA_ATTR bool alreadyInMenu = true;
|
RTC_DATA_ATTR bool alreadyInMenu = true;
|
||||||
RTC_DATA_ATTR tmElements_t bootTime;
|
RTC_DATA_ATTR tmElements_t bootTime;
|
||||||
|
RTC_DATA_ATTR uint32_t lastIPAddress;
|
||||||
|
RTC_DATA_ATTR char lastSSID[30];
|
||||||
|
|
||||||
void Watchy::init(String datetime) {
|
void Watchy::init(String datetime) {
|
||||||
esp_sleep_wakeup_cause_t wakeup_reason;
|
esp_sleep_wakeup_cause_t wakeup_reason;
|
||||||
|
@ -22,11 +23,8 @@ void Watchy::init(String datetime) {
|
||||||
Wire.begin(SDA, SCL); // init i2c
|
Wire.begin(SDA, SCL); // init i2c
|
||||||
RTC.init();
|
RTC.init();
|
||||||
|
|
||||||
// Init the display here for all cases, if unused, it will do nothing
|
// Init the display since is almost sure we will use it
|
||||||
display.epd2.selectSPI(SPI, SPISettings(20000000, MSBFIRST, SPI_MODE0)); // Set SPI to 20Mhz (default is 4Mhz)
|
display.epd2.initWatchy();
|
||||||
display.init(0, displayFullInit, 10,
|
|
||||||
true); // 10ms by spec, and fast pulldown reset
|
|
||||||
display.epd2.setBusyCallback(displayBusyCallback);
|
|
||||||
|
|
||||||
switch (wakeup_reason) {
|
switch (wakeup_reason) {
|
||||||
case ESP_SLEEP_WAKEUP_EXT0: // RTC Alarm
|
case ESP_SLEEP_WAKEUP_EXT0: // RTC Alarm
|
||||||
|
@ -63,22 +61,14 @@ void Watchy::init(String datetime) {
|
||||||
RTC.read(bootTime);
|
RTC.read(bootTime);
|
||||||
showWatchFace(false); // full update on reset
|
showWatchFace(false); // full update on reset
|
||||||
vibMotor(75, 4);
|
vibMotor(75, 4);
|
||||||
|
// For some reason, seems to be enabled on first boot
|
||||||
|
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
deepSleep();
|
deepSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Watchy::displayBusyCallback(const void *) {
|
|
||||||
gpio_wakeup_enable((gpio_num_t)DISPLAY_BUSY, GPIO_INTR_LOW_LEVEL);
|
|
||||||
esp_sleep_enable_gpio_wakeup();
|
|
||||||
esp_light_sleep_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Watchy::deepSleep() {
|
void Watchy::deepSleep() {
|
||||||
display.hibernate();
|
display.hibernate();
|
||||||
if (displayFullInit) // For some reason, seems to be enabled on first boot
|
|
||||||
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
|
|
||||||
displayFullInit = false; // Notify not to init it again
|
|
||||||
RTC.clearAlarm(); // resets the alarm flag in the RTC
|
RTC.clearAlarm(); // resets the alarm flag in the RTC
|
||||||
|
|
||||||
// Set GPIOs 0-39 to input to avoid power leaking out
|
// Set GPIOs 0-39 to input to avoid power leaking out
|
||||||
|
@ -325,9 +315,8 @@ void Watchy::showAbout() {
|
||||||
display.print("LibVer: ");
|
display.print("LibVer: ");
|
||||||
display.println(WATCHY_LIB_VER);
|
display.println(WATCHY_LIB_VER);
|
||||||
|
|
||||||
const char *RTC_HW[3] = {"<UNKNOWN>", "DS3231", "PCF8563"};
|
display.print("Rev: v");
|
||||||
display.print("RTC: ");
|
display.println(getBoardRevision());
|
||||||
display.println(RTC_HW[RTC.rtcType]); // 0 = UNKNOWN, 1 = DS3231, 2 = PCF8563
|
|
||||||
|
|
||||||
display.print("Batt: ");
|
display.print("Batt: ");
|
||||||
float voltage = getBatteryVoltage();
|
float voltage = getBatteryVoltage();
|
||||||
|
@ -348,7 +337,15 @@ void Watchy::showAbout() {
|
||||||
display.print(hours);
|
display.print(hours);
|
||||||
display.print("h");
|
display.print("h");
|
||||||
display.print(minutes);
|
display.print(minutes);
|
||||||
display.print("m");
|
display.println("m");
|
||||||
|
if(WIFI_CONFIGURED){
|
||||||
|
display.print("SSID: ");
|
||||||
|
display.println(lastSSID);
|
||||||
|
display.print("IP: ");
|
||||||
|
display.println(IPAddress(lastIPAddress).toString());
|
||||||
|
}else{
|
||||||
|
display.println("WiFi Not Connected");
|
||||||
|
}
|
||||||
display.display(false); // full refresh
|
display.display(false); // full refresh
|
||||||
|
|
||||||
guiState = APP_STATE;
|
guiState = APP_STATE;
|
||||||
|
@ -606,6 +603,8 @@ void Watchy::showAccelerometer() {
|
||||||
|
|
||||||
void Watchy::showWatchFace(bool partialRefresh) {
|
void Watchy::showWatchFace(bool partialRefresh) {
|
||||||
display.setFullWindow();
|
display.setFullWindow();
|
||||||
|
// At this point it is sure we are going to update
|
||||||
|
display.epd2.asyncPowerOn();
|
||||||
drawWatchFace();
|
drawWatchFace();
|
||||||
display.display(partialRefresh); // partial refresh
|
display.display(partialRefresh); // partial refresh
|
||||||
guiState = WATCHFACE_STATE;
|
guiState = WATCHFACE_STATE;
|
||||||
|
@ -626,12 +625,12 @@ void Watchy::drawWatchFace() {
|
||||||
}
|
}
|
||||||
|
|
||||||
weatherData Watchy::getWeatherData() {
|
weatherData Watchy::getWeatherData() {
|
||||||
return getWeatherData(settings.cityID, settings.weatherUnit,
|
return _getWeatherData(settings.cityID, settings.lat, settings.lon,
|
||||||
settings.weatherLang, settings.weatherURL,
|
settings.weatherUnit, settings.weatherLang, settings.weatherURL,
|
||||||
settings.weatherAPIKey, settings.weatherUpdateInterval);
|
settings.weatherAPIKey, settings.weatherUpdateInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
weatherData Watchy::getWeatherData(String cityID, String units, String lang,
|
weatherData Watchy::_getWeatherData(String cityID, String lat, String lon, String units, String lang,
|
||||||
String url, String apiKey,
|
String url, String apiKey,
|
||||||
uint8_t updateInterval) {
|
uint8_t updateInterval) {
|
||||||
currentWeather.isMetric = units == String("metric");
|
currentWeather.isMetric = units == String("metric");
|
||||||
|
@ -644,9 +643,16 @@ weatherData Watchy::getWeatherData(String cityID, String units, String lang,
|
||||||
if (connectWiFi()) {
|
if (connectWiFi()) {
|
||||||
HTTPClient http; // Use Weather API for live data if WiFi is connected
|
HTTPClient http; // Use Weather API for live data if WiFi is connected
|
||||||
http.setConnectTimeout(3000); // 3 second max timeout
|
http.setConnectTimeout(3000); // 3 second max timeout
|
||||||
String weatherQueryURL = url + cityID + String("&units=") + units +
|
String weatherQueryURL = url;
|
||||||
String("&lang=") + lang + String("&appid=") +
|
if(cityID != ""){
|
||||||
apiKey;
|
weatherQueryURL.replace("{cityID}", cityID);
|
||||||
|
}else{
|
||||||
|
weatherQueryURL.replace("{lat}", lat);
|
||||||
|
weatherQueryURL.replace("{lon}", lon);
|
||||||
|
}
|
||||||
|
weatherQueryURL.replace("{units}", units);
|
||||||
|
weatherQueryURL.replace("{lang}", lang);
|
||||||
|
weatherQueryURL.replace("{apiKey}", apiKey);
|
||||||
http.begin(weatherQueryURL.c_str());
|
http.begin(weatherQueryURL.c_str());
|
||||||
int httpResponseCode = http.GET();
|
int httpResponseCode = http.GET();
|
||||||
if (httpResponseCode == 200) {
|
if (httpResponseCode == 200) {
|
||||||
|
@ -656,9 +662,11 @@ weatherData Watchy::getWeatherData(String cityID, String units, String lang,
|
||||||
currentWeather.weatherConditionCode =
|
currentWeather.weatherConditionCode =
|
||||||
int(responseObject["weather"][0]["id"]);
|
int(responseObject["weather"][0]["id"]);
|
||||||
currentWeather.weatherDescription =
|
currentWeather.weatherDescription =
|
||||||
JSONVar::stringify(responseObject["weather"][0]["main"]);
|
JSONVar::stringify(responseObject["weather"][0]["main"]);
|
||||||
currentWeather.external = true;
|
currentWeather.external = true;
|
||||||
// sync NTP during weather API call and use timezone of city
|
breakTime((time_t)(int)responseObject["sys"]["sunrise"], currentWeather.sunrise);
|
||||||
|
breakTime((time_t)(int)responseObject["sys"]["sunset"], currentWeather.sunset);
|
||||||
|
// sync NTP during weather API call and use timezone of lat & lon
|
||||||
gmtOffset = int(responseObject["timezone"]);
|
gmtOffset = int(responseObject["timezone"]);
|
||||||
syncNTP(gmtOffset);
|
syncNTP(gmtOffset);
|
||||||
} else {
|
} else {
|
||||||
|
@ -693,6 +701,31 @@ float Watchy::getBatteryVoltage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t Watchy::getBoardRevision() {
|
||||||
|
esp_chip_info_t chip_info;
|
||||||
|
esp_chip_info(&chip_info);
|
||||||
|
if(chip_info.model == CHIP_ESP32){ //Revision 1.0 - 2.0
|
||||||
|
Wire.beginTransmission(0x68); //v1.0 has DS3231
|
||||||
|
if (Wire.endTransmission() == 0){
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
delay(1);
|
||||||
|
Wire.beginTransmission(0x51); //v1.5 and v2.0 have PCF8563
|
||||||
|
if (Wire.endTransmission() == 0){
|
||||||
|
pinMode(35, INPUT);
|
||||||
|
if(digitalRead(35) == 0){
|
||||||
|
return 20; //in rev 2.0, pin 35 is BTN 3 and has a pulldown
|
||||||
|
}else{
|
||||||
|
return 15; //in rev 1.5, pin 35 is the battery ADC
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(chip_info.model == CHIP_ESP32S3){ //Revision 3.0
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t Watchy::_readRegister(uint8_t address, uint8_t reg, uint8_t *data,
|
uint16_t Watchy::_readRegister(uint8_t address, uint8_t reg, uint8_t *data,
|
||||||
uint16_t len) {
|
uint16_t len) {
|
||||||
Wire.beginTransmission(address);
|
Wire.beginTransmission(address);
|
||||||
|
@ -824,18 +857,20 @@ void Watchy::setupWifi() {
|
||||||
display.println("Setup failed &");
|
display.println("Setup failed &");
|
||||||
display.println("timed out!");
|
display.println("timed out!");
|
||||||
} else {
|
} else {
|
||||||
display.println("Connected to");
|
display.println("Connected to:");
|
||||||
display.println(WiFi.SSID());
|
display.println(WiFi.SSID());
|
||||||
display.println("Local IP:");
|
display.println("Local IP:");
|
||||||
display.println(WiFi.localIP());
|
display.println(WiFi.localIP());
|
||||||
weatherIntervalCounter = -1; // Reset to force weather to be read again
|
weatherIntervalCounter = -1; // Reset to force weather to be read again
|
||||||
|
lastIPAddress = WiFi.localIP();
|
||||||
|
WiFi.SSID().toCharArray(lastSSID, 30);
|
||||||
}
|
}
|
||||||
display.display(false); // full refresh
|
display.display(false); // full refresh
|
||||||
// turn off radios
|
// turn off radios
|
||||||
WiFi.mode(WIFI_OFF);
|
WiFi.mode(WIFI_OFF);
|
||||||
btStop();
|
btStop();
|
||||||
display.epd2.setBusyCallback(displayBusyCallback); // enable lightsleep on
|
// enable lightsleep on busy
|
||||||
// busy
|
display.epd2.setBusyCallback(WatchyDisplay::busyCallback);
|
||||||
guiState = APP_STATE;
|
guiState = APP_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,6 +898,8 @@ bool Watchy::connectWiFi() {
|
||||||
} else {
|
} else {
|
||||||
if (WL_CONNECTED ==
|
if (WL_CONNECTED ==
|
||||||
WiFi.waitForConnectResult()) { // attempt to connect for 10s
|
WiFi.waitForConnectResult()) { // attempt to connect for 10s
|
||||||
|
lastIPAddress = WiFi.localIP();
|
||||||
|
WiFi.SSID().toCharArray(lastSSID, 30);
|
||||||
WIFI_CONFIGURED = true;
|
WIFI_CONFIGURED = true;
|
||||||
} else { // connection failed, time out
|
} else { // connection failed, time out
|
||||||
WIFI_CONFIGURED = false;
|
WIFI_CONFIGURED = false;
|
||||||
|
|
11
src/Watchy.h
11
src/Watchy.h
|
@ -16,6 +16,7 @@
|
||||||
#include "BLE.h"
|
#include "BLE.h"
|
||||||
#include "bma.h"
|
#include "bma.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "esp_chip_info.h"
|
||||||
|
|
||||||
typedef struct weatherData {
|
typedef struct weatherData {
|
||||||
int8_t temperature;
|
int8_t temperature;
|
||||||
|
@ -23,11 +24,15 @@ typedef struct weatherData {
|
||||||
bool isMetric;
|
bool isMetric;
|
||||||
String weatherDescription;
|
String weatherDescription;
|
||||||
bool external;
|
bool external;
|
||||||
|
tmElements_t sunrise;
|
||||||
|
tmElements_t sunset;
|
||||||
} weatherData;
|
} weatherData;
|
||||||
|
|
||||||
typedef struct watchySettings {
|
typedef struct watchySettings {
|
||||||
// Weather Settings
|
// Weather Settings
|
||||||
String cityID;
|
String cityID;
|
||||||
|
String lat;
|
||||||
|
String lon;
|
||||||
String weatherAPIKey;
|
String weatherAPIKey;
|
||||||
String weatherURL;
|
String weatherURL;
|
||||||
String weatherUnit;
|
String weatherUnit;
|
||||||
|
@ -51,8 +56,8 @@ public:
|
||||||
explicit Watchy(const watchySettings &s) : settings(s) {} // constructor
|
explicit Watchy(const watchySettings &s) : settings(s) {} // constructor
|
||||||
void init(String datetime = "");
|
void init(String datetime = "");
|
||||||
void deepSleep();
|
void deepSleep();
|
||||||
static void displayBusyCallback(const void *);
|
|
||||||
float getBatteryVoltage();
|
float getBatteryVoltage();
|
||||||
|
uint8_t getBoardRevision();
|
||||||
void vibMotor(uint8_t intervalMs = 100, uint8_t length = 20);
|
void vibMotor(uint8_t intervalMs = 100, uint8_t length = 20);
|
||||||
|
|
||||||
virtual void handleButtonPress();
|
virtual void handleButtonPress();
|
||||||
|
@ -70,8 +75,6 @@ public:
|
||||||
void setupWifi();
|
void setupWifi();
|
||||||
bool connectWiFi();
|
bool connectWiFi();
|
||||||
weatherData getWeatherData();
|
weatherData getWeatherData();
|
||||||
weatherData getWeatherData(String cityID, String units, String lang,
|
|
||||||
String url, String apiKey, uint8_t updateInterval);
|
|
||||||
void updateFWBegin();
|
void updateFWBegin();
|
||||||
|
|
||||||
void showWatchFace(bool partialRefresh);
|
void showWatchFace(bool partialRefresh);
|
||||||
|
@ -85,6 +88,8 @@ private:
|
||||||
uint16_t len);
|
uint16_t len);
|
||||||
static uint16_t _writeRegister(uint8_t address, uint8_t reg, uint8_t *data,
|
static uint16_t _writeRegister(uint8_t address, uint8_t reg, uint8_t *data,
|
||||||
uint16_t len);
|
uint16_t len);
|
||||||
|
weatherData _getWeatherData(String cityID, String lat, String lon, String units, String lang,
|
||||||
|
String url, String apiKey, uint8_t updateInterval);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RTC_DATA_ATTR int guiState;
|
extern RTC_DATA_ATTR int guiState;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Versioning
|
||||||
|
#define WATCHY_LIB_VER "1.4.10"
|
||||||
|
|
||||||
//pins
|
//pins
|
||||||
#if !defined(ARDUINO_WATCHY_V10) && !defined(ARDUINO_WATCHY_V15) && !defined(ARDUINO_WATCHY_V20)
|
#if !defined(ARDUINO_WATCHY_V10) && !defined(ARDUINO_WATCHY_V15) && !defined(ARDUINO_WATCHY_V20)
|
||||||
|
|
||||||
|
@ -75,6 +78,4 @@
|
||||||
#define SOFTWARE_VERSION_PATCH 0
|
#define SOFTWARE_VERSION_PATCH 0
|
||||||
#define HARDWARE_VERSION_MAJOR 1
|
#define HARDWARE_VERSION_MAJOR 1
|
||||||
#define HARDWARE_VERSION_MINOR 0
|
#define HARDWARE_VERSION_MINOR 0
|
||||||
// Versioning
|
|
||||||
#define WATCHY_LIB_VER "1.4.6"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue