Make voltage & temperature test repeatable
This commit is contained in:
parent
750697f4f7
commit
72b3a0e14c
@ -31,10 +31,10 @@ def recive(bustype="socketcan", channel="can0"):
|
||||
return message
|
||||
|
||||
|
||||
def waitForUserInput(waitForUserInput):
|
||||
def waitForUserInput(waitForUserInput, prompt="Ready to start?"):
|
||||
if waitForUserInput:
|
||||
readInput = "n"
|
||||
print("Ready to start ? ")
|
||||
print(prompt)
|
||||
while "y" not in readInput:
|
||||
print("Enter y to start or c to cancel ")
|
||||
readInput = input(" ")
|
||||
|
31
tempTest.py
31
tempTest.py
@ -44,21 +44,24 @@ def verifyNumbers(numberListList):
|
||||
|
||||
|
||||
def tempTest():
|
||||
print("====================")
|
||||
print("starting temperature test ")
|
||||
canTest.waitForUserInput(True)
|
||||
Temps = getTempOverCan()
|
||||
allTemp = []
|
||||
changed = []
|
||||
while True:
|
||||
print("====================")
|
||||
print("starting temperature test ")
|
||||
canTest.waitForUserInput(True)
|
||||
Temps = getTempOverCan()
|
||||
allTemp = []
|
||||
changed = []
|
||||
|
||||
for temp in Temps:
|
||||
allTemp += struct.unpack("<HHHH", temp) # Format anpassen
|
||||
for temp in Temps:
|
||||
allTemp += struct.unpack("<HHHH", temp) # Format anpassen
|
||||
|
||||
print("Raw temperatures:")
|
||||
print(allTemp)
|
||||
print("Raw temperatures:")
|
||||
print(allTemp)
|
||||
|
||||
for te in allTemp:
|
||||
changed.append(((te >> 4) * 0.0625))
|
||||
print("Interpreted temperatures:")
|
||||
print(changed)
|
||||
for te in allTemp:
|
||||
changed.append(((te >> 4) * 0.0625))
|
||||
print("Interpreted temperatures:")
|
||||
print(changed)
|
||||
if canTest.waitForUserInput(True, "Repeat temperature test?") != 0:
|
||||
break
|
||||
print("I am done with this shit")
|
||||
|
@ -52,11 +52,14 @@ def verifyNumbers(numberListList):
|
||||
def voltagesTest():
|
||||
print("====================")
|
||||
print("starting voltage test pls but 3.500 as reference value")
|
||||
canTest.waitForUserInput(True)
|
||||
voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat
|
||||
allVoltages = []
|
||||
for volt in voltages:
|
||||
allVoltages.append(struct.unpack("<HHHH", volt))
|
||||
while True:
|
||||
canTest.waitForUserInput(True)
|
||||
voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat
|
||||
allVoltages = []
|
||||
for volt in voltages:
|
||||
allVoltages.append(struct.unpack("<HHHH", volt))
|
||||
|
||||
verifyNumbers(allVoltages)
|
||||
print("I am done with this shit")
|
||||
verifyNumbers(allVoltages)
|
||||
print("I am done with this shit")
|
||||
if canTest.waitForUserInput(True, "Repeat voltage test?") != 0:
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user