Gather Nissan CAN data #2278
This commit is contained in:
parent
c11c16201c
commit
51da94ba89
|
@ -36,6 +36,9 @@ void setHellen121nissanVQ() {
|
||||||
strncpy(config->luaScript, R"(
|
strncpy(config->luaScript, R"(
|
||||||
canRxAdd(0x35d)
|
canRxAdd(0x35d)
|
||||||
|
|
||||||
|
OUT_1F9 = 0x1F9
|
||||||
|
OUT_23D = 0x23D
|
||||||
|
|
||||||
setTickRate(100)
|
setTickRate(100)
|
||||||
t = Timer.new()
|
t = Timer.new()
|
||||||
t : reset()
|
t : reset()
|
||||||
|
@ -43,7 +46,8 @@ t : reset()
|
||||||
globalAcOut = 0
|
globalAcOut = 0
|
||||||
|
|
||||||
function onTick()
|
function onTick()
|
||||||
local RPMread = math.floor(getSensor("RPM") + 0.5) / 3.15
|
local rpmValue = math.floor(getSensor("RPM") + 0.5)
|
||||||
|
local RPMread = rpmValue / 3.15
|
||||||
local RPMhi = RPMread / 256
|
local RPMhi = RPMread / 256
|
||||||
local RPMlo = RPMread
|
local RPMlo = RPMread
|
||||||
cltValue = getSensor("CLT")
|
cltValue = getSensor("CLT")
|
||||||
|
@ -51,7 +55,7 @@ function onTick()
|
||||||
local CLTread = math.floor(cltValue + 0.5)
|
local CLTread = math.floor(cltValue + 0.5)
|
||||||
|
|
||||||
--print('ac out = ' ..globalAcOut)
|
--print('ac out = ' ..globalAcOut)
|
||||||
if globalAcOut == 1 and RPMread >80 then
|
if globalAcOut == 1 and rpmValue > 250 then
|
||||||
fanPayloadOff = { 0x88, 0x00 }
|
fanPayloadOff = { 0x88, 0x00 }
|
||||||
fanPayloadLo = { 0x88, 0x00 }
|
fanPayloadLo = { 0x88, 0x00 }
|
||||||
fanPayloadHi = { 0x88, 0x00 }
|
fanPayloadHi = { 0x88, 0x00 }
|
||||||
|
@ -63,15 +67,11 @@ function onTick()
|
||||||
end
|
end
|
||||||
|
|
||||||
cltGauge = 0x00
|
cltGauge = 0x00
|
||||||
-- acOut = {0x32, 0x80, 0x00, 0x10, 0x00, 0x00}
|
|
||||||
-- txCan(1, 0x625, 0,acOut)
|
|
||||||
|
|
||||||
-- clt gauge stuff
|
-- clt gauge stuff
|
||||||
if CLTread < 115 then
|
if CLTread < 115 then
|
||||||
-- txCan(1, 0x608, 0, canCLTpayloadNo)
|
cltGauge = math.floor(cltValue * 1.5 + 0.5)
|
||||||
cltGauge = math.floor(CLTread * 1.5 + 0.5)
|
|
||||||
elseif CLTread >= 115 then
|
elseif CLTread >= 115 then
|
||||||
-- txCan(1, 0x608, 0, canCLTpayloadHi)
|
|
||||||
cltGauge = 0xF0
|
cltGauge = 0xF0
|
||||||
end
|
end
|
||||||
-- print('clt gauge = '..cltGauge)
|
-- print('clt gauge = '..cltGauge)
|
||||||
|
@ -82,20 +82,20 @@ function onTick()
|
||||||
CLTandRPM = { 0x00, 0x18, 0x0c, RPMlo, RPMhi, 0x87, 0xFF, cltGauge }
|
CLTandRPM = { 0x00, 0x18, 0x0c, RPMlo, RPMhi, 0x87, 0xFF, cltGauge }
|
||||||
end
|
end
|
||||||
|
|
||||||
txCan(1, 0x23D, 0, CLTandRPM) -- transmit CLT and RPM
|
txCan(1, OUT_23D, 0, CLTandRPM) -- transmit CLT and RPM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if RPMread > 80 then
|
if rpmValue > 250 then
|
||||||
if CLTread <= 80 then
|
if CLTread <= 80 then
|
||||||
txCan(1, 0x1F9, 0, fanPayloadOff)
|
txCan(1, OUT_1F9, 0, fanPayloadOff)
|
||||||
elseif CLTread >= 85 and CLTread < 90 then
|
elseif CLTread >= 85 and CLTread < 90 then
|
||||||
txCan(1, 0x1F9, 0, fanPayloadLo)
|
txCan(1, OUT_1F9, 0, fanPayloadLo)
|
||||||
elseif CLTread >= 90 then
|
elseif CLTread >= 90 then
|
||||||
txCan(1, 0x1F9, 0, fanPayloadHi)
|
txCan(1, OUT_1F9, 0, fanPayloadHi)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
txCan(1, 0x1F9, 0, fanPayloadOff)
|
txCan(1, OUT_1F9, 0, fanPayloadOff)
|
||||||
end
|
end
|
||||||
-- print('CLT temp' ..CLTread)
|
-- print('CLT temp' ..CLTread)
|
||||||
end
|
end
|
||||||
|
|
|
@ -64,7 +64,9 @@ static time_msecs_t mph_ctr;
|
||||||
// 505
|
// 505
|
||||||
#define NISSAN_RPM_1F9 0x1F9
|
#define NISSAN_RPM_1F9 0x1F9
|
||||||
|
|
||||||
#define NISSAN_UNKNOWN_1 0x231
|
// 561
|
||||||
|
#define NISSAN_ENGINE_2 0x231
|
||||||
|
// 563
|
||||||
#define NISSAN_UNKNOWN_2 0x233
|
#define NISSAN_UNKNOWN_2 0x233
|
||||||
// Nissan z33 350Z and else
|
// Nissan z33 350Z and else
|
||||||
// 0x23d = 573
|
// 0x23d = 573
|
||||||
|
@ -72,6 +74,7 @@ static time_msecs_t mph_ctr;
|
||||||
// 574
|
// 574
|
||||||
#define NISSAN_UNKNOWN_3 0x23E
|
#define NISSAN_UNKNOWN_3 0x23E
|
||||||
|
|
||||||
|
// 640
|
||||||
#define NISSAN_VEHICLE_SPEED_280 0x280
|
#define NISSAN_VEHICLE_SPEED_280 0x280
|
||||||
// wheel speed see "102 CAN Communication decoded"
|
// wheel speed see "102 CAN Communication decoded"
|
||||||
// 19500 value would be 100 kph
|
// 19500 value would be 100 kph
|
||||||
|
|
Loading…
Reference in New Issue