Skip to content

Commit

Permalink
feat: 🐛 add function to read from serial buffer, for more debugging o…
Browse files Browse the repository at this point in the history
…ptions for arduino
  • Loading branch information
MarcelSchm committed Sep 15, 2024
1 parent bb7c180 commit 3c9fc14
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/MS_Teams_Busy_Light.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,18 @@ def check_new_or_modified_log(settings, last_checked_time):
logging.info("check_new_or_modified_log - No new file or modification to it, since last check.")
return False, latest_file_path,latest_file_mtime

def read_from_serial():
"""
Check for Log Messages of Arduino. Reads everything in serial buffer and logs it.
Args:
Returns:
"""
if ser.in_waiting > 0:
line = ser.readlineln()
logging.info("read_from_serial - Received from serial: %s",line)

def search_availability_in_log(log_file_path, availability_string, status_states):
"""
Search for the last occurrence of the "availability" string in the log file given as argument and return the value of the last occurence.
Expand Down Expand Up @@ -485,5 +497,6 @@ def search_availability_in_log(log_file_path, availability_string, status_states
logging.info("Main loop - Status Value set to: %s",status)
if not settings["debug"]["enabled"].lower() in ['true', 'yes', 'y']:
write_status_to_busy_light(status)
read_from_serial()
else:
logging.info("While True loop - Bypassing write_status_to_busy_light due to debug mode.")

0 comments on commit 3c9fc14

Please sign in to comment.