io_pins: remove more Inverted flags for input pins

This commit is contained in:
Andrey Gusakov 2025-02-11 21:32:02 +03:00 committed by rusefillc
parent b759e595ca
commit 6d19633fee
7 changed files with 15 additions and 25 deletions

View File

@ -18,7 +18,7 @@ bool AntilagSystemBase::isInsideALSSwitchCondition() {
if (isALSSwitchActivated) {
if (isBrainPinValid(engineConfiguration->ALSActivatePin)) {
#if EFI_PROD_CODE
ALSActivatePinState = engineConfiguration->ALSActivateInverted ^ efiReadPin(engineConfiguration->ALSActivatePin);
ALSActivatePinState = efiReadPin(engineConfiguration->ALSActivatePin, engineConfiguration->ALSActivatePinMode);
#else
ALSActivatePinState = false;
#endif

View File

@ -218,7 +218,7 @@ bool getClutchDownState() {
static bool getClutchUpState() {
#if EFI_GPIO_HARDWARE
if (isBrainPinValid(engineConfiguration->clutchUpPin)) {
return engineConfiguration->clutchUpPinInverted ^ efiReadPin(engineConfiguration->clutchUpPin);
return efiReadPin(engineConfiguration->clutchUpPin, engineConfiguration->clutchUpPinMode);
}
#endif // EFI_GPIO_HARDWARE
// todo: boolean sensors should leverage sensor framework #6342
@ -228,7 +228,7 @@ static bool getClutchUpState() {
bool getBrakePedalState() {
#if EFI_GPIO_HARDWARE
if (isBrainPinValid(engineConfiguration->brakePedalPin)) {
return engineConfiguration->brakePedalPinInverted ^ efiReadPin(engineConfiguration->brakePedalPin);
return efiReadPin(engineConfiguration->brakePedalPin, engineConfiguration->brakePedalPinMode);
}
#endif // EFI_GPIO_HARDWARE
// todo: boolean sensors should leverage sensor framework #6342

View File

@ -26,7 +26,7 @@ bool LaunchControlBase::isInsideSwitchCondition() {
if (isSwitchActivated) {
#if !EFI_SIMULATOR
if (isBrainPinValid(engineConfiguration->launchActivatePin)) {
launchActivatePinState = engineConfiguration->launchActivateInverted ^ efiReadPin(engineConfiguration->launchActivatePin);
launchActivatePinState = efiReadPin(engineConfiguration->launchActivatePin, engineConfiguration->launchActivatePinMode);
}
#endif // EFI_PROD_CODE
return launchActivatePinState;

View File

@ -127,8 +127,9 @@ bool NitrousController::checkTriggerPinState() const {
bool result = false;
#if !EFI_SIMULATOR
const switch_input_pin_e triggerPin = engineConfiguration->nitrousControlTriggerPin;
const pin_input_mode_e triggerPinMode = engineConfiguration->nitrousControlTriggerPinMode;
if (isBrainPinValid(triggerPin)) {
result = engineConfiguration->nitrousControlTriggerPinInverted ^ efiReadPin(triggerPin);
result = efiReadPin(triggerPin, triggerPinMode);
}
#endif // !EFI_SIMULATOR
return result;

View File

@ -38,8 +38,7 @@ void ShiftTorqueReductionController::updateTriggerPinState() {
case TORQUE_REDUCTION_BUTTON: {
updateTriggerPinState(
engineConfiguration->torqueReductionTriggerPin,
// hack until Inverted merged into Mode
engineConfiguration->torqueReductionTriggerPinInverted ? PI_INVERTED_DEFAULT : PI_DEFAULT,
engineConfiguration->torqueReductionTriggerPinMode,
engine->engineState.lua.torqueReductionState
);
break;
@ -47,8 +46,7 @@ void ShiftTorqueReductionController::updateTriggerPinState() {
case LAUNCH_BUTTON: {
updateTriggerPinState(
engineConfiguration->launchActivatePin,
// hack until Inverted merged into Mode
engineConfiguration->launchActivateInverted ? PI_INVERTED_DEFAULT : PI_DEFAULT,
engineConfiguration->launchActivatePinMode,
false
);
break;
@ -64,8 +62,7 @@ void ShiftTorqueReductionController::updateTriggerPinState() {
case TORQUE_REDUCTION_CLUTCH_UP_SWITCH: {
updateTriggerPinState(
engineConfiguration->clutchUpPin,
// hack until Inverted merged into Mode
engineConfiguration->clutchUpPinInverted ? PI_INVERTED_DEFAULT : PI_DEFAULT,
engineConfiguration->clutchUpPinMode,
engine->engineState.lua.clutchUpState
);
break;

View File

@ -943,7 +943,7 @@ custom maf_sensor_type_e 1 bits, S08, @OFFSET@, [0:1], @@maf_sensor_type_e_enum@
custom vehicle_info_t @@VEHICLE_INFO_SIZE@@ string, ASCII, @OFFSET@, @@VEHICLE_INFO_SIZE@@
custom gppwm_note_t @@GPPWM_NOTE_SIZE@@ string, ASCII, @OFFSET@, @@GPPWM_NOTE_SIZE@@
bit clutchUpPinInverted,"Inverted","Normal"
bit dead003
bit dead000
bit useHbridgesToDriveIdleStepper;If enabled we use two H-bridges to drive stepper idle air valve
bit multisparkEnable
@ -1068,11 +1068,11 @@ bit cutSparkOnHardLimit,"yes","no";Be careful enabling this: some engines are kn
bit launchFuelCutEnable
bit launchSparkCutEnable;This is the Cut Mode normally used
bit torqueReductionEnabled
bit torqueReductionTriggerPinInverted
bit dead001
bit limitTorqueReductionTime
bit verboseIsoTp;Are you a developer troubleshooting TS over CAN ISO/TP?
bit engineSnifferFocusOnInputs
bit launchActivateInverted
bit dead002
bit twoStroke,"Two Stroke","Four Stroke"
bit skippedWheelOnCam,"On camshaft","On crankshaft";Where is your primary skipped wheel located?
@ -1113,7 +1113,7 @@ bit invertVvtControlIntake,"retard","advance";If increased VVT duty cycle increa
bit invertVvtControlExhaust,"retard","advance";If increased VVT duty cycle increases the indicated VVT angle, set this to 'advance'. If it decreases, set this to 'retard'. Most intake cams use 'advance', and most exhaust cams use 'retard'.
bit useBiQuadOnAuxSpeedSensors
bit sdTriggerLog,"trigger","normal";'Trigger' mode will write a high speed log of trigger events (warning: uses lots of space!). 'Normal' mode will write a standard MLG of sensors, engine function, etc. similar to the one captured in TunerStudio.
bit ALSActivateInverted
bit dead005
bit stepper_dc_use_two_wires
bit watchOutForLinearTime
@ -1199,7 +1199,7 @@ int16_t tps2Max;Full throttle#2. tpsMax value as 10 bit ADC value. Not Voltage!\
bit enableAemXSeriesEgt;AEM X-Series EGT gauge kit or rusEFI EGT sensor from Wideband controller
bit startRequestPinInverted,"Inverted","Normal"
bit tcu_rangeSensorPulldown
bit brakePedalPinInverted,"Inverted","Normal"
bit devBit01
bit devBit0
bit devBit1
bit devBit2
@ -1717,7 +1717,7 @@ uint8_t autoscale knockFuelTrim;Fuel trim when knock, max 30%;"%", 1, 0, 0, 30,
SentFuelHighPressureType FuelHighPressureSentType;If you have SENT High Pressure Fuel Sensor please select type. For analog TPS leave None
bit nitrousControlEnabled
bit nitrousControlTriggerPinInverted
bit unusedFancy2
bit unusedFancy3
bit unusedFancy4
bit unusedFancy5

View File

@ -3240,10 +3240,8 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
field = "Clutch Down mode", clutchDownPinMode@@if_ts_show_clutch_down_pin
field = "Clutch Up", clutchUpPin@@if_ts_show_clutch_up_pin
field = "Clutch Up signal", clutchUpPinInverted@@if_ts_show_clutch_up_pin
field = "Clutch Up mode", clutchUpPinMode@@if_ts_show_clutch_up_pin
field = "Brake Pedal", brakePedalPin@@if_ts_show_brake_pedal_pin
field = "Brake Pedal signal", brakePedalPinInverted@@if_ts_show_brake_pedal_pin
field = "Brake Pedal Mode", brakePedalPinMode@@if_ts_show_brake_pedal_pin
field = "Turbo Speed Sensor", turboSpeedSensorInputPin
field = "Turbo Speed Multiplier", turboSpeedSensorMultiplier, { turboSpeedSensorInputPin }
@ -5082,7 +5080,6 @@ dialog = tcuControls, "Transmission Settings"
field = "Activation Mode", launchActivationMode, {launchControlEnabled == 1}
field = "Launch Button", launchActivatePin, {launchControlEnabled == 1 && (launchActivatePin != 0 || (launchActivationMode == @@launchActivationMode_e_SWITCH_INPUT_LAUNCH@@))}
field = "Launch Button inverted", launchActivateInverted, {launchControlEnabled == 1 && launchActivationMode == @@launchActivationMode_e_SWITCH_INPUT_LAUNCH@@}
field = "Launch Button mode", launchActivatePinMode, {launchControlEnabled == 1 && launchActivationMode == @@launchActivationMode_e_SWITCH_INPUT_LAUNCH@@}
field = "Clutch Down", clutchDownPin, {launchControlEnabled == 1 && (clutchDownPin != 0 || (launchActivationMode == @@launchActivationMode_e_CLUTCH_INPUT_LAUNCH@@))}@@if_ts_show_clutch_down_pin
@ -5108,11 +5105,9 @@ dialog = tcuControls, "Transmission Settings"
dialog = TorqueReductionButtonDialog, "Torque Reduction Button"
field = "Torque Reduction Button", torqueReductionTriggerPin
field = "Torque Reduction Inverted", torqueReductionTriggerPinInverted, {torqueReductionTriggerPin != 0}
dialog = LaunchButtonDialog, "Launch Button"
field = "Launch Button", launchActivatePin
field = "Launch Button Inverted", launchActivateInverted, {launchActivatePin != 0}
dialog = ClutchDownDialog, "Clutch Down"
field = "Clutch Down", clutchDownPin
@ -5120,7 +5115,6 @@ dialog = tcuControls, "Transmission Settings"
dialog = ClutchUpDialog, "Clutch Up"
field = "Clutch Up", clutchUpPin
field = "Clutch Up Inverted", clutchUpPinInverted, {clutchUpPin != 0}
field = "Clutch Up Mode", clutchUpPinMode, {clutchUpPin != 0}
dialog = TorqueReductionActivationModeDialog, "Activation", yAxis
@ -5149,7 +5143,6 @@ dialog = tcuControls, "Transmission Settings"
dialog = NitrousControlButtonDialog, "Digital Switch Input"
field = "Nitrous Control Button", nitrousControlTriggerPin
field = "Nitrous Control Inverted", nitrousControlTriggerPinInverted, {nitrousControlTriggerPin != 0}
field = "Nitrous Control Mode", nitrousControlTriggerPinMode, {nitrousControlTriggerPin != 0}
dialog = NitrousControlLuaGaugeDialog, "Lua Gauge"
@ -5193,7 +5186,6 @@ dialog = tcuControls, "Transmission Settings"
field = "Enable AntiLag", antiLagEnabled
field = "Activation Mode", antiLagActivationMode
field = "Switch Input", ALSActivatePin, {antiLagActivationMode == @@antiLagActivationMode_e_SWITCH_INPUT_ANTILAG@@ && antiLagEnabled == 1}
field = "ALS Button inverted", ALSActivateInverted, {antiLagActivationMode == @@antiLagActivationMode_e_SWITCH_INPUT_ANTILAG@@ && antiLagEnabled == 1}
field = "ALS Button mode", ALSActivatePinMode, {antiLagActivationMode == @@antiLagActivationMode_e_SWITCH_INPUT_ANTILAG@@ && antiLagEnabled == 1}
field = "ALS timeout", ALSMaxDuration, {antiLagEnabled == 1}
field = "Max TPS", ALSMaxTPS, {antiLagEnabled == 1}