better EFI_ENGINE_CONTROL

This commit is contained in:
Andrey 2023-11-05 12:09:25 -05:00
parent 3d3671e6d4
commit 9237c4b16a
6 changed files with 18 additions and 3 deletions

View File

@ -578,6 +578,7 @@ void canDashboardHaltech(CanCycle cycle) {
msg[7] = 0;
}
#if EFI_ENGINE_CONTROL
/* 0x362 - 50Hz rate */
{
CanTxMessage msg(CanCategory::NBC, 0x362, 6);
@ -595,6 +596,7 @@ void canDashboardHaltech(CanCycle cycle) {
msg[4] = (ignAngle >> 8);
msg[5] = (ignAngle & 0x00ff);
}
#endif // EFI_ENGINE_CONTROL
/* todo: 0x3E5 = 50Hz rate */
{
@ -1233,12 +1235,14 @@ struct Aim5f7 {
};
static void populateFrame(Aim5f7& msg) {
#if EFI_ENGINE_CONTROL
// We don't handle wheel speed, just set to 0?
msg.LambdaErr1 = 0;
msg.LambdaErr2 = 0;
// both targets are the same for now
msg.LambdaTarget1 = (float)engine->fuelComputer.targetLambda;
msg.LambdaTarget2 = (float)engine->fuelComputer.targetLambda;
#endif // EFI_ENGINE_CONTROL
}
void canDashboardAim(CanCycle cycle) {

View File

@ -68,6 +68,7 @@ struct ms1514 {
static void populateFrame(ms1514& msg)
{
#if EFI_ENGINE_CONTROL
msg.afrtgt1 = (float)engine->fuelComputer.targetLambda * STOICH_RATIO;
msg.AFR1 = Sensor::getOrZero(SensorType::Lambda1) * STOICH_RATIO;
/* TODO: banks? */
@ -75,6 +76,7 @@ static void populateFrame(ms1514& msg)
/* TODO */
msg.egt1 = 0;
msg.pwseq1 = engine->engineState.injectionDuration;
#endif // EFI_ENGINE_CONTROL
}
struct ms1515 {

View File

@ -197,11 +197,12 @@ void processCanRxMessage(const size_t busIndex, const CANRxFrame &frame, efitick
obdOnCanPacketRx(frame, busIndex);
}
#if EFI_ENGINE_CONTROL
if (CAN_EID(frame) == GDI4_BASE_ADDRESS && frame.data8[7] == GDI4_MAGIC) {
// efiPrintf("CAN GDI4 says hi");
getLimpManager()->gdiComms.reset();
}
#endif // EFI_ENGINE_CONTROL
#if EFI_WIDEBAND_FIRMWARE_UPDATE
// Bootloader acks with address 0x727573 aka ascii "rus"

View File

@ -46,7 +46,9 @@ static void populateFrame(Status& msg) {
msg.fuelPump = enginePins.fuelPumpRelay.getLogicValue();
msg.checkEngine = enginePins.checkEnginePin.getLogicValue();
msg.o2Heater = enginePins.o2heater.getLogicValue();
#if EFI_ENGINE_CONTROL
msg.lambdaProtectActive = engine->lambdaMonitor.isCut();
#endif // EFI_ENGINE_CONTROL
msg.fan = enginePins.fanRelay.getLogicValue();
msg.fan2 = enginePins.fanRelay2.getLogicValue();
@ -71,10 +73,10 @@ static void populateFrame(Speeds& msg) {
auto timing = engine->engineState.timingAdvance[0];
msg.timing = timing > 360 ? timing - 720 : timing;
#if EFI_ENGINE_CONTROL
msg.injDuty = getInjectorDutyCycle(rpm);
msg.coilDuty = getCoilDutyCycle(rpm);
#endif // EFI_ENGINE_CONTROL
msg.vssKph = Sensor::getOrZero(SensorType::VehicleSpeed);
msg.EthanolPercent = Sensor::getOrZero(SensorType::FuelEthanolPercent);
@ -145,10 +147,12 @@ struct Fueling {
};
static void populateFrame(Fueling& msg) {
#if EFI_ENGINE_CONTROL
msg.cylAirmass = engine->fuelComputer.sdAirMassInOneCylinder;
msg.estAirflow = engine->engineState.airflowEstimate;
msg.fuel_pulse = (float)engine->outputChannels.actualLastInjection;
msg.knockCount = engine->module<KnockController>()->getKnockCount();
#endif // EFI_ENGINE_CONTROL
}
struct Fueling2 {

View File

@ -258,7 +258,9 @@ void firmwareError(ObdCode code, const char *fmt, ...) {
#if EFI_PROD_CODE
if (hasFirmwareErrorFlag)
return;
#if EFI_ENGINE_CONTROL
getLimpManager()->fatalError();
#endif // EFI_ENGINE_CONTROL
engine->engineState.warnings.addWarningCode(code);
#ifdef EFI_PRINT_ERRORS_AS_WARNINGS
{

View File

@ -177,6 +177,7 @@ void SensorChecker::onSlowCallback() {
// only bother checking these if we have GPIO chips actually capable of reporting an error
#if BOARD_EXT_GPIOCHIPS > 0 && EFI_PROD_CODE
// Check injectors
#if EFI_ENGINE_CONTROL
bool withInjectorIssues = false;
for (size_t i = 0; i < efi::size(enginePins.injectors); i++) {
InjectorOutputPin& pin = enginePins.injectors[i];
@ -197,6 +198,7 @@ void SensorChecker::onSlowCallback() {
}
}
engine->fuelComputer.injectorHwIssue = withInjectorIssues;
#endif // EFI_ENGINE_CONTROL
// Check ignition
for (size_t i = 0; i < efi::size(enginePins.injectors); i++) {