Display the average windspeed if gusting wind speed is not available.
From: Alec Leamas <leamas.alec%AT%gmail.com>
Also updates the label depending on what's displayed.
---
mythweather/weather-screens.xml | 1 +
mythweather/weatherSource.cpp | 19 +++++++++++++++++++
theme/default-wide/weather-ui.xml | 1 -
theme/default/weather-ui.xml | 1 -
4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/mythweather/weather-screens.xml b/mythweather/weather-screens.xml
index e743e52..980f29c 100644
|
a
|
b
|
|
| 6 | 6 | <datum name="pressure" /> |
| 7 | 7 | <!-- <datum name="wind_dir" /> --> |
| 8 | 8 | <datum name="wind_spdgst" /> |
| | 9 | <datum name="windlbl" /> |
| 9 | 10 | <!-- <datum name="wind_gust" /> --> |
| 10 | 11 | <datum name="wind_dir" /> |
| 11 | 12 | <datum name="visibility" /> |
diff --git a/mythweather/weatherSource.cpp b/mythweather/weatherSource.cpp
index c0e7f9a..d0b05eb 100644
|
a
|
b
|
static void processPrecip(DataMap& data)
|
| 645 | 645 | } |
| 646 | 646 | } |
| 647 | 647 | |
| | 648 | static void processWind(DataMap& data) |
| | 649 | { |
| | 650 | QString label = QObject::tr( "Wind (Gust)"); |
| | 651 | |
| | 652 | QString w = data["wind_spdgst"]; |
| | 653 | if (w == "" || w == "NA") |
| | 654 | { |
| | 655 | w = data["wind_speed"]; |
| | 656 | if (w != "" && w != "NA") |
| | 657 | { |
| | 658 | data.changeKey( "wind_speed", "wind_spdgst"); |
| | 659 | label = QObject::tr( "Wind (avg)"); |
| | 660 | } |
| | 661 | } |
| | 662 | VERBOSE(VB_MOST, QString("Wind label: %1").arg(label)); |
| | 663 | data[ "windlbl"] = label; |
| | 664 | } |
| | 665 | |
| 648 | 666 | void WeatherSource::processData() |
| 649 | 667 | { |
| 650 | 668 | QStringList data = QString(m_buffer).split('\n', QString::SkipEmptyParts); |
| … |
… |
void WeatherSource::processData()
|
| 671 | 689 | m_data[temp[0]] = temp[1]; |
| 672 | 690 | } |
| 673 | 691 | processPrecip(m_data); |
| | 692 | processWind(m_data); |
| 674 | 693 | } |
| 675 | 694 | |
| 676 | 695 | void WeatherSource::scriptTimeout() |
diff --git a/theme/default-wide/weather-ui.xml b/theme/default-wide/weather-ui.xml
index 5c8054d..4b6519a 100644
|
a
|
b
|
|
| 89 | 89 | |
| 90 | 90 | <textarea name="windlbl" from="humiditylbl"> |
| 91 | 91 | <area>220,336,245,32</area> |
| 92 | | <value>Wind(Gust)</value> |
| 93 | 92 | </textarea> |
| 94 | 93 | |
| 95 | 94 | <textarea name="wind_spdgst" from="basetextarea"> |
diff --git a/theme/default/weather-ui.xml b/theme/default/weather-ui.xml
index 3ec8d8f..4d50c24 100644
|
a
|
b
|
|
| 95 | 95 | |
| 96 | 96 | <textarea name="windlbl" from="humiditylbl"> |
| 97 | 97 | <area>60,276,420,32</area> |
| 98 | | <value>Wind(Gust)</value> |
| 99 | 98 | </textarea> |
| 100 | 99 | |
| 101 | 100 | <textarea name="wind_spdgst" from="relative_humidity"> |