Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Commit

Permalink
Linted Python With Pep8
Browse files Browse the repository at this point in the history
Linted Python With Pep8
  • Loading branch information
jgamblin committed Aug 6, 2018
1 parent 548087f commit 2ca6b52
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
46 changes: 22 additions & 24 deletions MiscScipts/CarInfo.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
#!/usr/bin/env python
import sys
import time
import obd
import json
import os
import curses


if len(sys.argv) == 1:
connection = obd.OBD()
else:
connection = obd.OBD(sys.argv[1]) # First arg is the device to connect to
connection = obd.OBD(sys.argv[1])

curses.setupterm()
sys.stdout.write(curses.tigetstr("clear"))
sys.stdout.flush()
os.system('clear')

while True:
print 'Car Information: '
print 'Speed : ' + str(connection.query(obd.commands.SPEED).value.to("mph"))
print 'RPM : ' + str(connection.query(obd.commands.RPM).value)
print 'Fuel Level: ' + str(connection.query(obd.commands.FUEL_LEVEL).value)
print 'Engine Temp : ' + str(connection.query(obd.commands.COOLANT_TEMP).value.to("degF"))
print '\n'
print 'Diagonstic Information: '
print 'Stored DTCs: ' + str(connection.query(obd.commands.GET_DTC).value)
print 'UpTme: ' + str(connection.query(obd.commands.RUN_TIME).value)
print '\n'
print 'Weather Information:'
print 'Air Temp: ' + str(connection.query(obd.commands.AMBIANT_AIR_TEMP).value.to("degF"))
print 'Barometric Pressure: ' + str(connection.query(obd.commands.BAROMETRIC_PRESSURE).value)
time.sleep(5)
curses.setupterm()
sys.stdout.write(curses.tigetstr("clear"))
sys.stdout.flush()

print 'Car Information: '
print 'Speed : ' + \
str(connection.query(obd.commands.SPEED).value.to("mph"))
print 'RPM : ' + str(connection.query(obd.commands.RPM).value)
print 'Fuel Level: ' + str(connection.query(obd.commands.FUEL_LEVEL).value)
print 'Engine Temp : ' + \
str(connection.query(obd.commands.COOLANT_TEMP).value.to("degF"))
print '\n'
print 'Diagonstic Information: '
print 'Stored DTCs: ' + str(connection.query(obd.commands.GET_DTC).value)
print 'UpTme: ' + str(connection.query(obd.commands.RUN_TIME).value)
print '\n'
print 'Weather Information:'
print 'Air Temp: ' \
+ str(connection.query(obd.commands.AMBIANT_AIR_TEMP).value.to("degF"))
print 'Barometric Pressure: ' \
+ str(connection.query(obd.commands.BAROMETRIC_PRESSURE).value)
time.sleep(5)
os.system('clear')
14 changes: 7 additions & 7 deletions MiscScipts/obd_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# Usage: obd_test.py DEVICE
# Example: obd_test.py /dev/ttyUSB0
# Prints supported OBD commands to the console, along with their current values.
# Prints supported OBD commands to the console, along values.

import sys
import obd
Expand All @@ -15,9 +16,8 @@

command_names = []
for command in connection.supported_commands:
try:
print("{}: {}".format(command.name, connection.query(command)))
command_names.append(command.name)
except NameError:
pass

try:
print("{}: {}".format(command.name, connection.query(command)))
command_names.append(command.name)
except NameError:
pass

0 comments on commit 2ca6b52

Please sign in to comment.