Make output more readable
This commit is contained in:
parent
97ba8fc01b
commit
750697f4f7
12
canTest.py
12
canTest.py
|
@ -45,6 +45,7 @@ def waitForUserInput(waitForUserInput):
|
|||
|
||||
def CanTest(bustype="socketcan", channel="can0"):
|
||||
# -----------------------------------------------------------------------------------------------------#
|
||||
print("====================")
|
||||
print("Start testing the can bus connectivity ")
|
||||
global waitForUserInput
|
||||
if waitForUserInput(waitForUserInput) != 0:
|
||||
|
@ -69,9 +70,14 @@ def CanTest(bustype="socketcan", channel="can0"):
|
|||
count = count + 1
|
||||
|
||||
print(recivedMessage)
|
||||
print("Sending a single message test with answer result {}".format(result))
|
||||
print(
|
||||
"Sending a single message test with result {}".format(
|
||||
"PASSED" if result else "FAILED"
|
||||
)
|
||||
)
|
||||
# -----------------------------------------------------------------------------------------------------#
|
||||
|
||||
print("====================")
|
||||
print("testing for multiple sends")
|
||||
if waitForUserInput(waitForUserInput) != 0:
|
||||
return
|
||||
|
@ -88,8 +94,8 @@ def CanTest(bustype="socketcan", channel="can0"):
|
|||
print(packet.data)
|
||||
|
||||
print(
|
||||
"Sending multiple testmessages test with answer result {}".format(
|
||||
len(packete) == len(range(trials))
|
||||
"Sending multiple testmessages test with result {}".format(
|
||||
"PASSED" if len(packete) == len(range(trials)) else "FAILED"
|
||||
)
|
||||
)
|
||||
|
||||
|
|
4
eProm.py
4
eProm.py
|
@ -2,11 +2,13 @@ import canTest
|
|||
|
||||
|
||||
def ePromTest():
|
||||
print("====================")
|
||||
print("start eprom test")
|
||||
message = [4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
canTest.waitForUserInput(True)
|
||||
canTest.sendMessageOnCan(message)
|
||||
answer = canTest.recive()
|
||||
print("ePromTest reult {}".format(str(answer.data) == "bytearray(b'iiiiBiii')"))
|
||||
result = answer.data == bytearray(b"iiiBiiii")
|
||||
print("ePromTest result {}".format("PASSED" if result else "FAILED"))
|
||||
|
||||
print("I am done with this shit")
|
||||
|
|
|
@ -6,17 +6,18 @@ import eProm
|
|||
|
||||
def startBalancingTest():
|
||||
message = [5, 0xC, 0, 0xF, 0xF, 0xE, 0xE]
|
||||
print("====================")
|
||||
print("startBalancing")
|
||||
canTest.waitForUserInput(True)
|
||||
canTest.sendMessageOnCan(message)
|
||||
|
||||
|
||||
# canTest.CanTest()
|
||||
# eProm.ePromTest()
|
||||
# voltageTest.voltagesTest()
|
||||
canTest.CanTest()
|
||||
eProm.ePromTest()
|
||||
voltageTest.voltagesTest()
|
||||
tempTest.tempTest()
|
||||
|
||||
# startBalancingTest()
|
||||
startBalancingTest()
|
||||
"""
|
||||
print("start Temp test")
|
||||
message = [3, 0xc, 0, 0xf, 0xf, 0xe, 0xe]
|
||||
|
|
|
@ -44,6 +44,7 @@ def verifyNumbers(numberListList):
|
|||
|
||||
|
||||
def tempTest():
|
||||
print("====================")
|
||||
print("starting temperature test ")
|
||||
canTest.waitForUserInput(True)
|
||||
Temps = getTempOverCan()
|
||||
|
@ -51,13 +52,13 @@ def tempTest():
|
|||
changed = []
|
||||
|
||||
for temp in Temps:
|
||||
allTemp.append(struct.unpack("<HHHH", temp)) # Format anpassen
|
||||
allTemp += struct.unpack("<HHHH", temp) # Format anpassen
|
||||
|
||||
print("all Number")
|
||||
print("Raw temperatures:")
|
||||
print(allTemp)
|
||||
|
||||
for te in allTemp:
|
||||
for con in te:
|
||||
changed.append(((con / 16) * 0.0625))
|
||||
changed.append(((te >> 4) * 0.0625))
|
||||
print("Interpreted temperatures:")
|
||||
print(changed)
|
||||
print("I am done with this shit")
|
||||
|
|
|
@ -50,6 +50,7 @@ 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
|
||||
|
|
Loading…
Reference in New Issue