YES codes were cleared!

only:mre_f4
This commit is contained in:
rusefillc 2023-03-05 13:53:59 -05:00
parent f28654462d
commit 032ebc9794
1 changed files with 11 additions and 14 deletions

View File

@ -45,12 +45,13 @@ local cuId = 0
function onCanHello(bus, id, dlc, data)
-- here we handle 201 packets
print('Got Hello Response ' ..arrayToString(data))
code = data[2]
print('Got 0x201 packet code ' .. toHexString(code) .. ': TP Response ' ..arrayToString(data))
cuId = data[6] * 256 + data[5]
print('From *CU ' ..cuId)
out = { 0xA0, 0x0F, 0x8A, 0xFF, 0x32, 0xFF }
print("Saying hello " .. arrayToString(out))
print("Responding to 0x201 packet from " .. cuId .. ": Saying hello " .. arrayToString(out))
txCan(1, cuId, 0, out)
end
@ -77,7 +78,7 @@ function startTp()
sendCounter = 0
packetCounter = 1
payLoadIndex = 0
print("Starting TP with TCU")
print("Sending 0x200: Starting TP with TCU")
txCan(1, VWTP_OUT, 0, { cuType, 0xC0, 0x00, 0x10, 0x00, 0x03, 0x01 })
end
@ -91,7 +92,7 @@ end
function requestEraseCodes()
out = { nextReq(), 00, 0x03, 0x14, 0xFF, 0x00 }
txCan(1, cuId, 0, out)
print("Requesting to Erase Code(s)")
print("******************* Requesting to Erase Code(s) *****************************")
end
function scheduleTpRestart()
@ -103,14 +104,11 @@ keepAliveCounter = 0
function onCanTester(bus, id, dlc, data)
-- here we handle 300 packets
scheduleTpRestart()
print('Got from tester ' ..arrayToString(data))
if data[1] == 0xA3 then
print ("A3 Keep-alive")
print ("0x300 A3 Keep-alive withErrorCodes=" .. withErrorCodes)
txCan(1, cuId, 0, { 0xA1, 0x0F, 0x8A, 0xFF, 0x4A, 0xFF })
print ("Keep-alive withErrorCodes=" .. withErrorCodes)
if withErrorCodes > 0 then
requestEraseCodes()
else
@ -120,24 +118,23 @@ function onCanTester(bus, id, dlc, data)
keepAliveCounter = 0
end
end
return
end
if data[1] == 0xA1 then
print ("Happy 300 packet " .. arrayToString(data))
print ("Happy 300 startup packet " .. arrayToString(data))
txCan(1, cuId, 0, { nextReq(), 0x00, 0x02, 0x10, 0x89 })
return
end
if data[1] == 0xA8 then
print ("They said Bye-Bye")
print ("0x300 They said Bye-Bye")
return
end
print('0x300 Got from tester ' ..arrayToString(data))
if data[1] == 0x10 and dlc == 5 then
ackPacket = 0xB0 + packetCounter
print ("Sending ACK Bx " ..ackPacket)