diff --git a/menu.py b/menu.py index a540c6e..037d973 100644 --- a/menu.py +++ b/menu.py @@ -1,6 +1,7 @@ import logging import csv import time +import os import obd from datetime import datetime @@ -47,16 +48,15 @@ def read_codes(connection): def live_data(connection): - print("\nLive Data") - print("---------") - if connection is None or not connection.is_connected(): + print("\nLive Data") + print("---------") print("Not connected to vehicle") pause() return print("Live data running.") - print("Press Ctrl+C to stop and return to menu.\n") + print("Press Ctrl+C to stop and return to menu.") try: while True: @@ -64,25 +64,29 @@ def live_data(connection): speed = connection.query(obd.commands.SPEED) coolant = connection.query(obd.commands.COOLANT_TEMP) - print("\nLive Data") + os.system("clear") + + print("Live Data") print("---------") + print("Press Ctrl+C to stop") + print() if rpm.is_null(): print("RPM: Not supported") else: - print("RPM:", rpm.value) + print("RPM:", round(rpm.value.magnitude)) if speed.is_null(): print("Speed: Not supported") else: speed_mph = speed.value.to("mile_per_hour") - print("Speed:", speed_mph) + print("Speed:", round(speed_mph.magnitude), "mph") if coolant.is_null(): print("Coolant Temp: Not supported") else: coolant_f = coolant.value.to("degF") - print("Coolant Temp:", coolant_f) + print("Coolant Temp:", round(coolant_f.magnitude), "°F") time.sleep(1) @@ -110,6 +114,10 @@ def vehicle_info(connection): else: print("VIN: Not available") + print() + print("Protocol:", connection.protocol_name()) + print("Supported Commands:", len(connection.supported_commands)) + pause()