Skip to content

Commit

Permalink
Zero turbulence when we disable-it.
Browse files Browse the repository at this point in the history
Don't update metar if downloads are disabled.
  • Loading branch information
joanpc committed Mar 21, 2015
1 parent ca7830b commit c8afaf8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion PI_noaaWeather.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ def setWinds(self, winds, elapsed):
extra['dew'] = self.weatherData['metar']['temperature'][1] + 273.15

# remove first wind layer if is too close (for high altitude airports)
# TODO: This can break transitions in some cases.
if len(winds) > 1 and winds[0][0] < alt+ self.conf.metar_agl_limit:
winds.pop(0)

winds = [[alt, hdg, speed, extra]] + winds


# Search current top and bottom layer:
blayer = False
nlayers = len(winds)
Expand Down Expand Up @@ -761,7 +761,11 @@ def aboutWindowHandler(self, inMessage, inWidget, inParam1, inParam2):
self.conf.set_clouds = XPGetWidgetProperty(self.cloudsCheck, xpProperty_ButtonState, None)
self.conf.set_temp = XPGetWidgetProperty(self.tempCheck, xpProperty_ButtonState, None)
self.conf.set_pressure = XPGetWidgetProperty(self.pressureCheck, xpProperty_ButtonState, None)

# Zero turbulence data if disabled
self.conf.set_turb = XPGetWidgetProperty(self.turbCheck, xpProperty_ButtonState, None)
if not self.conf.set_turb:
for i in range(3): self.weather.winds[i]['turbulence'].value = 0

self.conf.download = XPGetWidgetProperty(self.downloadCheck, xpProperty_ButtonState, None)

Expand Down
2 changes: 1 addition & 1 deletion noaweather/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Conf:
Configuration variables
'''
syspath, dirsep = '', os.sep
__VERSION__ = '2.0rc5'
__VERSION__ = '2.0'

def __init__(self, syspath):
# Inits conf
Expand Down
2 changes: 1 addition & 1 deletion noaweather/metar.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def run(self, lat, lon, rate):
# No file downloaded
pass

else:
elif self.conf.download:
# Download new data if required
cycle, timestamp = self.getCycle()
if (timestamp - self.last_timestamp) > self.UPDATE_RATE * 60:
Expand Down

0 comments on commit c8afaf8

Please sign in to comment.