diff options
| author | nasrlol <nsrddyn@gmail.com> | 2024-11-13 00:33:48 +0100 |
|---|---|---|
| committer | nasrlol <nsrddyn@gmail.com> | 2024-11-13 00:33:48 +0100 |
| commit | 16c71d8ddc79efff880346c39e918cf07c8abfdf (patch) | |
| tree | c5f8c596914f868a54a2cf32922c8f95f7ba573b | |
| parent | ecd194028a652cc29f300e4a6ca24675b5b8d9ba (diff) | |
clearning the dispplauy with every fuinction hoping it fixes the display
| -rw-r--r-- | bin/kasper_source.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/kasper_source.py b/bin/kasper_source.py index d878f6c..b7d8060 100644 --- a/bin/kasper_source.py +++ b/bin/kasper_source.py | |||
| @@ -71,6 +71,8 @@ microphone = speech.Microphone() | |||
| 71 | 71 | ||
| 72 | # Display Functions | 72 | # Display Functions |
| 73 | def display_cpu_info(): | 73 | def display_cpu_info(): |
| 74 | # clearing the display before accessing it | ||
| 75 | lcd.clear() | ||
| 74 | """Display CPU load and temperature on the LCD.""" | 76 | """Display CPU load and temperature on the LCD.""" |
| 75 | while True: | 77 | while True: |
| 76 | load = os.getloadavg()[0] # 1-minute load average | 78 | load = os.getloadavg()[0] # 1-minute load average |
| @@ -82,6 +84,8 @@ def display_cpu_info(): | |||
| 82 | 84 | ||
| 83 | 85 | ||
| 84 | def display_uptime(): | 86 | def display_uptime(): |
| 87 | # clearing the display before accessing it | ||
| 88 | lcd.clear() | ||
| 85 | """Display system uptime on the LCD.""" | 89 | """Display system uptime on the LCD.""" |
| 86 | with open("/proc/uptime") as f: | 90 | with open("/proc/uptime") as f: |
| 87 | uptime_seconds = float(f.readline().split()[0]) | 91 | uptime_seconds = float(f.readline().split()[0]) |
| @@ -91,6 +95,8 @@ def display_uptime(): | |||
| 91 | 95 | ||
| 92 | 96 | ||
| 93 | def recognize_speech(): | 97 | def recognize_speech(): |
| 98 | # clearing the display before accessing it | ||
| 99 | lcd.clear() | ||
| 94 | """Capture and transcribe speech input.""" | 100 | """Capture and transcribe speech input.""" |
| 95 | try: | 101 | try: |
| 96 | with microphone as source: | 102 | with microphone as source: |
| @@ -118,6 +124,8 @@ OPTIONS = { | |||
| 118 | 124 | ||
| 119 | 125 | ||
| 120 | def main(): | 126 | def main(): |
| 127 | # clearing the display before doing anything | ||
| 128 | lcd.clear() | ||
| 121 | # Main program loop to accept user commands. | 129 | # Main program loop to accept user commands. |
| 122 | print("WELCOME TO THE I2C COMMAND LINE CENTER") | 130 | print("WELCOME TO THE I2C COMMAND LINE CENTER") |
| 123 | print("Options:", ", ".join(OPTIONS.keys())) | 131 | print("Options:", ", ".join(OPTIONS.keys())) |
