rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
hyundai.h File Reference

Functions

void setGenesisCoupeBK1 ()
 
void setGenesisCoupeBK2 ()
 
void setHyundaiPb ()
 
void cannedPbTables ()
 

Function Documentation

◆ cannedPbTables()

void cannedPbTables ( )

Definition at line 3 of file hyundai_pb_canned.cpp.

3 {
4#if (IGN_LOAD_COUNT == 16) && (IGN_RPM_COUNT == 16) && (FUEL_LOAD_COUNT == 16) && (FUEL_RPM_COUNT == 16)
11#endif
12}
static void pbcannedvvtTable1()
static void pbcannedinjectionPhase()
static void pbcannedignitionTable()
static void pbcannedveTable()
static void pbcannedlambdaTable()
static void pbcannedvvtTable2()

Referenced by setHyundaiPb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGenesisCoupeBK1()

void setGenesisCoupeBK1 ( )

Definition at line 431 of file hyundai.cpp.

431 {
433 // 2010-2012 315cc at 43.5psi
434 // fuel system is fixed pressure 55psi
435 engineConfiguration->injector.flow = 354.19; // https://www.google.com/search?q=315*sqrt%2855%2F43.5%29
437
438}
static constexpr engine_configuration_s * engineConfiguration
static void commonGenesisCoupe()
Definition hyundai.cpp:255

Referenced by applyEngineType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGenesisCoupeBK2()

void setGenesisCoupeBK2 ( )

Definition at line 440 of file hyundai.cpp.

440 {
442 // 2013+ 450cc at 43.5
443 // fuel system is fixed pressure 85psi
444 // flow rate P2 = flow rate P1 * sqrt(P2/P1)
445 engineConfiguration->injector.flow = 629.03; // https://www.google.com/search?q=450*sqrt%2885%2F43.5%29
447 // default "Throttle 2"
448 engineConfiguration->etbFunctions[1] = DC_Wastegate;
449
450}

Referenced by applyEngineType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHyundaiPb()

void setHyundaiPb ( )

Definition at line 39 of file hyundai.cpp.

