PROTEUS_GM_LS_4

This commit is contained in:
rusefillc 2022-10-27 19:53:28 -04:00
parent bae8959e78
commit 318d7ed933
5 changed files with 72 additions and 57 deletions

View File

@ -176,8 +176,6 @@ void setBoardDefaultConfiguration() {
engineConfiguration->throttlePedalSecondaryWOTVoltage = 0.0;
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
// would not hurt just in case no cam
engineConfiguration->twoWireBatchInjection = true;
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
engineConfiguration->injectionMode = IM_SEQUENTIAL;
@ -186,58 +184,4 @@ void setBoardDefaultConfiguration() {
engineConfiguration->launchActivationMode = CLUTCH_INPUT_LAUNCH;
// ? engineConfiguration->malfunctionIndicatorPin = Gpio::G4; //1E - Check Engine Light
strncpy(config->luaScript, R"(
function getBitRange(data, bitIndex, bitWidth)
byteIndex = bitIndex >> 3
shift = bitIndex - byteIndex * 8
value = data[1 + byteIndex]
if (shift + bitWidth > 8) then
value = value + data[2 + byteIndex] * 256
end
mask = (1 << bitWidth) - 1
return (value >> shift) & mask
end
STARTER_OUTPUT_INDEX = 0
startPwm(STARTER_OUTPUT_INDEX, 100, 0)
-- 201
ECMEngineStatus = 0xC9
IGN_STATUS = 0x1f1
-- 0x514
VIN_Part1 = 1300
-- 04E1
VIN_Part2 = 1249
setTickRate(100)
function canIgnStatus(bus, id, dlc, data)
crankingBits = getBitRange(data, 2, 2)
isCranking = (crankingBits == 2)
print('crankingBits ' .. crankingBits .. ', isCranking ' .. isCranking)
end
canRxAdd(IGN_STATUS, canIgnStatus)
-- todo: take VIN from configuration? encode VIN?
canVin1 = { 0x47, 0x4E, 0x4C, 0x43, 0x32, 0x45, 0x30, 0x34 }
canVin2 = { 0x42, 0x52, 0x32, 0x31, 0x36, 0x33, 0x36, 0x36 }
dataECMEngineStatus = { 0x84, 0x09, 0x99, 0x0A, 0x00, 0x40, 0x08, 0x00 }
function onTick()
txCan(1, VIN_Part1, 0, canVin1)
txCan(1, VIN_Part2, 0, canVin2)
-- good enough for fuel module!
txCan(1, ECMEngineStatus, 0, dataECMEngineStatus)
if isCranking then
setPwmDuty(STARTER_OUTPUT_INDEX, 1)
else
setPwmDuty(STARTER_OUTPUT_INDEX, 0)
end
end
)", efi::size(config->luaScript));
}

View File

@ -9,6 +9,10 @@
void setGmLs4() {
engineConfiguration->globalTriggerAngleOffset = 86;
// would not hurt just in case no cam
engineConfiguration->twoWireBatchInjection = true;
engineConfiguration->fuelReferencePressure = 400; // 400 kPa, 58 psi
engineConfiguration->injectorCompensationMode = ICM_FixedRailPressure;
engineConfiguration->injector.flow = 440;
@ -23,4 +27,65 @@ void setGmLs4() {
engineConfiguration->tChargeAirIncrLimit = 5;
engineConfiguration->tChargeAirDecrLimit = 15;
strncpy(config->luaScript, R"(
function getBitRange(data, bitIndex, bitWidth)
byteIndex = bitIndex >> 3
shift = bitIndex - byteIndex * 8
value = data[1 + byteIndex]
if (shift + bitWidth > 8) then
value = value + data[2 + byteIndex] * 256
end
mask = (1 << bitWidth) - 1
return (value >> shift) & mask
end
STARTER_OUTPUT_INDEX = 0
startPwm(STARTER_OUTPUT_INDEX, 100, 0)
-- 201
ECMEngineStatus = 0xC9
IGN_STATUS = 0x1f1
-- 0x514
VIN_Part1 = 1300
-- 04E1
VIN_Part2 = 1249
setTickRate(100)
function canIgnStatus(bus, id, dlc, data)
crankingBits = getBitRange(data, 2, 2)
isCranking = (crankingBits == 2)
print('crankingBits ' .. crankingBits .. ', isCranking ' .. isCranking)
end
canRxAdd(IGN_STATUS, canIgnStatus)
-- todo: take VIN from configuration? encode VIN?
canVin1 = { 0x47, 0x4E, 0x4C, 0x43, 0x32, 0x45, 0x30, 0x34 }
canVin2 = { 0x42, 0x52, 0x32, 0x31, 0x36, 0x33, 0x36, 0x36 }
dataECMEngineStatus = { 0x84, 0x09, 0x99, 0x0A, 0x00, 0x40, 0x08, 0x00 }
function onTick()
txCan(1, VIN_Part1, 0, canVin1)
txCan(1, VIN_Part2, 0, canVin2)
-- good enough for fuel module!
txCan(1, ECMEngineStatus, 0, dataECMEngineStatus)
if isCranking then
setPwmDuty(STARTER_OUTPUT_INDEX, 1)
else
setPwmDuty(STARTER_OUTPUT_INDEX, 0)
end
end
)", efi::size(config->luaScript));
}
void setProteusGmLs4() {
setGmLs4();
}

View File

@ -1,7 +1,7 @@
/*
* gm_ls_4.h
*
* Created on: 25 îêò. 2022 ã.
* Created on: 25 <EFBFBD><EFBFBD><EFBFBD>. 2022 <EFBFBD>.
* Author: Huge
*/
@ -10,3 +10,4 @@
#include "engine_configuration.h"
void setGmLs4();
void setProteusGmLs4();

View File

@ -870,6 +870,9 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e
break;
#endif // HW_MICRO_RUSEFI
#if HW_PROTEUS
case PROTEUS_GM_LS_4:
setProteusGmLs4();
break;
case PROTEUS_VW_B6:
setProteusVwPassatB6();
break;

View File

@ -1959,6 +1959,7 @@ cmd_set_engine_type_microRusEFI_Miata_NB2_MAP = "@@TS_IO_TEST_COMMAND_char@@@@t
cmd_set_engine_type_microRusEFI_VW_B6 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_MRE_VW_B6_16_hex@@"
cmd_set_engine_type_Proteus_VW_B6 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_VW_B6_16_hex@@"
cmd_set_engine_type_PROTEUS_GM_LS_4 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_GM_LS_4_16_hex@@"
cmd_set_engine_type_microRusEFI_MRE_BODY_CONTROL = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_MRE_BODY_CONTROL_16_hex@@"
cmd_set_engine_type_MRE_SECONDARY_CAN = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_MRE_SECONDARY_CAN_16_hex@@"
@ -2010,6 +2011,7 @@ cmd_set_engine_type_Frankenso_Miata_NB2 = "@@TS_IO_TEST_COMMAND_char@@@@ts_co
cmd_set_engine_type_Proteus_M73 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_BMW_M73_16_hex@@"
cmd_set_engine_type_PROTEUS_VW_B6 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_VW_B6_16_hex@@"
cmd_set_engine_type_PROTEUS_GM_LS_4 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_GM_LS_4_16_hex@@"
cmd_set_engine_type_PROTEUS_HONDA_K = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_HONDA_K_16_hex@@"
cmd_set_engine_type_PROTEUS_HONDA_OBD2A = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_HONDA_OBD2A_16_hex@@"
cmd_set_engine_type_PROTEUS_MIATA_NB2 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_MIATA_NB2_16_hex@@"