diff options
| author | Francesco Gazzetta <fgaz@fgaz.me> | 2021-12-26 15:58:28 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel.thompson@linaro.org> | 2021-12-26 21:25:07 (GMT) |
| commit | 5c714ea075c638b37576939403a6727e60ee752e (patch) | |
| tree | 5a7f411e7fe8329be5779bd293e753218add0bac /wasp | |
| parent | fc756bccc943ab07b094af572dd9e6a7752fafa2 (diff) | |
Optimize flash usage of weather app
Signed-off-by: Francesco Gazzetta <fgaz@fgaz.me>
Diffstat (limited to 'wasp')
| -rw-r--r-- | wasp/apps/weather.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/wasp/apps/weather.py b/wasp/apps/weather.py index 55c4809..15e8758 100644 --- a/wasp/apps/weather.py +++ b/wasp/apps/weather.py @@ -63,11 +63,12 @@ class WeatherApp(object): def foreground(self): """Activate the application.""" - temp = wasp.system.weatherinfo.get('temp') - hum = wasp.system.weatherinfo.get('hum') - txt = wasp.system.weatherinfo.get('txt') - wind = wasp.system.weatherinfo.get('wind') - loc = wasp.system.weatherinfo.get('loc') + get_info = wasp.system.weatherinfo.get + temp = get_info('temp') + hum = get_info('hum') + txt = get_info('txt') + wind = get_info('wind') + loc = get_info('loc') if temp: self._temp = temp if hum: @@ -92,11 +93,12 @@ class WeatherApp(object): def tick(self, ticks): wasp.system.keep_awake() - temp_now = wasp.system.weatherinfo.get('temp') - hum_now = wasp.system.weatherinfo.get('hum') - txt_now = wasp.system.weatherinfo.get('txt') - wind_now = wasp.system.weatherinfo.get('wind') - loc_now = wasp.system.weatherinfo.get('loc') + get_info = wasp.system.weatherinfo.get + temp_now = get_info('temp') + hum_now = get_info('hum') + txt_now = get_info('txt') + wind_now = get_info('wind') + loc_now = get_info('loc') if temp_now: if temp_now != self._temp: self._temp = temp_now |
