rusefi/firmware/config/engines/hyundai.cpp

79 lines
2.0 KiB
C++
Raw Normal View History

2021-10-11 09:37:24 -07:00
/*
* @file hyundai.cpp
*
* @date Oct 11, 2021
* @author Andrey Belomutskiy, (c) 2012-2021
*/
2022-07-17 22:56:58 -07:00
#include "pch.h"
2021-10-11 09:37:24 -07:00
#include "hyundai.h"
2023-04-20 13:52:49 -07:00
#include "proteus_meta.h"
2021-10-11 11:22:35 -07:00
2023-03-20 14:49:02 -07:00
void setHyundaiPb() {
2023-04-19 17:58:26 -07:00
engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->specs.firingOrder = FO_1_3_4_2;
engineConfiguration->specs.displacement = 1.6;
strcpy(engineConfiguration->engineMake, ENGINE_MAKE_Hyundai);
strcpy(engineConfiguration->engineCode, "Gamma");
2023-03-20 14:49:02 -07:00
}
2023-04-20 13:52:49 -07:00
void setProteusHyundaiPb() {
engineConfiguration->triggerInputPins[0] = PROTEUS_VR_1;
engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_1;
2023-04-20 13:56:02 -07:00
engineConfiguration->camInputs[1] = PROTEUS_DIGITAL_2;
2023-04-20 13:52:49 -07:00
}
2022-01-05 10:49:38 -08:00
static void commonGenesisCoupe() {
strncpy(config->luaScript, R"(
2022-01-08 16:46:00 -08:00
-- code outside of functions is invoked once on start-up
2022-01-05 10:49:38 -08:00
-- listen to CAN ID 0x4f0
canRxAdd(0x4f0)
-- todo: add payload logic
2022-01-08 16:46:00 -08:00
packet4f1 = { 0xFA, 0x54, 0x00, 0x0, 0x00, 0x51, 0x00, 0x00 }
2022-01-05 10:49:38 -08:00
function onCanRx(bus, id, dlc, data)
print('got CAN id=' .. id .. ' dlc=' .. dlc)
-- todo: add filtering logic if needed
rpm = getSensor("RPM")
-- handle nil RPM, todo: change firmware to avoid nil RPM
rpm = (rpm == nil and 0 or rpm)
if rpm > 800 then
-- at the moment we simply
2022-01-08 16:46:00 -08:00
txCan(1, 0x4f1, 0, packet4f1)
2022-01-05 10:49:38 -08:00
end
end
function onTick()
2022-01-08 16:46:00 -08:00
-- empty function onTick we are not doing anything periodically so far
2022-01-05 10:49:38 -08:00
end
)", efi::size(config->luaScript));
}
void setGenesisCoupeBK1() {
2022-01-05 10:49:38 -08:00
commonGenesisCoupe();
2021-10-11 11:22:35 -07:00
// 2010-2012 315cc at 43.5psi
// fuel system is fixed pressure 55psi
engineConfiguration->injector.flow = 354.19; // https://www.google.com/search?q=315*sqrt%2855%2F43.5%29
engineConfiguration->fuelReferencePressure = PSI2KPA(55);
}
void setGenesisCoupeBK2() {
2022-01-05 10:49:38 -08:00
commonGenesisCoupe();
2021-10-11 11:22:35 -07:00
// 2013+ 450cc at 43.5
// fuel system is fixed pressure 85psi
// flow rate P2 = flow rate P1 * sqrt(P2/P1)
engineConfiguration->injector.flow = 629.03; // https://www.google.com/search?q=450*sqrt%2885%2F43.5%29
engineConfiguration->fuelReferencePressure = PSI2KPA(85);
}