GDI: bugfix and sending out pump currents
This commit is contained in:
parent
f371a4b9fd
commit
c6bf206f16
|
@ -64,6 +64,12 @@ function onCanConfiguration3(bus, id, dlc, data)
|
|||
print("GDI4 says HoldCurrent "..getTwoBytesLSB(data, 0, 1 / 128) )
|
||||
print("GDI4 says TholdOff "..getTwoBytesLSB(data, 2, 1) )
|
||||
print("GDI4 says THoldDuration "..getTwoBytesLSB(data, 4, 1) )
|
||||
print("GDI4 says PumpPeakCurrent"..getTwoBytesLSB(data, 6, 1 / 128) )
|
||||
end
|
||||
|
||||
function onCanConfiguration4(bus, id, dlc, data)
|
||||
print("Received configuration4 "..arrayToString(data))
|
||||
print("GDI4 says PumpHoldCurrent "..getTwoBytesLSB(data, 0, 1 / 128) )
|
||||
end
|
||||
|
||||
function onCanVersion(bus, id, dlc, data)
|
||||
|
@ -77,9 +83,11 @@ canRxAdd(GDI4_BASE_ADDRESS, printPacket)
|
|||
canRxAdd(GDI4_BASE_ADDRESS + 1, onCanConfiguration1)
|
||||
canRxAdd(GDI4_BASE_ADDRESS + 2, onCanConfiguration2)
|
||||
canRxAdd(GDI4_BASE_ADDRESS + 3, onCanConfiguration3)
|
||||
canRxAdd(GDI4_BASE_ADDRESS + 4, onCanVersion)
|
||||
canRxAdd(GDI4_BASE_ADDRESS + 4, onCanConfiguration4)
|
||||
canRxAdd(GDI4_BASE_ADDRESS + 5, onCanVersion)
|
||||
|
||||
local data_set_settings = { 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
GDI4_CAN_SET_TAG = 0x78
|
||||
local data_set_settings = { GDI4_CAN_SET_TAG, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
|
||||
FIXED_POINT = 128
|
||||
|
||||
|
@ -108,6 +116,9 @@ function onTick()
|
|||
THoldDuration = getCalibration("mc33_t_hold_tot")
|
||||
print("To send 3: TholdOff " .. TholdOff .. " THoldDuration " .. THoldDuration)
|
||||
|
||||
pumpPeakCurrent = getCalibration("mc33_hpfp_i_peak")
|
||||
pumpHoldCurrent = getCalibration("mc33_i_hold")
|
||||
|
||||
setTwoBytesLsb(data_set_settings, 1, boostVoltage)
|
||||
setTwoBytesLsb(data_set_settings, 3, boostCurrent * FIXED_POINT)
|
||||
setTwoBytesLsb(data_set_settings, 5, TBoostMin)
|
||||
|
@ -118,17 +129,21 @@ function onTick()
|
|||
setTwoBytesLsb(data_set_settings, 3, peakCurrent * FIXED_POINT)
|
||||
setTwoBytesLsb(data_set_settings, 5, TpeakDuration)
|
||||
print('Will be sending ' ..arrayToString(data_set_settings))
|
||||
txCan(1, GDI_CHANGE_ADDRESS + 2, 1, data_set_settings)
|
||||
txCan(1, GDI_CHANGE_ADDRESS + 1, 1, data_set_settings)
|
||||
|
||||
setTwoBytesLsb(data_set_settings, 1, TpeakOff)
|
||||
setTwoBytesLsb(data_set_settings, 3, Tbypass)
|
||||
setTwoBytesLsb(data_set_settings, 5, holdCurrent * FIXED_POINT)
|
||||
print('Will be sending ' ..arrayToString(data_set_settings))
|
||||
txCan(1, GDI_CHANGE_ADDRESS + 3, 1, data_set_settings)
|
||||
txCan(1, GDI_CHANGE_ADDRESS + 2, 1, data_set_settings)
|
||||
|
||||
setTwoBytesLsb(data_set_settings, 1, TholdOff)
|
||||
setTwoBytesLsb(data_set_settings, 3, THoldDuration)
|
||||
setTwoBytesLsb(data_set_settings, 5, 0)
|
||||
setTwoBytesLsb(data_set_settings, 5, pumpPeakCurrent * FIXED_POINT)
|
||||
print('Will be sending ' ..arrayToString(data_set_settings))
|
||||
txCan(1, GDI_CHANGE_ADDRESS + 3, 1, data_set_settings)
|
||||
|
||||
setTwoBytesLsb(data_set_settings, 1, pumpHoldCurrent * FIXED_POINT)
|
||||
print('Will be sending ' ..arrayToString(data_set_settings))
|
||||
txCan(1, GDI_CHANGE_ADDRESS + 4, 1, data_set_settings)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue