Make voltage & temperature test repeatable

This commit is contained in:
2023-04-01 20:51:35 +02:00
parent 750697f4f7
commit 72b3a0e14c
3 changed files with 29 additions and 23 deletions

View File

@ -31,10 +31,10 @@ def recive(bustype="socketcan", channel="can0"):
return message return message
def waitForUserInput(waitForUserInput): def waitForUserInput(waitForUserInput, prompt="Ready to start?"):
if waitForUserInput: if waitForUserInput:
readInput = "n" readInput = "n"
print("Ready to start ? ") print(prompt)
while "y" not in readInput: while "y" not in readInput:
print("Enter y to start or c to cancel ") print("Enter y to start or c to cancel ")
readInput = input(" ") readInput = input(" ")

View File

@ -44,6 +44,7 @@ def verifyNumbers(numberListList):
def tempTest(): def tempTest():
while True:
print("====================") print("====================")
print("starting temperature test ") print("starting temperature test ")
canTest.waitForUserInput(True) canTest.waitForUserInput(True)
@ -61,4 +62,6 @@ def tempTest():
changed.append(((te >> 4) * 0.0625)) changed.append(((te >> 4) * 0.0625))
print("Interpreted temperatures:") print("Interpreted temperatures:")
print(changed) print(changed)
if canTest.waitForUserInput(True, "Repeat temperature test?") != 0:
break
print("I am done with this shit") print("I am done with this shit")

View File

@ -52,6 +52,7 @@ def verifyNumbers(numberListList):
def voltagesTest(): def voltagesTest():
print("====================") print("====================")
print("starting voltage test pls but 3.500 as reference value") print("starting voltage test pls but 3.500 as reference value")
while True:
canTest.waitForUserInput(True) canTest.waitForUserInput(True)
voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat
allVoltages = [] allVoltages = []
@ -60,3 +61,5 @@ def voltagesTest():
verifyNumbers(allVoltages) verifyNumbers(allVoltages)
print("I am done with this shit") print("I am done with this shit")
if canTest.waitForUserInput(True, "Repeat voltage test?") != 0:
break