From 39b35cb0c2f56ed87c3d90a6dd7137db067dff5e Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sat, 27 Jun 2020 00:28:46 +0200 Subject: [PATCH] glcd: add unknown weather icon; change font handling; remove min temp from forecast Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f5669974664d9cc1e8bd63c575c24d8c7191d6b6 Author: vanhofen Date: 2020-06-27 (Sat, 27 Jun 2020) Origin message was: ------------------ - glcd: add unknown weather icon; change font handling; remove min temp from forecast ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/oled/icons/weather/Makefile.am | 1 + data/oled/icons/weather/unknown.png | Bin 0 -> 1214 bytes src/driver/glcd/glcd.cpp | 2 +- src/driver/glcd/weather.cpp | 41 ++++++++++------------------ 4 files changed, 17 insertions(+), 27 deletions(-) create mode 100644 data/oled/icons/weather/unknown.png diff --git a/data/oled/icons/weather/Makefile.am b/data/oled/icons/weather/Makefile.am index c99f9a92a..10c58ac95 100644 --- a/data/oled/icons/weather/Makefile.am +++ b/data/oled/icons/weather/Makefile.am @@ -12,4 +12,5 @@ install_DATA = \ sleet.png \ snow.png \ thunderstorm.png \ + unknown.png \ wind.png diff --git a/data/oled/icons/weather/unknown.png b/data/oled/icons/weather/unknown.png new file mode 100644 index 0000000000000000000000000000000000000000..a0da499e15884a57e91286ae39be59756ea3fde2 GIT binary patch literal 1214 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD~={f$3m?Pl)TwQ7{?;LpB8d|NnnQ zJah*zO*57R`2{mLJiCzw;v{*yyD)UH%6b4foCO|{#S9GGLLkg|>2BR0pdfpRr>`sf z6E-O^DZSRMGj{^@lzF;1hE&{oJM(tlVFdvfSv@C?pa1t4{##VE^hD{bBNF;PkIz+Z z`gX8*)0zgA%PMvv&zav<$g{Vvzp1Ur>(wu*U&#E3`Q9Vz=jm@Q70bwEY25w9{fcAm zCuRrJ73be4H#m#DdLHlbq^806|K4K?iyGgE2g%qs?4Mout>c45Z@SroFM@$SEPgUq z8Ll6QQ=pzAlnYvRU#*40HvBDe|}=Sf-cs256q*r6@-$-H@n z1kk(#&zjs${@=+a!|36_^gm8vL-`>WJMII!`E7R#2Be?gMkhaWM~ zyW0+E&s@CKo8wRGpXlVbpZl4s>~{bEQuCI<$yk9AY*blcd->Height() / 100; if (!fonts_initialized || (fontsize_temperature_new != fontsize_temperature)) { fontsize_temperature = fontsize_temperature_new; - if (!font_temperature.LoadFT2(/*t.glcd_font*/FONTDIR "/pakenham.ttf", "UTF-8", fontsize_temperature)) { - t.glcd_font = FONTDIR "/pakenham.ttf"; - font_temperature.LoadFT2(t.glcd_font, "UTF-8", fontsize_temperature); + if (!font_temperature.LoadFT2(FONTDIR "/pakenham.ttf", "UTF-8", fontsize_temperature)) { + font_temperature.LoadFT2(g_settings.font_file, "UTF-8", fontsize_temperature); } } fonts_initialized = true; @@ -158,25 +156,15 @@ void WeatherUpdateFonts(void) int WeatherNameToNumber(std::string name) { - std::map weather_name + for (unsigned int i = 0; i < sizeof(weather_name); i++) { - { "clear-day", 0 }, - { "clear-night", 1 }, - { "cloudy", 2 }, - { "fog", 3 }, - { "partly-cloudy-day", 4 }, - { "partly-cloudy-night", 5 }, - { "rain", 6 }, - { "sleet", 7 }, - { "snow", 8 }, - { "wind", 9 }, - //{ "unknown", 10 }, - }; - - const auto iter = weather_name.find(name); - - if (iter != weather_name.cend()) - return iter->second; + if (name.compare(weather_name[i]) == 0) + { + return i; + break; + } + } + return WEATHER_UNKNOWN; } void RenderWeather(int cx, int cy, int nx, int ny, bool standby) @@ -209,8 +197,9 @@ void RenderWeather(int cx, int cy, int nx, int ny, bool standby) next_wcity = st_next_wcity = CWeather::getInstance()->getCity(); next_wtimestamp = st_next_wtimestamp = to_string((int)CWeather::getInstance()->getForecastWeekday(forecast)); - next_wtemp = st_next_wtemp = CWeather::getInstance()->getForecastTemperatureMin(forecast); - next_wtemp = st_next_wtemp += "|" + CWeather::getInstance()->getForecastTemperatureMax(forecast); + //next_wtemp = st_next_wtemp = CWeather::getInstance()->getForecastTemperatureMin(forecast); + //next_wtemp = st_next_wtemp += "|" + CWeather::getInstance()->getForecastTemperatureMax(forecast); + next_wtemp = st_next_wtemp = CWeather::getInstance()->getForecastTemperatureMax(forecast); next_wwind = st_next_wwind = CWeather::getInstance()->getForecastWindBearing(forecast); next_wicon = st_next_wicon = CWeather::getInstance()->getForecastIconOnlyNane(forecast); }