More Screen updates, icon and screens correction

This commit is contained in:
2026-08-07 14:32:02 +02:00
parent 46acbb88c2
commit f30b29be69
2 changed files with 14 additions and 15 deletions
+12 -15
View File
@@ -5,7 +5,7 @@ import framebuf
# Icon and bitmaps
image_weather_frost_bits = bytearray(b'\x01\x00\x13\x901\x18s\x9c\x09 \x05@S\x94\xfe\xfeS\x94\x05@\x09 s\x9c1\x18\x13\x90\x01\x00\x00\x00')
image_Alert_bits = bytearray(b'\x08\x00\x1c\x00\x14\x006\x006\x00\x7f\x00w\x00\xff\x80')
image_Alert_bits = bytearray(b'\xf7\x80\xe3\x80\xeb\x80\xc9\x80\xc9\x80\x80\x80\x88\x80\x00\x00')
image_CoolHiSmall_bits = bytearray(b'\x1f\xff\xc0?\xff\xe0\x7f\xff\xf0\xff\xdf\xf8\xffW\xf8\xfd\x8d\xf8\xf9\xdc\xf8\xfe\xdb\xf8\xf7Wx\xfb\x8e\xf8\xe0\x008\xfb\x8e\xf8\xf7Wx\xfe\xdb\xf8\xf9\xdc\xf8\xfd\x8d\xf8\xffW\xf8\xff\xdf\xf8\x7f\xff\xf0?\xff\xe0\x1f\xff\xc0')
image_CoolLoSmall_bits = bytearray(b'\x1f\xff\xc0 \x00 @\x00\x10\x80 \x08\x80\xa8\x08\x82r\x08\x86#\x08\x81$\x08\x88\xa8\x88\x84q\x08\x9f\xff\xc8\x84q\x08\x88\xa8\x88\x81$\x08\x86#\x08\x82r\x08\x80\xa8\x08\x80 \x08@\x00\x10 \x00 \x1f\xff\xc0')
image_music_sound_wave_bits = bytearray(b'\x00\x00\x00\x02\x00\x00\x02 \x00\x02 \x00\x02 \x00\x0a(\x00\x0a\xa8\x00*\xa8\x00\xaa\xaa\x80\x0a\xaa\x00\x0a\xa8\x00\x0a \x00\x02 \x00\x02 \x00\x02\x00\x00\x00\x00\x00')
@@ -26,7 +26,7 @@ CHARACTER_HEIGHT = 7
class MicrowaveScreen:
# Used for animation
lastUpdateTime = 0
# lastUpdateTime = 0 # Not used right now
def __init__(self, display):
self.display = display
@@ -73,11 +73,11 @@ class MicrowaveScreen:
def update(self, cooking_state: CookingState | None, defrost_mode: bool = False):
self.flick()
self.lastUpdateTime = time.time()
# self.lastUpdateTime = time.time() # Not Used right now
if cooking_state: # Is currently cooking
# self.h_centered_text(cooking_state.state, 28, 1)
if not cooking_state or cooking_state.state == CookingStates.IDLE: # Is not currently cooking
self.h_centered_text("Ready !", 28, 1)
else:
# Screen center
if cooking_state.state == CookingStates.STIRRING_REQUIRED:
self._message("Pls Stir", True)
@@ -85,8 +85,7 @@ class MicrowaveScreen:
self._message("Alert !", True)
elif cooking_state.state == CookingStates.DONE:
self._message("Done !", False)
else:
# Progress bar
else: # Progress bar
elapsed_time = cooking_state.get_elapsed_time()
estimated_progress = elapsed_time / (elapsed_time + cooking_state.estimated_remaining_time)
self._progressBar(estimated_progress, 21, 25)
@@ -94,7 +93,7 @@ class MicrowaveScreen:
# Estimated remaining time
if cooking_state.paused:
self.h_centered_text("Paused", 40, 1)
else:
elif cooking_state.state != CookingStates.DONE:
remaining_time = cooking_state.estimated_remaining_time
minutes = remaining_time // 60
seconds = remaining_time % 60
@@ -111,9 +110,6 @@ class MicrowaveScreen:
if cooking_state.power_level is not None:
self.display.blit(fb_image_music_sound_wave_bits, 74, 2)
self.display.text(f"{cooking_state.power_level}W", 92, 6, 1)
else:
self.h_centered_text("Ready !", 28, 1)
if defrost_mode:
self.display.blit(fb_image_CoolHiSmall_bits, 2, 2)
else:
@@ -124,9 +120,10 @@ class MicrowaveScreen:
def _message(self, text, alert):
self.display.fill_rect(0, 27, self.width, CHARACTER_HEIGHT + 4, 1)
if alert and self.lastUpdateTime % 2000 < 1000:
self.display.blit(fb_image_Alert_bits, 10, 27)
self.h_centered_text(text, 28, 0)
if alert:
self.display.blit(fb_image_Alert_bits, 10, 29)
self.display.blit(fb_image_Alert_bits, self.width - 10, 29)
self.h_centered_text(text, 29, 0)
def message(self, text, alert):
self.flick()