From df5fce8d4027371ce20349f66d7693fc3c04290c Mon Sep 17 00:00:00 2001 From: Denis Pitzalis Date: Mon, 15 May 2023 16:07:03 +0200 Subject: [PATCH] fix issue #229 --- examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp | 43 ++++++++++++---------- examples/WatchFaces/7_SEG/icons.h | 31 ++++++++++++++++ 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp index fc1ca20..087c9b5 100644 --- a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp +++ b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp @@ -125,24 +125,29 @@ void Watchy7SEG::drawWeather(){ display.drawBitmap(165, 110, currentWeather.isMetric ? celsius : fahrenheit, 26, 20, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK); const unsigned char* weatherIcon; - //https://openweathermap.org/weather-conditions - if(weatherConditionCode > 801){//Cloudy - weatherIcon = cloudy; - }else if(weatherConditionCode == 801){//Few Clouds - weatherIcon = cloudsun; - }else if(weatherConditionCode == 800){//Clear - weatherIcon = sunny; - }else if(weatherConditionCode >=700){//Atmosphere - weatherIcon = atmosphere; - }else if(weatherConditionCode >=600){//Snow - weatherIcon = snow; - }else if(weatherConditionCode >=500){//Rain - weatherIcon = rain; - }else if(weatherConditionCode >=300){//Drizzle - weatherIcon = drizzle; - }else if(weatherConditionCode >=200){//Thunderstorm - weatherIcon = thunderstorm; - }else - return; + if(WIFI_CONFIGURED){ + //https://openweathermap.org/weather-conditions + if(weatherConditionCode > 801){//Cloudy + weatherIcon = cloudy; + }else if(weatherConditionCode == 801){//Few Clouds + weatherIcon = cloudsun; + }else if(weatherConditionCode == 800){//Clear + weatherIcon = sunny; + }else if(weatherConditionCode >=700){//Atmosphere + weatherIcon = atmosphere; + }else if(weatherConditionCode >=600){//Snow + weatherIcon = snow; + }else if(weatherConditionCode >=500){//Rain + weatherIcon = rain; + }else if(weatherConditionCode >=300){//Drizzle + weatherIcon = drizzle; + }else if(weatherConditionCode >=200){//Thunderstorm + weatherIcon = thunderstorm; + }else + return; + }else{ + weatherIcon = cputemp; + } + 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..0bef41c 100644 --- a/examples/WatchFaces/7_SEG/icons.h +++ b/examples/WatchFaces/7_SEG/icons.h @@ -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, 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 const unsigned char steps [] PROGMEM = { 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, 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 +}; +