Add ISS sensor, rearrange some transmission config (#4089)

* move other solenoids to new dialog

* change name of menu item

* move buttonshift to new dialog

* add ISS config

* add some iss code

* add iss output

* de-init ISS
This commit is contained in:
David Holdeman 2022-04-21 08:07:52 -05:00 committed by GitHub
parent 12519633da
commit 1747b6a6e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 75 additions and 10 deletions

View File

@ -366,5 +366,7 @@ uint16_t rpmAcceleration;dRPM;"RPM/s",1, 0, 0, 5, 0
uint16_t auxSpeed1;"aux speed 1";"s",1, 0, 0, 0, 0
uint16_t auxSpeed2;"aux speed 2";"s",1, 0, 0, 0, 0
uint8_t[80 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
uint16_t autoscale ISSValue;@@GAUGE_NAME_ISS@@;"RPM",1, 0, 0, 8000, 0
uint8_t[78 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
end_struct

View File

@ -590,6 +590,8 @@ static void updateMiscSensors() {
engine->outputChannels.wastegatePositionSensor = Sensor::getOrZero(SensorType::WastegatePosition);
engine->outputChannels.ISSValue = Sensor::getOrZero(SensorType::InputShaftSpeed);
#if HAL_USE_ADC
engine->outputChannels.internalMcuTemperature = getMCUInternalTemperature();
#endif /* HAL_USE_ADC */

View File

@ -0,0 +1,9 @@
#include "pch.h"
#include "sensor_converter_func.h"
class InputShaftSpeedConverter : public SensorConverter {
public:
SensorResult convert(float frequency) const override {
return frequency * 60 / engineConfiguration->vssToothCount;
}
};

View File

@ -94,6 +94,9 @@ enum class SensorType : unsigned char {
AuxSpeed1,
AuxSpeed2,
InputShaftSpeed,
// Leave me at the end!
PlaceholderLast,
};

View File

@ -33,6 +33,7 @@ void initAuxSensors();
void initVehicleSpeedSensor();
void initTurbochargerSpeedSensor();
void initAuxSpeedSensors();
void initInputShaftSpeedSensor();
// Sensor reconfiguration
void deinitVbatt();
@ -44,3 +45,4 @@ void deInitVehicleSpeedSensor();
void deinitTurbochargerSpeedSensor();
void deinitMap();
void deinitAuxSpeedSensors();
void deinitInputShaftSpeedSensor();

View File

@ -15,3 +15,4 @@ INIT_SRC_CPP = $(PROJECT_DIR)/init/sensor/init_sensors.cpp \
$(PROJECT_DIR)/init/sensor/init_vehicle_speed_sensor.cpp \
$(PROJECT_DIR)/init/sensor/init_aux_speed_sensor.cpp \
$(PROJECT_DIR)/init/sensor/init_turbocharger_speed_sensor.cpp \
$(PROJECT_DIR)/init/sensor/init_input_shaft_speed_sensor.cpp \

View File

@ -0,0 +1,23 @@
#include "pch.h"
#include "init.h"
#include "frequency_sensor.h"
#include "input_shaft_speed_converter.h"
static FrequencySensor inputShaftSpeedSensor(SensorType::InputShaftSpeed, MS2NT(500));
static InputShaftSpeedConverter inputSpeedConverter;
void initInputShaftSpeedSensor() {
int parameter = engineConfiguration->issFilterReciprocal;
if (parameter <= 0 || parameter > 200) {
parameter = 2;
}
float filterParameter = 1.0f / parameter;
inputShaftSpeedSensor.initIfValid(engineConfiguration->tcuInputSpeedSensorPin, inputSpeedConverter, filterParameter);
}
void deinitInputShaftSpeedSensor() {
inputShaftSpeedSensor.deInit();
}

View File

@ -62,6 +62,7 @@ void initNewSensors() {
initVehicleSpeedSensor();
initTurbochargerSpeedSensor();
initAuxSpeedSensors();
initInputShaftSpeedSensor();
#if !EFI_UNIT_TEST
initFuelLevel();
@ -86,6 +87,7 @@ void stopSensors() {
deinitTurbochargerSpeedSensor();
deinitAuxSpeedSensors();
deinitMap();
deinitInputShaftSpeedSensor();
}
void reconfigureSensors() {
@ -97,6 +99,7 @@ void reconfigureSensors() {
initFlexSensor();
initVehicleSpeedSensor();
initTurbochargerSpeedSensor();
initInputShaftSpeedSensor();
initOldAnalogInputs();
}

View File

@ -749,7 +749,10 @@ pin_input_mode_e throttlePedalUpPinMode;
uint8_t acIdleExtraOffset;+Additional idle % while A/C is active;"%", 1, 0, 0, 100, 0
uint16_t autoscale finalGearRatio;Ratio between the wheels and your transmission output. ;"ratio", 0.01, 0, 0, 10, 2
uint16_t autoscale unused722;;"", 1, 0, 0, 0, 0
brain_input_pin_e tcuInputSpeedSensorPin
uint8_t tcuInputSpeedSensorTeeth
uint16_t wastegatePositionMin;+Voltage when the wastegate is closed.\nYou probably don't have one of these!;"mv", 1, 0, 0, 5000, 0
uint16_t wastegatePositionMax;+Voltage when the wastegate is fully open.\nYou probably don't have one of these!\n1 volt = 1000 units;"mv", 1, 0, 0, 5000, 0
uint16_t idlePositionMin;+Voltage when the idle valve is closed.\nYou probably don't have one of these!;"mv", 1, 0, 0, 5000, 0
@ -1506,7 +1509,7 @@ int8_t[MAX_CYLINDER_COUNT iterate] fuelTrim;;"Percent", @@PERCENT_TRIM_BYTE_PACK
uint8_t hpfpMinAngle;+If the requested activation time is below this angle, don't bother running the pump;"deg", 1, 0, 0, 255, 0
uint16_t autoscale hpfpPumpVolume;+Size of the pump chamber in cc. Typical Bosch HDP5 has a 9.0mm diameter, typical BMW N* stroke is 4.4mm.;"cc", 0.001, 0, 0, 65, 3
uint8_t hpfpActivationAngle;+How long to keep the valve activated (in order to allow the pump to build pressure and keep the valve open on its own);"deg", 1, 0, 0, 255, 0
uint8_t unusedFiller_4703;;"", 1, 0, 0, 255, 0
uint8_t issFilterReciprocal
uint16_t autoscale hpfpPidP;;"%/kPa", 0.001, 0, 0, 65, 3
uint16_t autoscale hpfpPidI;;"%/kPa/lobe", 0.00001, 0, 0, 0.65, 5
uint16_t hpfpTargetDecay;+The fastest rate the target pressure can be reduced by. This is because HPFP have no way to bleed off pressure other than injecting fuel.;"kPa/s", 1, 0, 0, 65000, 0
@ -1748,6 +1751,7 @@ end_struct
#define GAUGE_NAME_DESIRED_GEAR "Desired Gear"
#define GAUGE_NAME_CURRENT_GEAR "Current Gear"
#define GAUGE_NAME_ISS "Input Shaft Speed"
#define GAUGE_NAME_TIMING_ADVANCE "timing"
#define GAUGE_NAME_VVS "Vehicle Speed"

View File

@ -1214,6 +1214,7 @@ gaugeCategory = Transmission
currentGearGauge = tcuCurrentGear, @@GAUGE_NAME_CURRENT_GEAR@@, "gear", -1, 10, -1, -1, 10, 10, 0, 0
detectedGearGauge = detectedGear, @@GAUGE_NAME_DETECTED_GEAR@@, "gear", 0, @@GEARS_COUNT@@, 0, 0, @@GEARS_COUNT@@, @@GEARS_COUNT@@, 0, 0
speedToRpmRatioGauge = speedToRpmRatio, @@GAUGE_NAME_GEAR_RATIO@@, "", 0, 100, 0, 0, 100, 100, 4, 4
ISSGauge = ISSValue, @@GAUGE_NAME_ISS@@, "RPM", 0, {rpmHardLimit + 2000}, 200, {cranking_rpm}, {rpmHardLimit - 500}, {rpmHardLimit}, 0, 0
gaugeCategory = Knock
knock1Gauge = knock1, "Knock Cyl 1", "dBv", -60, 10, -60, -60, 10, 10, 0, 0
@ -1542,7 +1543,9 @@ menuDialog = main
subMenu = std_separator
subMenu = tcuControls, "Transmission Settings"
subMenu = tcuSolenoidTableTbl, "TCU Solenoids"
subMenu = gearControls, "Gear Selection Settings"
subMenu = inputSpeedSensor, "Input Speed Sensor"
subMenu = tcuSolenoidTableTbl, "Shift Solenoids"
subMenu = tccCurves, "TCC Lock/Unlock Speed"
subMenu = pcPerGearDialog, "Line Pressure Per Gear"
subMenu = pcPerShiftDialog, "Line Pressure Per Shift"
@ -3451,7 +3454,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
field = "Gear Controller" gearControllerMode, { tcuEnabled }
field = "Transmission Controller" transmissionControllerMode, { tcuEnabled }
dialog = solenoidPanel, "Shift Solenoids"
dialog = shiftSolenoidPanel, "Shift Solenoids"
field = "Solenoid 1 Pin" tcu_solenoid1, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_SimpleTransmissionController@@ || transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "Solenoid 1 Pin Mode" tcu_solenoid_mode1, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_SimpleTransmissionController@@ || transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "Solenoid 2 Pin" tcu_solenoid2, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_SimpleTransmissionController@@ || transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
@ -3464,6 +3467,11 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
field = "Solenoid 5 Pin Mode" tcu_solenoid_mode5, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_SimpleTransmissionController@@ || transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "Solenoid 6 Pin" tcu_solenoid6, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_SimpleTransmissionController@@ || transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "Solenoid 6 Pin Mode" tcu_solenoid_mode6, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_SimpleTransmissionController@@ || transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "3-2 Solenoid Pin" tcu_32_solenoid_pin, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "3-2 Solenoid Pin mode" tcu_32_solenoid_pin_mode, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "3-2 Solenoid Frequency" tcu_32_solenoid_freq, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
dialog = otherSolenoidPanel, "Other Solenoids"
field = "TCC On/Off Solenoid Pin" tcu_tcc_onoff_solenoid, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "TCC On/Off Solenoid Pin Mode" tcu_tcc_onoff_solenoid_mode, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "TCC PWM Solenoid Pin" tcu_tcc_pwm_solenoid, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
@ -3472,9 +3480,6 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
field = "Pressure Control Solenoid Pin" tcu_pc_solenoid_pin, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "Pressure Control Solenoid Pin Mode" tcu_pc_solenoid_pin_mode, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "Pressure Control Solenoid Frequency" tcu_pc_solenoid_freq, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "3-2 Solenoid Pin" tcu_32_solenoid_pin, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "3-2 Solenoid Pin mode" tcu_32_solenoid_pin_mode, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
field = "3-2 Solenoid Frequency" tcu_32_solenoid_freq, { tcuEnabled && (transmissionControllerMode == @@TransmissionControllerMode_Gm4l6x@@) }
dialog = buttonShiftInputPanel, "Switch/Button Shift"
field = "Upshift Pin" tcuUpshiftButtonPin, { tcuEnabled && gearControllerMode == @@GearControllerMode_ButtonShift@@ }
@ -3482,11 +3487,22 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
field = "Downshift Pin" tcuDownshiftButtonPin, { tcuEnabled && gearControllerMode == @@GearControllerMode_ButtonShift@@ }
field = "Downshift Pin Mode" tcuDownshiftButtonPinMode, { tcuEnabled && gearControllerMode == @@GearControllerMode_ButtonShift@@ }
dialog = tcuControls, "Transmission Settings"
dialog = inputSpeedSensorPanel, "Input Speed Sensor"
field = "Input Pin", tcuInputSpeedSensorPin
field = "Filter parameter", issFilterReciprocal, { tcuInputSpeedSensorPin != @@ADC_CHANNEL_NONE@@ }
field = "Tooth Count", tcuInputSpeedSensorTeeth
dialog = tcuControls, "Transmission Settings"
panel = transmissionPanel
panel = solenoidPanel
panel = shiftSolenoidPanel
panel = otherSolenoidPanel
dialog = gearControls, "Gear Selection Settings"
panel = buttonShiftInputPanel
dialog = inputSpeedSensor, "Input Speed Sensor"
panel = inputSpeedSensorPanel
dialog = tccCurves, "TCC Lock/Unlock Speed"
panel = tccLockCurve