Make voltage & temperature test repeatable
This commit is contained in:
@ -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(" ")
|
||||||
|
|||||||
31
tempTest.py
31
tempTest.py
@ -44,21 +44,24 @@ def verifyNumbers(numberListList):
|
|||||||
|
|
||||||
|
|
||||||
def tempTest():
|
def tempTest():
|
||||||
print("====================")
|
while True:
|
||||||
print("starting temperature test ")
|
print("====================")
|
||||||
canTest.waitForUserInput(True)
|
print("starting temperature test ")
|
||||||
Temps = getTempOverCan()
|
canTest.waitForUserInput(True)
|
||||||
allTemp = []
|
Temps = getTempOverCan()
|
||||||
changed = []
|
allTemp = []
|
||||||
|
changed = []
|
||||||
|
|
||||||
for temp in Temps:
|
for temp in Temps:
|
||||||
allTemp += struct.unpack("<HHHH", temp) # Format anpassen
|
allTemp += struct.unpack("<HHHH", temp) # Format anpassen
|
||||||
|
|
||||||
print("Raw temperatures:")
|
print("Raw temperatures:")
|
||||||
print(allTemp)
|
print(allTemp)
|
||||||
|
|
||||||
for te in allTemp:
|
for te in allTemp:
|
||||||
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")
|
||||||
|
|||||||
@ -52,11 +52,14 @@ 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")
|
||||||
canTest.waitForUserInput(True)
|
while True:
|
||||||
voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat
|
canTest.waitForUserInput(True)
|
||||||
allVoltages = []
|
voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat
|
||||||
for volt in voltages:
|
allVoltages = []
|
||||||
allVoltages.append(struct.unpack("<HHHH", volt))
|
for volt in voltages:
|
||||||
|
allVoltages.append(struct.unpack("<HHHH", volt))
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user