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"):
|
def CanTest(bustype="socketcan", channel="can0"):
|
||||||
# -----------------------------------------------------------------------------------------------------#
|
# -----------------------------------------------------------------------------------------------------#
|
||||||
|
print("====================")
|
||||||
print("Start testing the can bus connectivity ")
|
print("Start testing the can bus connectivity ")
|
||||||
global waitForUserInput
|
global waitForUserInput
|
||||||
if waitForUserInput(waitForUserInput) != 0:
|
if waitForUserInput(waitForUserInput) != 0:
|
||||||
@ -69,9 +70,14 @@ def CanTest(bustype="socketcan", channel="can0"):
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
||||||
print(recivedMessage)
|
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")
|
print("testing for multiple sends")
|
||||||
if waitForUserInput(waitForUserInput) != 0:
|
if waitForUserInput(waitForUserInput) != 0:
|
||||||
return
|
return
|
||||||
@ -88,8 +94,8 @@ def CanTest(bustype="socketcan", channel="can0"):
|
|||||||
print(packet.data)
|
print(packet.data)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"Sending multiple testmessages test with answer result {}".format(
|
"Sending multiple testmessages test with result {}".format(
|
||||||
len(packete) == len(range(trials))
|
"PASSED" if len(packete) == len(range(trials)) else "FAILED"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
4
eProm.py
4
eProm.py
@ -2,11 +2,13 @@ import canTest
|
|||||||
|
|
||||||
|
|
||||||
def ePromTest():
|
def ePromTest():
|
||||||
|
print("====================")
|
||||||
print("start eprom test")
|
print("start eprom test")
|
||||||
message = [4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
message = [4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||||
canTest.waitForUserInput(True)
|
canTest.waitForUserInput(True)
|
||||||
canTest.sendMessageOnCan(message)
|
canTest.sendMessageOnCan(message)
|
||||||
answer = canTest.recive()
|
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")
|
print("I am done with this shit")
|
||||||
|
@ -6,17 +6,18 @@ import eProm
|
|||||||
|
|
||||||
def startBalancingTest():
|
def startBalancingTest():
|
||||||
message = [5, 0xC, 0, 0xF, 0xF, 0xE, 0xE]
|
message = [5, 0xC, 0, 0xF, 0xF, 0xE, 0xE]
|
||||||
|
print("====================")
|
||||||
print("startBalancing")
|
print("startBalancing")
|
||||||
canTest.waitForUserInput(True)
|
canTest.waitForUserInput(True)
|
||||||
canTest.sendMessageOnCan(message)
|
canTest.sendMessageOnCan(message)
|
||||||
|
|
||||||
|
|
||||||
# canTest.CanTest()
|
canTest.CanTest()
|
||||||
# eProm.ePromTest()
|
eProm.ePromTest()
|
||||||
# voltageTest.voltagesTest()
|
voltageTest.voltagesTest()
|
||||||
tempTest.tempTest()
|
tempTest.tempTest()
|
||||||
|
|
||||||
# startBalancingTest()
|
startBalancingTest()
|
||||||
"""
|
"""
|
||||||
print("start Temp test")
|
print("start Temp test")
|
||||||
message = [3, 0xc, 0, 0xf, 0xf, 0xe, 0xe]
|
message = [3, 0xc, 0, 0xf, 0xf, 0xe, 0xe]
|
||||||
|
@ -44,6 +44,7 @@ def verifyNumbers(numberListList):
|
|||||||
|
|
||||||
|
|
||||||
def tempTest():
|
def tempTest():
|
||||||
|
print("====================")
|
||||||
print("starting temperature test ")
|
print("starting temperature test ")
|
||||||
canTest.waitForUserInput(True)
|
canTest.waitForUserInput(True)
|
||||||
Temps = getTempOverCan()
|
Temps = getTempOverCan()
|
||||||
@ -51,13 +52,13 @@ def tempTest():
|
|||||||
changed = []
|
changed = []
|
||||||
|
|
||||||
for temp in Temps:
|
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)
|
print(allTemp)
|
||||||
|
|
||||||
for te in allTemp:
|
for te in allTemp:
|
||||||
for con in te:
|
changed.append(((te >> 4) * 0.0625))
|
||||||
changed.append(((con / 16) * 0.0625))
|
print("Interpreted temperatures:")
|
||||||
print(changed)
|
print(changed)
|
||||||
print("I am done with this shit")
|
print("I am done with this shit")
|
||||||
|
@ -50,6 +50,7 @@ def verifyNumbers(numberListList):
|
|||||||
|
|
||||||
|
|
||||||
def voltagesTest():
|
def voltagesTest():
|
||||||
|
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)
|
canTest.waitForUserInput(True)
|
||||||
voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat
|
voltages = getBatteryVoltageOverCan() # rausfinden welche id der Slave hat
|
||||||
|
Loading…
x
Reference in New Issue
Block a user