GDI progress

This commit is contained in:
rusefillc 2022-12-20 17:40:15 -05:00
parent 0f1b6f6d59
commit f9bedd4301
2 changed files with 65 additions and 5 deletions

View File

@ -0,0 +1,60 @@
-- communication with https://github.com/rusefi/rusefi-hardware/tree/main/GDI-4ch/firmware
GDI4_BASE_ADDRESS = 0xF0
hexstr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F" }
function toHexString(num)
if num == 0 then
return '0'
end
local result = ""
while num > 0 do
local n = num % 16
result = hexstr[n + 1] ..result
num = math.floor(num / 16)
end
return result
end
function arrayToString(arr)
local str = ""
local index = 1
while arr[index] ~= nil do
str = str.." "..toHexString(arr[index])
index = index + 1
end
return str
end
function printPacket(bus, id, dlc, data)
print('Received ' ..arrayToString(data))
end
function getTwoBytesLSB(data, offset, factor)
return (data[offset + 2] * 256 + data[offset + 1]) * factor
end
function onCanConfiguration(bus, id, dlc, data)
print('Received configuration ' ..arrayToString(data))
print ("BoostVoltage " ..getTwoBytesLSB(data, 0, 0.01) )
print ("BoostCurrent " ..getTwoBytesLSB(data, 2, 0.01) )
print ("PeakCurrent " ..getTwoBytesLSB(data, 4, 0.01) )
print ("HoldCurrent " ..getTwoBytesLSB(data, 6, 0.01) )
end
canRxAdd(GDI4_BASE_ADDRESS, printPacket)
canRxAdd(GDI4_BASE_ADDRESS + 1, onCanConfiguration)
canRxAdd(GDI4_BASE_ADDRESS + 2, printPacket)
local data_0x1ae0092c = { 0x00, 0x00, 0x22, 0xe0, 0x41, 0x90, 0x00, 0x00 }
function onTick()
txCan(1, 0x200, 1, data_0x1ae0092c)
end

View File

@ -795,7 +795,7 @@ pin_output_mode_e hip9011IntHoldPinMode;
! 536870911 = 2^29-1, the maximum valid extended ID
uint32_t verboseCanBaseAddress;;"", 1, 0, 0, 536870911, 0
uint8_t mc33_hvolt;;"v", 1, 0, 40, 70, 0
uint8_t mc33_hvolt;Boost Voltage;"v", 1, 0, 40, 70, 0
uint8_t minimumBoostClosedLoopMap;Minimum MAP before closed loop boost is enabled. Use to prevent misbehavior upon entering boost.;"kPa", 1, 0, 0, 255, 0
output_pin_e acFanPin;Optional Radiator Fan used with A/C
@ -1424,12 +1424,12 @@ tChargeMode_e tChargeMode;
gppwm_channel[GPPWM_CHANNELS iterate] gppwm;
uint16_t mc33_i_boost;;"mA", 1, 0, 1000, 25000, 0
uint16_t mc33_i_peak;;"mA", 1, 0, 1000, 20000, 0
uint16_t mc33_i_hold;;"mA", 1, 0, 1000, 20000, 0
uint16_t mc33_i_boost;Boost Current;"mA", 1, 0, 1000, 25000, 0
uint16_t mc33_i_peak;Peak Current;"mA", 1, 0, 1000, 20000, 0
uint16_t mc33_i_hold;Hold Current;"mA", 1, 0, 1000, 20000, 0
uint16_t mc33_t_max_boost;Maximum allowed boost phase time. If the injector current doesn't reach the threshold before this time elapses, it is assumed that the injector is missing or has failed open circuit.;"us", 1, 0, 0, 10000, 0
uint16_t mc33_t_peak_off;;"us", 1, 0, 0, 10000, 0
uint16_t mc33_t_peak_tot;;"us", 1, 0, 0, 10000, 0
uint16_t mc33_t_peak_tot;Peak phase duration;"us", 1, 0, 0, 10000, 0
uint16_t mc33_t_bypass;;"us", 1, 0, 0, 10000, 0
uint16_t mc33_t_hold_off;;"us", 1, 0, 0, 10000, 0
uint16_t mc33_t_hold_tot;;"us", 1, 0, 0, 10000, 0