v.0.4.8 weather-info improvement
This commit is contained in:
@@ -1,15 +1,14 @@
|
|||||||
from machine import Pin, RTC # type: ignore
|
from machine import Pin # type: ignore
|
||||||
from neopixel import NeoPixel # type: ignore
|
from neopixel import NeoPixel # type: ignore
|
||||||
from .fonts import char_width as charwidth
|
from .fonts import char_width as charwidth
|
||||||
|
|
||||||
from .fonts.font_5x7 import font_5x7
|
from .fonts.font_5x7 import font_5x7
|
||||||
from ..utils.colors import GRAY, RAINBOW, BLACK, WHITE, LIME
|
from ..utils.colors import GRAY, RAINBOW, BLACK, WHITE
|
||||||
from ..utils.utils import (
|
from ..utils.utils import (
|
||||||
get_german_timestamp_short,
|
get_german_timestamp_short,
|
||||||
get_datetime_string,
|
get_datetime_string,
|
||||||
get_german_time_ticks,
|
get_german_time_ticks,
|
||||||
get_german_date_ticks,
|
get_german_date_ticks,
|
||||||
number_to_bitarray_msb,
|
|
||||||
)
|
)
|
||||||
import time
|
import time
|
||||||
import math
|
import math
|
||||||
|
|||||||
@@ -30,18 +30,19 @@ def weather_check(display: NeoPixel_64x64, test_mode: bool = False):
|
|||||||
display.write_text(f'{str(w_resp.location.name)}', 0, ypos, color=colors.RAINBOW[0])
|
display.write_text(f'{str(w_resp.location.name)}', 0, ypos, color=colors.RAINBOW[0])
|
||||||
ypos += display.font_height + 1
|
ypos += display.font_height + 1
|
||||||
# display.set_font(fonts.font_8x8)
|
# display.set_font(fonts.font_8x8)
|
||||||
|
display.set_font(fonts.font_5x7)
|
||||||
display.write_text(f'{str(w_resp.current.temp_c)}°C', 0, ypos, color=colors.RAINBOW[1])
|
display.write_text(f'{str(w_resp.current.temp_c)}°C', 0, ypos, color=colors.RAINBOW[1])
|
||||||
ypos += display.font_height + 1
|
ypos += display.font_height + 1
|
||||||
display.set_font(fonts.font_5x7)
|
|
||||||
display.write_text(f'{str(w_resp.current.condition.text)}°C', 0, ypos, color=colors.RAINBOW[2])
|
display.write_text(f'{str(w_resp.current.condition.text)}°C', 0, ypos, color=colors.RAINBOW[2])
|
||||||
ypos += display.font_height + 1
|
ypos += display.font_height + 1
|
||||||
display.write_text(f'upd:{str(w_resp.current.last_updated)[-5:]}', 0, ypos, color=colors.RAINBOW[3])
|
display.write_text(f'upd:{str(w_resp.current.last_updated)[-5:]}', 0, ypos, color=colors.RAINBOW[3])
|
||||||
ypos += display.font_height + 1
|
ypos += display.font_height + 1
|
||||||
display.write_text(f'cur:{str(w_resp.location.localtime)[-5:]}', 0, ypos, color=colors.RAINBOW[4])
|
display.write_text(f'cur:{str(w_resp.location.localtime)[-5:]}', 0, ypos, color=colors.RAINBOW[4])
|
||||||
|
|
||||||
ypos += 3 * (display.font_height + 1)
|
# unten rechts in die Ecke
|
||||||
|
ypos = display.MATRIX_HEIGHT - display.font_height - 1
|
||||||
|
|
||||||
display.write_text('done.', 38, ypos, color=colors.WHITE)
|
display.write_text('done.', 38, ypos, color=colors.NEON_GREEN)
|
||||||
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print(f'Error: connection closed - {e}')
|
print(f'Error: connection closed - {e}')
|
||||||
|
|||||||
5
main.py
5
main.py
@@ -1,9 +1,8 @@
|
|||||||
from machine import Pin, ADC # type: ignore
|
|
||||||
from app.display.neopixel_64x64 import NeoPixel_64x64
|
from app.display.neopixel_64x64 import NeoPixel_64x64
|
||||||
import app.display.fonts as fonts
|
#import app.display.fonts as fonts
|
||||||
import app.utils as utils
|
|
||||||
import app.tryout as tryout
|
import app.tryout as tryout
|
||||||
|
|
||||||
|
# Programm Startpunkt
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
display = NeoPixel_64x64()
|
display = NeoPixel_64x64()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user