91#ifdef HW_HELLEN_4K_GDI
108#if defined(HW_HELLEN_4CHAN) || EFI_UNIT_TEST
112#if HW_PROTEUS && EFI_PROD_CODE
139#if HW_PROTEUS || HW_HELLEN_4CHAN
140 strncpy(
config->
luaScript, GET_BIT_RANGE_LSB TWO_BYTES_LSB PRINT_ARRAY SET_TWO_BYTES_LSB HYUNDAI_SUM_NIBBLES R
"(
142GDI4_BASE_ADDRESS = 0xBB20
143GDI_CHANGE_ADDRESS = GDI4_BASE_ADDRESS + 0x10
145GDI4_CAN_SET_TAG = 0x78
146local data_set_settings = { GDI4_CAN_SET_TAG, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
152function onCanConfiguration3(bus, id, dlc, data)
153 -- print("Received configuration3 "..arrayToString(data))
154 pumpPeak = getTwoBytesLSB(data, 6, 1 / 128)
155 print("GDI4 says PumpPeakCurrent ".. pumpPeak)
156 setLuaGauge(1, pumpPeak)
159function onCanVersion(bus, id, dlc, data)
160 year = data[1] * 100 + data[2]
163-- print ("GDI4 firmware " ..year ..'/' ..month ..'/' ..day)
166canRxAdd(GDI4_BASE_ADDRESS + 3, onCanConfiguration3)
167canRxAdd(GDI4_BASE_ADDRESS + 5, onCanVersion)
182payLoad128 = { 0x00, 0x17, 0x70, 0x0F, 0x1B, 0x2C, 0x1B, 0x75 }
183payLoad129 = { 0x40, 0x84, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x75 }
184payLoad399 = { 0x00, 0x30, 0x1d, 0x00, 0x00, 0x63, 0x00, 0x00 }
185payLoad608 = { 0x05, 0x1d, 0x00, 0x30, 0x01, 0xa5, 0x7f, 0x31 }
186payLoad672 = { 0xe0, 0x00, 0x5f, 0x98, 0x39, 0x12, 0x9e, 0x08 }
187payLoad809 = { 0xd7, 0x7b, 0x7e, 0x0c, 0x11, 0x2c, 0x00, 0x10 }
188payLoad898 = { 0x40, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x08 }
189payLoad1349 = { 0xCA, 0x16, 0x00, 0x8A, 0x75, 0xFF, 0x75, 0xFF }
191speedSensor = Sensor.new("VehicleSpeed")
192speedSensor : setTimeout(3000)
194function onCluPacket(bus, id, dlc, data)
195 speedKph = getBitRange(data, 8, 9) * 0.5
196-- print('onCAR_SPEED ' ..speedKph)
197 speedSensor : set(speedKph)
200canRxAdd(1, 1264, onCluPacket)
203 local RPMread = math.floor(getSensor("RPM") * 4)
204 local RPMhi = RPMread >> 8
205 local RPMlo = RPMread & 0xff
207 payLoad128[3] = RPMlo
208 payLoad128[4] = RPMhi
210 counter = (counter + 1) % 16
212 check128 = hyundaiSumNibbles(payLoad128, counter)
213 payLoad128[8] = check128 * 16 + counter
214 txCan(1, EMS_DCT11_128, 0, payLoad128)
216 check129 = hyundaiSumNibbles(payLoad129, counter)
217 payLoad129[8] = check129 * 16 + counter
218 txCan(1, EMS_DCT12_129, 0, payLoad129)
220 canRPMpayload = { 0x05, 0x1B, RPMlo, RPMhi, 0x1B, 0x2C, 0x00, 0x7F }
222 txCan(1, EMS11_790, 0, canRPMpayload)
223 txCan(1, EMS14_1349, 0, payLoad1349)
225 txCan(1, EMS_H12_399, 0, payLoad399)
226 txCan(1, EMS6_608, 0, payLoad608)
227 txCan(1, EMS5_672, 0, payLoad672)
228 txCan(1, EMS12_809, 0, payLoad809)
229 txCan(1, EMS9_898, 0, payLoad898)
231 pumpPeakCurrent = getCalibration("mc33_hpfp_i_peak")
232 pumpHoldCurrent = getCalibration("mc33_hpfp_i_hold")
234 TholdOff = getCalibration("mc33_t_hold_off")
235 THoldDuration = getCalibration("mc33_t_hold_tot")
238 setTwoBytesLsb(data_set_settings, 1, TholdOff)
239 setTwoBytesLsb(data_set_settings, 3, THoldDuration)
240 setTwoBytesLsb(data_set_settings, 5, pumpPeakCurrent * FIXED_POINT)
241-- print('Will be sending ' ..arrayToString(data_set_settings))
242 txCan(1, GDI_CHANGE_ADDRESS + 3, 1, data_set_settings)
244 setTwoBytesLsb(data_set_settings, 1, pumpHoldCurrent * FIXED_POINT)
245 setTwoBytesLsb(data_set_settings, 3, GDI4_BASE_ADDRESS)
246-- print('Will be sending ' ..arrayToString(data_set_settings))
247 txCan(1, GDI_CHANGE_ADDRESS + 4, 1, data_set_settings)
348local data_0x329 = { 0x2C, 0x96, 0x80, 0x0E, 0x11, 0x2E, 0x00, 0x14 }
352local slowRollTable = { 0x0C, 0x4F, 0x80, 0xE3 }
354-- wakeup CAN messages
355local data_0x382 = { 0x00, 0x3A, 0X44, 0x24, 0x00, 0x00, 0x00, 0x00 }
356local data_0x0a0 = { 0x00, 0x68, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00 }
357local data_0x0a1 = { 0x80, 0x80, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00 }
358local data_0x18f = { 0xFA , 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
359local data_0x545 = { 0xEC, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00 }
360local data_0xA1 = { 0x80, 0x80, 0x00, 0x00, 0xEC, 0x00, 0x00, 0x00 }
361local data_0xA0 = { 0x00, 0x68, 0x00, 0x00, 0x00, 0xFF, 0x01, 0x00 }
362local data_0x260 = { 0x01, 0x1A, 0x1A, 0x10, 0x00, 0xAB, 0x93, 0x00 }
363local data_0x2A0 = { 0x00, 0x00, 0x04, 0x00, 0x78, 0x05, 0x0D, 0x01 }
368 txCan(1, 0x18f, 0, data_0x18f)
369 txCan(1, 0x545, 0, data_0x545)
370 -- more random can sends
371 txCan(1, 0x545, 0, data_0x545)
372 txCan(1, 0x382, 0, data_0x382)
373 txCan(1, 0xA0, 0, data_0xA0)
374 txCan(1, 0xA1, 0, data_0xA1)
375 txCan(1, 0x260, 0, data_0x260)
376 txCan(1, 0x2A0, 0, data_0x2A0)
378 local RPMread = math.floor(getSensor("RPM") + 0.5) * 4
380 local RPMhi = RPMread >> 8
381 local RPMlo = RPMread & 0xff
384 if getSensor("CLT") then
385 CLTread = math.floor(getSensor("CLT") + 0.5)
390 local CLThi = CLTread
391 local CLTlo = CLTread * 256
393 canCLTpayloadNo = { 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
394 canCLTpayloadLo = { 0x00, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
395 canCLTpayloadHi = { 0x00, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
396 canCLTpayloadHi2 = { 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
398 if slowCounter == 0 then
399 -- cycle through 0, 40, 80, c0
400 slowRoll = (slowRoll + 1) & 3
401 data_0x329[1] = slowRollTable[slowRoll + 1]
403 txCan(1, 0x329, 0, data_0x329)
406 slowCounter = slowCounter -1
409 if t : getElapsedSeconds() < 1.5 then
410 canRPMpayload = { 0x05, 0x1C, 0xFC, 0x7B, 0x1C, 0x2F, 0x00, 0x80 }
412 canRPMpayload = { 0x05, RPMlo, RPMhi, RPMhi, RPMlo, 0x2F, 0x00, 0x80 }
415 txCan(1, 0x316, 0, canRPMpayload)
417 txCan(1, 0x608, 0, canCLTpayloadNo)
418 elseif CLTread >= 60 and CLTread < 85 then
419 txCan(1, 0x608, 0, canCLTpayloadLo)
420 elseif CLTread >= 85 and CLTread < 110 then
421 txCan(1, 0x608, 0, canCLTpayloadHi)
423 txCan(1, 0x608, 0, canCLTpayloadHi2)
static void cannedcltIdleCorr()
void setHpfpLobeProfileAngle(int lobes)
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)
void setCustomMap(float lowValue, float mapLowValueVoltage, float highValue, float mapHighValueVoltage)
void setEtbPID(float p, float i, float d)
void setPPSCalibration(float primaryUp, float primaryDown, float secondaryUp, float secondaryDown)
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
void setAlgorithm(engine_load_mode_e algo)
static void set201xHyundai()
static void commonGenesisCoupe()
void setGenesisCoupeBK1()
void setGenesisCoupeBK2()
static void cannedprimeBins()
static void cannedprimeValues()
static void couplecannedignitionTable()
static void couplecannedveTable()
static void cannedcltIdleCorrBins()
air_pressure_sensor_config_s sensor
vehicle_info_t engineMake
bool disableFan1WhenStopped
output_pin_e hpfpValvePin
angle_t globalTriggerAngleOffset
float fuelReferencePressure
scaled_channel< uint16_t, 100, 1 > gearRatio[TCU_GEAR_COUNT]
float tpsDecelEnleanmentThreshold
float tpsAccelFractionDivisor
linear_sensor_s highPressureFuel
ignition_mode_e ignitionMode
dc_function_e etbFunctions[ETB_COUNT]
bool useIdleTimingPidControl
pid_s auxPid[CAMS_PER_BANK]
output_pin_e vvtPins[CAM_INPUTS_COUNT]
scaled_channel< uint8_t, 10, 1 > mc33_hpfp_i_hold
bool disableEtbWhenEngineStopped
bool disableFan2WhenStopped
bool invertVvtControlExhaust
vvt_mode_e vvtMode[CAMS_PER_BANK]
switch_input_pin_e acSwitch
scaled_channel< uint8_t, 10, 1 > iacByTpsHoldTime
bool displayLogicLevelsInEngineSniffer
pin_input_mode_e startStopButtonMode
output_pin_e starterControlPin
int16_t fanOffTemperature
float etbIdleThrottleRange
output_pin_e tachOutputPin
float vvtOffsets[CAM_INPUTS_COUNT]
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
injector_compensation_mode_e injectorCompensationMode
float tpsAccelEnrichmentThreshold
int16_t fan2OnTemperature
vehicle_info_t engineCode
bool useSeparateAdvanceForIdle
switch_input_pin_e startStopButtonPin
scaled_channel< uint8_t, 10, 1 > iacByTpsDecayTime
brain_input_pin_e camInputs[CAM_INPUTS_COUNT]
int16_t fan2OffTemperature
scaled_channel< uint8_t, 20, 1 > tpsAccelLookback
scaled_channel< uint8_t, 10, 1 > mc33_hpfp_i_peak
int16_t tpsAccelFractionPeriod
uint16_t afterCrankingIACtaperDuration[CLT_CRANKING_TAPER_CURVE_SIZE]
float cltCrankingCorr[CLT_CRANKING_CURVE_SIZE]
bool boardUse2stepPullDown
void setArrayValues(TValue(&array)[TSize], float value)
void setCommonNTCSensorParameters(ThermistorConf *thermistorConf)