summaryrefslogtreecommitdiff
path: root/bin/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/main.py')
-rw-r--r--bin/main.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/main.py b/bin/main.py
index 60978bb..482fde0 100644
--- a/bin/main.py
+++ b/bin/main.py
@@ -22,8 +22,8 @@ def display_cpu_info():
22 load = os.getloadavg()[0] 22 load = os.getloadavg()[0]
23 temperature = cpu_temp.temperature 23 temperature = cpu_temp.temperature
24 lcd_instance.clear() 24 lcd_instance.clear()
25 lcd_instance.display_text(f"CPU Load: {load}", 1) 25 lcd_instance.text(f"CPU Load: {load}", 1)
26 lcd_instance.display_text(f"Temp: {temperature:.1f}C", 2) 26 lcd_instance.text(f"Temp: {temperature:.1f}C", 2)
27 time.sleep(5) 27 time.sleep(5)
28 28
29 29
@@ -33,7 +33,7 @@ def display_uptime():
33 uptime_seconds = float(f.readline().split()[0]) 33 uptime_seconds = float(f.readline().split()[0])
34 uptime_str = time.strftime("%H:%M:%S", time.gmtime(uptime_seconds)) 34 uptime_str = time.strftime("%H:%M:%S", time.gmtime(uptime_seconds))
35 lcd_instance.clear() 35 lcd_instance.clear()
36 lcd_instance.display_text(f"Uptime: {uptime_str}", 1, "center") 36 lcd_instance.text(f"Uptime: {uptime_str}", 1, "center")
37 37
38 38
39def recognize_speech(): 39def recognize_speech():
@@ -45,13 +45,13 @@ def recognize_speech():
45 audio = recognizer.listen(source) 45 audio = recognizer.listen(source)
46 text = recognizer.recognize_google(audio) 46 text = recognizer.recognize_google(audio)
47 lcd_instance.clear() 47 lcd_instance.clear()
48 lcd_instance.display_text(text, 1) 48 lcd_instance.text(text, 1)
49 print("Speech recognized:", text) 49 print("Speech recognized:", text)
50 except speech.UnknownValueError: 50 except speech.UnknownValueError:
51 lcd_instance.display_text(ERROR_BAD_REQUEST, 1) 51 lcd_instance.text(ERROR_BAD_REQUEST, 1)
52 print(ERROR_BAD_REQUEST) 52 print(ERROR_BAD_REQUEST)
53 except speech.RequestError: 53 except speech.RequestError:
54 lcd_instance.display_text(ERROR_UNAUTHORIZED, 1) 54 lcd_instance.text(ERROR_UNAUTHORIZED, 1)
55 print(ERROR_UNAUTHORIZED) 55 print(ERROR_UNAUTHORIZED)
56 56
57 57
@@ -61,7 +61,7 @@ def save_notes():
61 output = input() 61 output = input()
62 if output.lower() in ["stop", "break", "quit", "exit"]: 62 if output.lower() in ["stop", "break", "quit", "exit"]:
63 break 63 break
64 lcd_instance.display_text(output, 1) 64 lcd_instance.text(output, 1)
65 time.sleep(2) 65 time.sleep(2)
66 66
67 67
@@ -85,7 +85,7 @@ def main():
85 if action: 85 if action:
86 action() 86 action()
87 else: 87 else:
88 lcd_instance.display_text(ERROR_NOT_FOUND, 1) 88 lcd_instance.text(ERROR_NOT_FOUND, 1)
89 print(ERROR_NOT_FOUND) 89 print(ERROR_NOT_FOUND)
90 90
91 91