v.0.2.2 NeoPixel_64x64.write_text wieder Pixel weise
This commit is contained in:
30
main.py
30
main.py
@@ -41,7 +41,7 @@ def emoji_test():
|
||||
display.write()
|
||||
|
||||
|
||||
def weather_check():
|
||||
def weather_check(test_mode: bool = False):
|
||||
wlan = Wlan('WOKWI-Guest', '12345678')
|
||||
|
||||
try:
|
||||
@@ -58,7 +58,7 @@ def weather_check():
|
||||
display.draw_text('weather data', 0, 16, color=RAINBOW[1])
|
||||
display.write()
|
||||
|
||||
w_resp = wlan.actual_weather(test_mode=True)
|
||||
w_resp = wlan.actual_weather(test_mode=test_mode)
|
||||
|
||||
display.clear()
|
||||
|
||||
@@ -68,12 +68,22 @@ def weather_check():
|
||||
# display.draw_text(f'cur: {str(w_resp.location.localtime)[-5:]}', 0, 24, color=RAINBOW[3])
|
||||
# display.write()
|
||||
|
||||
display.write_text(f'{str(w_resp.location.name)}', 0, 0, color=RAINBOW[0])
|
||||
display.write_text(f'{str(w_resp.current.temp_c)}°C', 0, 1, color=RAINBOW[1])
|
||||
display.write_text(f'upd: {str(w_resp.current.last_updated)[-5:]}', 0, 2, color=RAINBOW[2])
|
||||
display.write_text(f'cur: {str(w_resp.location.localtime)[-5:]}', 0, 3, color=RAINBOW[3])
|
||||
delta = 8
|
||||
ypos = 0
|
||||
display.write_text(f'{str(w_resp.location.name)}', 0, ypos, color=RAINBOW[0])
|
||||
ypos += delta
|
||||
display.write_text(f'{str(w_resp.current.temp_c)}°C', 0, ypos, color=RAINBOW[1])
|
||||
ypos += delta
|
||||
display.write_text(f'{str(w_resp.current.condition.text)}°C', 0, ypos, color=RAINBOW[1])
|
||||
ypos += delta
|
||||
display.write_text(
|
||||
f'upd: {str(w_resp.current.last_updated)[-5:]}', 0, ypos, color=RAINBOW[2]
|
||||
)
|
||||
ypos += delta
|
||||
display.write_text(f'cur: {str(w_resp.location.localtime)[-5:]}', 0, ypos, color=RAINBOW[3])
|
||||
|
||||
display.write_text('ready', 5, 7, color=WHITE)
|
||||
ypos += 3 * delta
|
||||
display.write_text('ready.', 30, ypos, color=WHITE)
|
||||
|
||||
except OSError as e:
|
||||
print(f'Error: connection closed - {e}')
|
||||
@@ -122,7 +132,7 @@ def bit_arrays():
|
||||
|
||||
if __name__ == '__main__':
|
||||
# emoji_test()
|
||||
# weather_check()
|
||||
weather_check(test_mode=False)
|
||||
# font_5x7_test()
|
||||
bit_arrays()
|
||||
show_system_load()
|
||||
# bit_arrays()
|
||||
# show_system_load()
|
||||
|
||||
Reference in New Issue
Block a user