aux linear sensors (#4005)

* aux linear sensors

* comment

* kick build

* fix alignment

* fix alignment
This commit is contained in:
Matthew Kennedy 2022-03-20 17:13:04 -07:00 committed by GitHub
parent ce45951f7a
commit 1601156145
6 changed files with 42 additions and 4 deletions

View File

@ -288,7 +288,10 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 0, 0
int luaInvocationCounter;;"count",1, 0, 0, 0, 0
int luaLastCycleDuration;;"nt",1, 0, 0, 0, 0
uint8_t testBenchIter;;"count",1, 0, 0, 0, 0
uint8_t[79 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
uint8_t[75 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
int16_t autoscale auxLinear1;@@GAUGE_NAME_AUX_LINEAR_1@@;"", 0.01, 0, 0, 0, 0
int16_t autoscale auxLinear2;@@GAUGE_NAME_AUX_LINEAR_2@@;"", 0.01, 0, 0, 0, 0
bit launchSpeedCondition
bit launchRpmCondition

View File

@ -17,8 +17,8 @@ static scaled_channel<uint32_t, TIME_PRECISION> packedTime;
// todo: we are at the edge of sdLogBuffer size and at the moment we have no code to make sure buffer does not overflow
// todo: make this logic smarter
// minor hack to facilitate code generation while still enjoying constexpr access to generated array
#include "log_fields_generated.cpp"
// The list of logged fields lives in a separate file so it can eventually be tool-generated
#include "log_fields_generated.h"
static constexpr uint16_t computeFieldsRecordLength() {
uint16_t recLength = 0;

View File

@ -1,4 +1,3 @@
static constexpr LogField fields[] = {
{engine->outputChannels.RPMValue, GAUGE_NAME_RPM, "rpm", 0},
{packedTime, GAUGE_NAME_TIME, "sec", 0},
@ -102,4 +101,6 @@ static constexpr LogField fields[] = {
{engine->outputChannels.knock[11], GAUGE_NAME_KNOCK_12, "dBv", 0},
{engine->outputChannels.sparkCutReason, "Spark Cut Code", "", 0},
{engine->outputChannels.fuelCutReason, "Fuel Cut Code", "", 0},
{engine->outputChannels.auxLinear1, GAUGE_NAME_AUX_LINEAR_1, "", 2},
{engine->outputChannels.auxLinear2, GAUGE_NAME_AUX_LINEAR_2, "", 2},
};

View File

@ -88,6 +88,9 @@ enum class SensorType : unsigned char {
// MAP decoding happens only that often thus this is NOT raw MAP as flows from ADC
MapSlow,
AuxLinear1,
AuxLinear2,
// Leave me at the end!
PlaceholderLast,
};

View File

@ -17,6 +17,12 @@ static FunctionalSensor fuelPressureSensorHigh(SensorType::FuelPressureHigh, /*
static ProxySensor injectorPressure(SensorType::FuelPressureInjector);
static LinearFunc auxLinear1Func;
static FunctionalSensor auxLinear1Sensor(SensorType::AuxLinear1, /* timeout = */ MS2NT(50));
static LinearFunc auxLinear2Func;
static FunctionalSensor auxLinear2Sensor(SensorType::AuxLinear2, /* timeout = */ MS2NT(50));
/**
* @param bandwidth Hertz, used by low pass filter in to analog subscribers
*/
@ -49,6 +55,8 @@ void initOilPressure() {
initFluidPressure(oilpSensorFunc, oilpSensor, engineConfiguration->oilPressure, 10);
initFluidPressure(fuelPressureFuncLow, fuelPressureSensorLow, engineConfiguration->lowPressureFuel, 10);
initFluidPressure(fuelPressureFuncHigh, fuelPressureSensorHigh, engineConfiguration->highPressureFuel, 100);
initFluidPressure(auxLinear1Func, auxLinear1Sensor, engineConfiguration->auxLinear1, 10);
initFluidPressure(auxLinear2Func, auxLinear2Sensor, engineConfiguration->auxLinear2, 10);
injectorPressure.setProxiedSensor(
engineConfiguration->injectorPressureType == IPT_High

View File

@ -1104,6 +1104,8 @@ gaugeCategory = Sensors - Extra 1
AuxT2Gauge = auxTemp2, @@GAUGE_NAME_AUX_TEMP2@@, "C", -40, 140, -15, 1, 95, 110, 1, 1
lowFuelPressureGauge = lowFuelPressure, @@GAUGE_NAME_FUEL_PRESSURE_LOW@@, @@GAUGE_NAME_FUEL_PRESSURE_LOW_UNITS@@, 0, 700, 0, 0, 700, 700, 1, 0
flexPercentGauge = flexPercent, @@GAUGE_NAME_FLEX@@, "%", 0, 100, 0, 0, 100, 100, 0, 0
AuxL1Gauge = auxLinear1, @@GAUGE_NAME_AUX_LINEAR_1@@, "", -100, 100, -100, -100, 100, 100, 2, 2
AuxL2Gauge = auxLinear2, @@GAUGE_NAME_AUX_LINEAR_2@@, "", -100, 100, -100, -100, 100, 100, 2, 2
gaugeCategory = VVT
vvtPositionB1IGauge = vvtPositionB1I, @@GAUGE_NAME_VVT_B1I@@, "deg", -60, 60, -60, -60, 60, 60, 1, 1
@ -1550,6 +1552,9 @@ menuDialog = main
subMenu = fuelLevelDialog, "Fuel level sensor"
subMenu = egtInputs, "EGT" @@if_ts_show_egt
subMenu = wastegateIdlePos, "Wastegate and idle position sensors"
subMenu = std_separator
subMenu = auxLinearSensors, "Aux Linear Sensors"
menu = "&Controller"
subMenu = ecuStimulator, "ECU stimulator"
@ -2606,6 +2611,24 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
panel = fuelp_settings, West
panel = fuelPressureGauges, East
dialog = auxLinearSensor1, "Aux Linear Sensor #1"
field = "ADC input", auxLinear1_hwChannel
field = "Low voltage", auxLinear1_v1, {auxLinear1_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "Low value", auxLinear1_value1, {auxLinear1_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "High voltage", auxLinear1_v2, {auxLinear1_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "High value", auxLinear1_value2, {auxLinear1_hwChannel != @@ADC_CHANNEL_NONE@@}
dialog = auxLinearSensor2, "Aux Linear Sensor #2"
field = "ADC input", auxLinear2_hwChannel
field = "Low voltage", auxLinear2_v1, {auxLinear2_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "Low value", auxLinear2_value1, {auxLinear2_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "High voltage", auxLinear2_v2, {auxLinear2_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "High value", auxLinear2_value2, {auxLinear2_hwChannel != @@ADC_CHANNEL_NONE@@}
dialog = auxLinearSensors
panel = auxLinearSensor1
panel = auxLinearSensor2
; Sensors->MAP sensor
dialog = mapSensorAnalog, "MAP sensor", yAxis
field = "MAP ADC input", map_sensor_hwChannel