Skip to content

Commit 87cd0ca

Browse files
committed
fix: add reset only at first load
1 parent 9d9115a commit 87cd0ca

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run(self) -> None:
4141
return
4242

4343
self.__display.print("Devices:", line=1, clear_full=True)
44-
self.__display_current_device()
44+
self.__display_current_device(reset=True)
4545

4646
while True:
4747
self.__check_buttons_press()
@@ -67,9 +67,9 @@ def __check_api_health(self) -> bool:
6767
self.__buzzer.play_success()
6868
return True
6969

70-
def __display_current_device(self) -> None:
70+
def __display_current_device(self, reset: bool = False) -> None:
7171
self.__display.print("Loading...", line=2, clear_line=True)
72-
current_device_data = self.__api.get_current_device(reset=True)
72+
current_device_data = self.__api.get_current_device(reset=reset)
7373
self.__display_device(current_device_data)
7474

7575
def __display_device(self, device_data: dict) -> None:
@@ -93,6 +93,8 @@ def __check_buttons_press(self) -> None:
9393
current_device_data = self.__api.previous_device()
9494
elif was_right_button_pressed:
9595
current_device_data = self.__api.next_device()
96+
else:
97+
return
9698

9799
self.__display_device(current_device_data)
98100
self.__buttons.reset()

0 commit comments

Comments
 (0)