usability progress: conditional ETB button enable. TODO: make logic consistent with other instances of same buttons

This commit is contained in:
rusefi 2022-11-26 14:26:29 -05:00
parent dfa70d0d9e
commit 3375648612
3 changed files with 14 additions and 9 deletions

View File

@ -941,7 +941,7 @@ static pid_s* getEtbPidForFunction(etb_function_e function) {
void doInitElectronicThrottle() { void doInitElectronicThrottle() {
bool shouldInitThrottles = Sensor::hasSensor(SensorType::AcceleratorPedalPrimary); bool shouldInitThrottles = Sensor::hasSensor(SensorType::AcceleratorPedalPrimary);
bool anyEtbConfigured = false; engineConfiguration->etb1configured = engineConfiguration->etb2configured = false;
// todo: technical debt: we still have DC motor code initialization in ETB-specific file while DC motors are used not just as ETB // todo: technical debt: we still have DC motor code initialization in ETB-specific file while DC motors are used not just as ETB
// todo: rename etbFunctions to something-without-etb for same reason? // todo: rename etbFunctions to something-without-etb for same reason?
@ -960,10 +960,15 @@ void doInitElectronicThrottle() {
auto pid = getEtbPidForFunction(func); auto pid = getEtbPidForFunction(func);
anyEtbConfigured |= controller->init(func, motor, pid, &pedal2tpsMap, shouldInitThrottles); bool etbConfigured = controller->init(func, motor, pid, &pedal2tpsMap, shouldInitThrottles);
if (i == 0) {
engineConfiguration->etb1configured = etbConfigured;
} else if (i == 1) {
engineConfiguration->etb2configured = etbConfigured;
}
} }
if (!anyEtbConfigured) { if (!engineConfiguration->etb1configured && !engineConfiguration->etb2configured) {
// It's not valid to have a PPS without any ETBs - check that at least one ETB was enabled along with the pedal // It's not valid to have a PPS without any ETBs - check that at least one ETB was enabled along with the pedal
if (shouldInitThrottles) { if (shouldInitThrottles) {
firmwareError(OBD_PCM_Processor_Fault, "A pedal position sensor was configured, but no electronic throttles are configured."); firmwareError(OBD_PCM_Processor_Fault, "A pedal position sensor was configured, but no electronic throttles are configured.");

View File

@ -767,9 +767,9 @@ bit is_enabled_spi_2
bit useLcdScreen bit useLcdScreen
bit verboseTLE8888 bit verboseTLE8888
bit enableVerboseCanTx;CAN broadcast using custom rusEFI protocol\nenable can_broadcast/disable can_broadcast bit enableVerboseCanTx;CAN broadcast using custom rusEFI protocol\nenable can_broadcast/disable can_broadcast
bit unusedAlteOnOff bit etb1configured
bit isCJ125Enabled;enable cj125/disable cj125 bit isCJ125Enabled;enable cj125/disable cj125
bit unused764b17 bit etb2configured
bit measureMapOnlyInOneCylinder;Useful for individual intakes bit measureMapOnlyInOneCylinder;Useful for individual intakes
bit stepperForceParkingEveryRestart bit stepperForceParkingEveryRestart
bit isFasterEngineSpinUpEnabled;If enabled, try to fire the engine before a full engine cycle has been completed using RPM estimated from the last 90 degrees of engine rotation. As soon as the trigger syncs plus 90 degrees rotation, fuel and ignition events will occur. If disabled, worst case may require up to 4 full crank rotations before any events are scheduled. bit isFasterEngineSpinUpEnabled;If enabled, try to fire the engine before a full engine cycle has been completed using RPM estimated from the last 90 degrees of engine rotation. As soon as the trigger syncs plus 90 degrees rotation, fuel and ignition events will occur. If disabled, worst case may require up to 4 full crank rotations before any events are scheduled.

View File

@ -3885,11 +3885,11 @@ dialog = tcuControls, "Transmission Settings"
dialog = etbAutotune, "PID Autotune" dialog = etbAutotune, "PID Autotune"
field = "First step: calibrate TPS and hit 'Burn'" field = "First step: calibrate TPS and hit 'Burn'"
commandButton = "Auto Calibrate ETB 1", cmb_etb_auto_calibrate commandButton = "Auto Calibrate ETB 1", cmb_etb_auto_calibrate, { etb1configured == 1}
commandButton = "Auto Calibrate ETB 2", cmb_etb_auto_calibrate_2 commandButton = "Auto Calibrate ETB 2", cmb_etb_auto_calibrate_2, { etb2configured == 1}
field = "Second step" field = "Second step"
commandButton = "Start ETB PID Autotune", cmd_etb_autotune commandButton = "Start ETB PID Autotune", cmd_etb_autotune, { etb1configured == 1 || etb2configured == 1 }
commandButton = "Stop ETB PID Autotune", cmd_etb_autotune_stop commandButton = "Stop ETB PID Autotune", cmd_etb_autotune_stop, { etb1configured == 1 || etb2configured == 1 }
field = "!Set debug mode below to 'ETB Autotune' to show more detail" field = "!Set debug mode below to 'ETB Autotune' to show more detail"
field = "Debug mode", debugMode field = "Debug mode", debugMode