39 {
41 // override injection phase
43 setInline4();
45 strcpy(engineConfiguration->engineMake, ENGINE_MAKE_Hyundai);
46 strcpy(engineConfiguration->engineCode, "Gamma");
47
52
55
62
63 // ETB buzzing is annoying :(
65
66 engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
68
70 // Injectors flow 1214 cc/min at 100 bar pressure
72
73 setCustomMap(/*lowValue*/ 20, /*mapLowValueVoltage*/ 0.79, /*highValue*/ 101.3, /*mapHighValueVoltage*/ 4);
74
77
78 engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
79 engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
80
84
85 engineConfiguration->highPressureFuel.v1 = 0.5; /* volts */;
87 engineConfiguration->highPressureFuel.v2 = 4.5; /* volts */;
88 // page 98, Fuel System > Engine Control System > Rail Pressure Sensor (RPS) > Specifications
90
91#ifdef HW_HELLEN_4K_GDI
93
94#endif
95
96#ifdef HW_HELLEN_4CHAN
97 engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CAM;
98 engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_D_4;
100
101 engineConfiguration->starterControlPin = Gpio::H144_OUT_PWM5; // F1
102 engineConfiguration->startStopButtonPin = Gpio::H144_IN_VSS; // C4
103 config->boardUse2stepPullDown = true; // looks like 1K extra pull-down is needed on the harness?! :(
104 engineConfiguration->camInputs[0] = Gpio::H144_IN_D_4; // E6
105 engineConfiguration->map.sensor.hwChannel = H144_IN_MAP2;
106#endif // HW_HELLEN_4CHAN
107
108#if defined(HW_HELLEN_4CHAN) || EFI_UNIT_TEST
109 engineConfiguration->hpfpValvePin = Gpio::H144_OUT_IO6; // E2
110#endif // HW_HELLEN_4CHAN
111
112#if HW_PROTEUS && EFI_PROD_CODE
113 engineConfiguration->highPressureFuel.hwChannel = PROTEUS_IN_ANALOG_VOLT_4;
116
117// engineConfiguration->acRelayPin = Gpio::PROTEUS_LS_6;
118 engineConfiguration->acSwitch = PROTEUS_DIGITAL_5;
119
120 engineConfiguration->fanPin = Gpio::PROTEUS_LS_5;
121 engineConfiguration->tachOutputPin = Gpio::PROTEUS_IGN_12;
122 engineConfiguration->hpfpValvePin = Gpio::PROTEUS_LS_6;
123 engineConfiguration->vvtPins[0] = Gpio::PROTEUS_LS_15; // intake
124 engineConfiguration->vvtPins[1] = Gpio::PROTEUS_LS_16; // exhaust
125
126
127 engineConfiguration->triggerInputPins[0] = PROTEUS_VR_1;
128 engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_1;
129 engineConfiguration->camInputs[1] = PROTEUS_DIGITAL_2; // currently intake, TODO: flip!
130
132
133// something something input levels are not happy for digital input pin?
134 engineConfiguration->starterControlPin = Gpio::PROTEUS_LS_14;
135 engineConfiguration->startStopButtonPin = PROTEUS_IN_AV_6_DIGITAL;
136#endif // HW_PROTEUS
138
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"(
141
142GDI4_BASE_ADDRESS = 0xBB20
143GDI_CHANGE_ADDRESS = GDI4_BASE_ADDRESS + 0x10
144
145GDI4_CAN_SET_TAG = 0x78
146local data_set_settings = { GDI4_CAN_SET_TAG, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
147
148FIXED_POINT = 128
149
150setTickRate(100)
151
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)
157end
158
159function onCanVersion(bus, id, dlc, data)
160 year = data[1] * 100 + data[2]
161 month = data[3]
162 day = data[4]
163-- print ("GDI4 firmware " ..year ..'/' ..month ..'/' ..day)
164end
165
166canRxAdd(GDI4_BASE_ADDRESS + 3, onCanConfiguration3)
167canRxAdd(GDI4_BASE_ADDRESS + 5, onCanVersion)
168
169
170EMS_DCT11_128 = 0x80
171EMS_DCT12_129 = 0x81
172EMS_H12_399 = 0x18f
173EMS6_608 = 0x260
174EMS5_672 = 0x2a0
175EMS11_790 = 0x316
176EMS12_809 = 0x329
177EMS9_898 = 0x382
178EMS14_1349 = 0x545
179
180counter = 0
181
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 }
190
191speedSensor = Sensor.new("VehicleSpeed")
192speedSensor : setTimeout(3000)
193
194function onCluPacket(bus, id, dlc, data)
195 speedKph = getBitRange(data, 8, 9) * 0.5
196-- print('onCAR_SPEED ' ..speedKph)
197 speedSensor : set(speedKph)
198end
199
200canRxAdd(1, 1264, onCluPacket)
201
202function onTick()
203 local RPMread = math.floor(getSensor("RPM") * 4)
204 local RPMhi = RPMread >> 8
205 local RPMlo = RPMread & 0xff
206
207 payLoad128[3] = RPMlo
208 payLoad128[4] = RPMhi
209
210 counter = (counter + 1) % 16
211
212 check128 = hyundaiSumNibbles(payLoad128, counter)
213 payLoad128[8] = check128 * 16 + counter
214 txCan(1, EMS_DCT11_128, 0, payLoad128)
215
216 check129 = hyundaiSumNibbles(payLoad129, counter)
217 payLoad129[8] = check129 * 16 + counter
218 txCan(1, EMS_DCT12_129, 0, payLoad129)
219
220 canRPMpayload = { 0x05, 0x1B, RPMlo, RPMhi, 0x1B, 0x2C, 0x00, 0x7F }
221
222 txCan(1, EMS11_790, 0, canRPMpayload)
223 txCan(1, EMS14_1349, 0, payLoad1349)
224
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)
230
231 pumpPeakCurrent = getCalibration("mc33_hpfp_i_peak")
232 pumpHoldCurrent = getCalibration("mc33_hpfp_i_hold")
233
234 TholdOff = getCalibration("mc33_t_hold_off")
235 THoldDuration = getCalibration("mc33_t_hold_tot")
236
237
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)
243
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)
248end
249
250)", efi::size(config->luaScript));
251#endif // HW_PROTEUS
252
253}
@ TLE9104_2_OUT_2
void setHpfpLobeProfileAngle(int lobes)
void setCustomMap(float lowValue, float mapLowValueVoltage, float highValue, float mapHighValueVoltage)
void setGDIFueling()
void setInline4()
static constexpr persistent_config_s * config
static void set201xHyundai()
Definition hyundai.cpp:21
void cannedPbTables()
void setProteusEtbIO()
scaled_channel< uint16_t, 100, 1 > gearRatio[TCU_GEAR_COUNT]
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
void setCommonNTCSensorParameters(ThermistorConf *thermistorConf)

Referenced by applyEngineType().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.