From 981d0f3e33d0c75e4f53942bbf943bde5ca94e02 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 29 Jun 2024 17:57:28 -0400 Subject: [PATCH] only:nissan cltGauge and TCU progress --- firmware/config/engines/nissan_vq.lua | 50 +++++++++++++++++++ .../lua/examples/nissan-xterra-tcu.txt | 18 +++---- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/firmware/config/engines/nissan_vq.lua b/firmware/config/engines/nissan_vq.lua index 104ccf44a4..724d3f8dad 100644 --- a/firmware/config/engines/nissan_vq.lua +++ b/firmware/config/engines/nissan_vq.lua @@ -7,8 +7,12 @@ IN_285 = 0x285 IN_35D = 0x35d ENGINE_1_1F9_505 = 505 +ENGINE_2_561 = 561 ENGINE_7_233_563 = 563 ENGINE_3_23D_573 = 573 +ENGINE_4_23E_574 = 574 +ENGINE_5_551_1361 = 1361 +ENGINE_6_580_1408 = 1408 setTickRate(100) startUpTimer = Timer.new() @@ -37,6 +41,7 @@ function sendENGINE_3_573() payloadENGINE_3_573[2] = pps / 0.392 payloadENGINE_3_573[3] = pps / 0.392 -- Throttle_position_capped + payloadENGINE_3_573[8] = cltGauge txCan(1, ENGINE_3_23D_573, 0, payloadENGINE_3_573) end @@ -73,6 +78,41 @@ function sendENGINE_1_505() -- print('CLT temp' ..cltValue) end +payloadENGINE_2_561 = {0xe0, 0x80, 0x09, 0xe0, 0xd4, 0xc3, 0x4c, 0x9e} +function sendENGINE_2_231_561() + payloadENGINE_2_561[3] = pps / 0.5 -- tps or pps + txCan(TCU_BUS, ENGINE_2_561, 0, payloadENGINE_2_561) +end + +payloadENGINE_4_574 = {0x00, 0x40, 0xff, 0x45, 0x00, 0xd6, 0x00, 0xa2} +function sendENGINE_4_23E_574() + payloadENGINE_4_574[3] = (100 - pps) / 0.392 -- data[3] -- affects desired torque converter pressure Throttle_position_inverted + payloadENGINE_4_574[7] = pps / 0.392 -- data[7] -- TPS + txCan(TCU_BUS, ENGINE_4_23E_574, 0, payloadENGINE_4_574) +end + +CAN_721_2d1 = 721 +payload721_2d1 = {0x00, 0x84, 0x00, 0x00, 0x31, 0xf8, 0x01} +function sendCan721_2d1() + txCan(TCU_BUS, CAN_721_2d1, 0, payload721_2d1) +end + +CAN_734_2de = 734 +payload734_2de = {0x0f, 0x08, 0x02, 0x00, 0x19, 0x65, 0x07, 0xa8} +function sendCan734_2de() + txCan(TCU_BUS, CAN_734_2de, 0, payload734_2de) +end + +payloadENGINE_5 = {0x7d, 0xdb, 0x00, 0xa0, 0x00, 0x02, 0x80, 0xff} +function sendENGINE_5_551_1361() + txCan(TCU_BUS, ENGINE_5_551_1361, 0, payloadENGINE_5) +end + +payloadENGINE_6 = {0x00, 0x82, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00} +function sendEngine6_580_1408() + txCan(TCU_BUS, ENGINE_6_580_1408, 0, payloadENGINE_6) +end + _10msPeriodTimer = Timer.new() function onTick() @@ -107,9 +147,19 @@ function onTick() if _10msPeriodTimer : getElapsedSeconds() > 0.01 then _10msPeriodTimer : reset() sendENGINE_1_505() + sendENGINE_2_231_561() sendENGINE_7_233_563() sendENGINE_3_573() + sendENGINE_4_23E_574() + sendCan721_2d1() + sendCan734_2de() + end + + if _15msPeriodTimer : getElapsedSeconds() > 0.015 then + _15msPeriodTimer : reset() + sendENGINE_5_551_1361() + sendEngine6_580_1408() end diff --git a/firmware/controllers/lua/examples/nissan-xterra-tcu.txt b/firmware/controllers/lua/examples/nissan-xterra-tcu.txt index c810a5468e..a633693d01 100644 --- a/firmware/controllers/lua/examples/nissan-xterra-tcu.txt +++ b/firmware/controllers/lua/examples/nissan-xterra-tcu.txt @@ -109,7 +109,6 @@ function sendENGINE_1_505() end pps = 0 --- 231 payloadENGINE_2_561 = {0xe0, 0x80, 0x09, 0xe0, 0xd4, 0xc3, 0x4c, 0x9e} function sendENGINE_2_231_561() payloadENGINE_2_561[3] = pps / 0.5 -- tps or pps @@ -137,9 +136,7 @@ function sendENGINE_3_573() -- txCan(TCU_BUS, ENGINE_3_23D_573, 0, data) end -ENGINE_4_574 = 574 payloadENGINE_4_574 = {0x00, 0x40, 0xff, 0x45, 0x00, 0xd6, 0x00, 0xa2} --- 23E function sendENGINE_4_23E_574() payloadENGINE_4_574[3] = (100 - pps) / 0.392 -- data[3] -- affects desired torque converter pressure Throttle_position_inverted payloadENGINE_4_574[7] = pps / 0.392 -- data[7] -- TPS @@ -162,27 +159,24 @@ canRxAdd(ECU_BUS, ENGINE_3_23D_573, onENGINE_3_573) CAN_721_2d1 = 721 payload721_2d1 = {0x00, 0x84, 0x00, 0x00, 0x31, 0xf8, 0x01} -function onCan721_2d1(bus, id, dlc, data) -end - function sendCan721_2d1() txCan(TCU_BUS, CAN_721_2d1, 0, payload721_2d1) end ---canRxAdd(ECU_BUS, CAN_721_2d1, onCan721_2d1) CAN_734_2de = 734 payload734_2de = {0x0f, 0x08, 0x02, 0x00, 0x19, 0x65, 0x07, 0xa8} -function onCan734_2de(bus, id, dlc, data) -end - function sendCan734_2de() txCan(TCU_BUS, CAN_734_2de, 0, payload734_2de) end +--function onCan734_2de(bus, id, dlc, data) +--end +--function onCan721_2d1(bus, id, dlc, data) +--end +--canRxAdd(ECU_BUS, CAN_721_2d1, onCan721_2d1) --canRxAdd(ECU_BUS, CAN_734_2de, onCan734_2de) - --canRxAdd(ECU_BUS, 721, onAnythingFromECU) -- required for TCU not to throw code --canRxAdd(ECU_BUS, 734, onAnythingFromECU) -- required for TCU not to throw code @@ -222,8 +216,8 @@ function onTick() _10msPeriodTimer : reset() sendENGINE_1_505() sendENGINE_2_231_561() - sendENGINE_3_573() sendENGINE_7_233_563() + sendENGINE_3_573() sendENGINE_4_23E_574() sendCan721_2d1() sendCan734_2de()