dual ADC wideband support (#5007)
* Initial work on dual ADC wideband * Added FunctionPointerSensor lambdaSensor2 and registered second sensor * removed second sensor heater output. Only used for NB and probably can be shared with sensor 1 --------- Co-authored-by: benas-gavea <bbrazdziunas@gavea.co.uk>
This commit is contained in:
parent
ff6ea96663
commit
9cac9a309a
|
@ -106,7 +106,7 @@ bool hasAfrSensor() {
|
|||
|
||||
extern float InnovateLC2AFR;
|
||||
|
||||
float getAfr() {
|
||||
float getAfr(SensorType type) {
|
||||
#if EFI_AUX_SERIAL
|
||||
if (engineConfiguration->enableInnovateLC2)
|
||||
return InnovateLC2AFR;
|
||||
|
@ -119,11 +119,11 @@ float getAfr() {
|
|||
#endif /* EFI_CJ125 && HAL_USE_SPI */
|
||||
afr_sensor_s * sensor = &engineConfiguration->afr;
|
||||
|
||||
if (!isAdcChannelValid(engineConfiguration->afr.hwChannel)) {
|
||||
if (!isAdcChannelValid(type == SensorType::Lambda1 ? engineConfiguration->afr.hwChannel : engineConfiguration->afr.hwChannel2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float volts = getVoltageDivided("ego", sensor->hwChannel);
|
||||
float volts = getVoltageDivided("ego", type == SensorType::Lambda1 ? sensor->hwChannel : sensor->hwChannel2);
|
||||
|
||||
if (engineConfiguration->afr_type == ES_NarrowBand) {
|
||||
float afr = interpolate2d(volts, config->narrowToWideOxygenBins, config->narrowToWideOxygen);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "global.h"
|
||||
#include "engine_configuration.h"
|
||||
|
||||
float getAfr();
|
||||
float getAfr(SensorType type);
|
||||
bool hasAfrSensor();
|
||||
void setEgoSensor(ego_sensor_e type);
|
||||
void initEgoAveraging();
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
struct GetAfrWrapper {
|
||||
float getLambda() {
|
||||
return getAfr() / 14.7f;
|
||||
return getAfr(SensorType::Lambda1) / 14.7f;
|
||||
};
|
||||
float getLambda2() {
|
||||
return getAfr(SensorType::Lambda2) / 14.7f;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,6 +21,11 @@ static FunctionPointerSensor lambdaSensor(SensorType::Lambda1,
|
|||
return afrWrapper.getLambda();
|
||||
});
|
||||
|
||||
static FunctionPointerSensor lambdaSensor2(SensorType::Lambda2,
|
||||
[]() {
|
||||
return afrWrapper.getLambda2();
|
||||
});
|
||||
|
||||
#include "AemXSeriesLambda.h"
|
||||
|
||||
#if EFI_CAN_SUPPORT
|
||||
|
@ -54,4 +62,5 @@ void initLambda() {
|
|||
#endif
|
||||
|
||||
lambdaSensor.Register();
|
||||
lambdaSensor2.Register();
|
||||
}
|
||||
|
|
|
@ -609,6 +609,7 @@ float globalFuelCorrection;set global_fuel_correction X;"coef", 1, 0, 0, 1000, 2
|
|||
|
||||
struct afr_sensor_s
|
||||
adc_channel_e hwChannel;
|
||||
adc_channel_e hwChannel2;
|
||||
float v1;;"volts", 1, 0, 0, 10, 2
|
||||
float value1;;"AFR", 1, 0, 0, 1000, 2
|
||||
float v2;;"volts", 1, 0, 0, 10, 2
|
||||
|
|
|
@ -2679,6 +2679,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = "MAF ADC input", mafAdcChannel
|
||||
field = "MAF 2 ADC input", maf2AdcChannel
|
||||
field = "AFR ADC input", afr_hwChannel
|
||||
field = "AFR 2 ADC input", afr_hwChannel2
|
||||
field = "Baro ADC input", baroSensor_hwChannel
|
||||
field = "MAP ADC input", map_sensor_hwChannel
|
||||
field = "Fuel Level input", fuelLevelSensor
|
||||
|
@ -3026,14 +3027,18 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = "high value", afr_value2
|
||||
field = "Correction", egoValueShift
|
||||
|
||||
dialog = egoSettings_IO, "EGO Sensor I/O"
|
||||
dialog = egoSettings_IO1, "EGO Sensor 1 I/O"
|
||||
field = "Input channel", afr_hwChannel
|
||||
field = "Heater output", o2heaterPin
|
||||
|
||||
dialog = egoSettings_IO2, "EGO Sensor 2 I/O"
|
||||
field = "Input channel", afr_hwChannel2
|
||||
|
||||
dialog = egoSettings, "", yAxis
|
||||
field = "Enable CAN Wideband", enableAemXSeries, { canReadEnabled }
|
||||
field = "Enable Innovate LC-2 Serial", enableInnovateLC2, { auxSerialRxPin && auxSerialTxPin }
|
||||
panel = egoSettings_IO
|
||||
panel = egoSettings_IO1
|
||||
panel = egoSettings_IO2, {afr_hwChannel != @@ADC_CHANNEL_NONE@@ && enableAemXSeries == 0 && !auxSerialRxPin && !auxSerialTxPin}
|
||||
panel = egoSettings_sensor, {afr_hwChannel != @@ADC_CHANNEL_NONE@@ && enableAemXSeries == 0 && !auxSerialRxPin && !auxSerialTxPin}
|
||||
|
||||
; Engine->EGT inputs
|
||||
|
|
Loading…
Reference in New Issue