Make output more readable

This commit is contained in:
Jasper Blanckenburg 2023-04-01 20:35:33 +02:00
parent 97ba8fc01b
commit 750697f4f7
5 changed files with 23 additions and 12 deletions

View File

@ -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"
)
)

View File

@ -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")

View File

@ -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]

View File

@ -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")

View File

@ -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