From 9c500850773fd5132509cdb2a3cbaed4b3668aa4 Mon Sep 17 00:00:00 2001 From: SQFMI Date: Fri, 28 Apr 2023 14:59:41 -0400 Subject: [PATCH] Add offline sensor read icon Added new icon to indicate internal sensor reading when not connected to WiFi --- examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp | 2 ++ examples/WatchFaces/7_SEG/icons.h | 16 ++++++++++++++++ library.json | 2 +- library.properties | 2 +- src/Watchy.cpp | 13 ++++++------- src/config.h | 2 +- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp index fc1ca20..213c00a 100644 --- a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp +++ b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp @@ -142,6 +142,8 @@ void Watchy7SEG::drawWeather(){ weatherIcon = drizzle; }else if(weatherConditionCode >=200){//Thunderstorm weatherIcon = thunderstorm; + }else if(weatherConditionCode == -1){//chip + weatherIcon = chip; }else return; display.drawBitmap(145, 158, weatherIcon, WEATHER_ICON_WIDTH, WEATHER_ICON_HEIGHT, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK); diff --git a/examples/WatchFaces/7_SEG/icons.h b/examples/WatchFaces/7_SEG/icons.h index 66354b6..7309d02 100644 --- a/examples/WatchFaces/7_SEG/icons.h +++ b/examples/WatchFaces/7_SEG/icons.h @@ -174,3 +174,19 @@ const unsigned char wifioff [] PROGMEM = { 0x01, 0xff, 0xc0, 0x00, 0x07, 0xe1, 0xc0, 0x00, 0x0f, 0xc0, 0x80, 0x00, 0x1f, 0x0c, 0x00, 0x00, 0x3c, 0x1e, 0x00, 0x00, 0xf8, 0x0c, 0x00, 0x00 }; +// 'chip', 32x32px +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 +}; + diff --git a/library.json b/library.json index 392fb47..f42ddb6 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Watchy", - "version": "1.4.7", + "version": "1.4.8", "description": "Watchy - An Open Source E-Paper Watch by SQFMI", "authors": [ { diff --git a/library.properties b/library.properties index 23bf8d5..e24c354 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Watchy -version=1.4.7 +version=1.4.8 author=SQFMI maintainer=SQFMI sentence=Watchy - An Open Source E-Paper Watch by SQFMI diff --git a/src/Watchy.cpp b/src/Watchy.cpp index 19212ca..becacc7 100644 --- a/src/Watchy.cpp +++ b/src/Watchy.cpp @@ -662,19 +662,18 @@ weatherData Watchy::getWeatherData(String cityID, String units, String lang, gmtOffset = int(responseObject["timezone"]); syncNTP(gmtOffset); } else { - // http error + // http error, use internal temperature sensor + currentWeather.temperature = currentWeather.isMetric ? (uint8_t)sensor.readTemperature() : (uint8_t)sensor.readTemperatureF(); + currentWeather.weatherConditionCode = -1; + currentWeather.external = false; } http.end(); // turn off radios WiFi.mode(WIFI_OFF); btStop(); } else { // No WiFi, use internal temperature sensor - uint8_t temperature = sensor.readTemperature(); // celsius - if (!currentWeather.isMetric) { - temperature = temperature * 9. / 5. + 32.; // fahrenheit - } - currentWeather.temperature = temperature; - currentWeather.weatherConditionCode = 800; + currentWeather.temperature = currentWeather.isMetric ? (uint8_t)sensor.readTemperature() : (uint8_t)sensor.readTemperatureF(); + currentWeather.weatherConditionCode = -1; currentWeather.external = false; } weatherIntervalCounter = 0; diff --git a/src/config.h b/src/config.h index 196ab96..28d4a02 100644 --- a/src/config.h +++ b/src/config.h @@ -2,7 +2,7 @@ #define CONFIG_H // Versioning -#define WATCHY_LIB_VER "1.4.7" +#define WATCHY_LIB_VER "1.4.8" //pins #if !defined(ARDUINO_WATCHY_V10) && !defined(ARDUINO_WATCHY_V15) && !defined(ARDUINO_WATCHY_V20)