live docs for idle state
This commit is contained in:
parent
68ffd12993
commit
39630855fb
|
@ -63,8 +63,6 @@ static StepperMotor iacMotor;
|
|||
static uint32_t lastCrankingCyclesCounter = 0;
|
||||
static float lastCrankingIacPosition;
|
||||
|
||||
static idle_state_e idleState = INIT;
|
||||
|
||||
/**
|
||||
* When the IAC position value change is insignificant (lower than this threshold), leave the poor valve alone
|
||||
* todo: why do we have this logic? is this ever useful?
|
||||
|
@ -181,7 +179,7 @@ static percent_t automaticIdleController() {
|
|||
shouldResetPid = true;
|
||||
}
|
||||
|
||||
idleState = TPS_THRESHOLD;
|
||||
engine->engineState.idle.idleState = TPS_THRESHOLD;
|
||||
// just leave IAC position as is (but don't return currentIdlePosition - it may already contain additionalAir)
|
||||
return engine->engineState.idle.baseIdlePosition;
|
||||
}
|
||||
|
@ -192,7 +190,7 @@ static percent_t automaticIdleController() {
|
|||
// check if within the dead zone
|
||||
int rpm = GET_RPM();
|
||||
if (absI(rpm - targetRpm) <= CONFIG(idlePidRpmDeadZone)) {
|
||||
idleState = RPM_DEAD_ZONE;
|
||||
engine->engineState.idle.idleState = RPM_DEAD_ZONE;
|
||||
// current RPM is close enough, no need to change anything
|
||||
return engine->engineState.idle.baseIdlePosition;
|
||||
}
|
||||
|
@ -206,7 +204,7 @@ static percent_t automaticIdleController() {
|
|||
idlePid.setErrorAmplification(errorAmpCoef);
|
||||
|
||||
percent_t newValue = idlePid.getOutput(targetRpm, rpm);
|
||||
idleState = PID_VALUE;
|
||||
engine->engineState.idle.idleState = PID_VALUE;
|
||||
|
||||
// the state of PID has been changed, so we might reset it now, but only when needed (see idlePidDeactivationTpsThreshold)
|
||||
mightResetPid = true;
|
||||
|
@ -228,7 +226,7 @@ static percent_t automaticIdleController() {
|
|||
// Currently it's user-defined. But eventually we'll use a real calculated and stored IAC position instead.
|
||||
int idlePidLowerRpm = targetRpm + CONFIG(idlePidRpmDeadZone);
|
||||
if (CONFIG(idlePidRpmUpperLimit) > 0) {
|
||||
idleState = PID_UPPER;
|
||||
engine->engineState.idle.idleState = PID_UPPER;
|
||||
if (CONFIGB(useIacTableForCoasting) && !cisnan(engine->sensors.clt)) {
|
||||
percent_t iacPosForCoasting = interpolate2d("iacCoasting", engine->sensors.clt, CONFIG(iacCoastingBins), CONFIG(iacCoasting));
|
||||
newValue = interpolateClamped(idlePidLowerRpm, newValue, idlePidLowerRpm + CONFIG(idlePidRpmUpperLimit), iacPosForCoasting, rpm);
|
||||
|
@ -255,7 +253,7 @@ class IdleController : public PeriodicTimerController {
|
|||
|
||||
if (engineConfiguration->isVerboseIAC && engineConfiguration->idleMode == IM_AUTO) {
|
||||
// todo: print each bit using 'getIdle_state_e' method
|
||||
scheduleMsg(logger, "state %d", idleState);
|
||||
scheduleMsg(logger, "state %d", engine->engineState.idle.idleState);
|
||||
idlePid.showPidStatus(logger, "idle");
|
||||
}
|
||||
|
||||
|
@ -313,7 +311,7 @@ class IdleController : public PeriodicTimerController {
|
|||
if (timeToStopBlip != 0) {
|
||||
iacPosition = blipIdlePosition;
|
||||
engine->engineState.idle.baseIdlePosition = iacPosition;
|
||||
idleState = BLIP;
|
||||
engine->engineState.idle.idleState = BLIP;
|
||||
} else if (!isRunning) {
|
||||
// during cranking it's always manual mode, PID would make no sense during cranking
|
||||
iacPosition = cltCorrection * engineConfiguration->crankingIACposition;
|
||||
|
@ -349,7 +347,7 @@ class IdleController : public PeriodicTimerController {
|
|||
#if EFI_TUNER_STUDIO
|
||||
// see also tsOutputChannels->idlePosition
|
||||
idlePid.postState(&tsOutputChannels, 1000000);
|
||||
tsOutputChannels.debugIntField4 = idleState;
|
||||
tsOutputChannels.debugIntField4 = engine->engineState.idle.idleState;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
} else {
|
||||
#if EFI_TUNER_STUDIO
|
||||
|
@ -361,12 +359,12 @@ class IdleController : public PeriodicTimerController {
|
|||
|
||||
// The threshold is dependent on IAC type (see initIdleHardware())
|
||||
if (absF(iacPosition - engine->engineState.idle.currentIdlePosition) < idlePositionSensitivityThreshold) {
|
||||
idleState = (idle_state_e)(idleState | PWM_PRETTY_CLOSE);
|
||||
engine->engineState.idle.idleState = (idle_state_e)(engine->engineState.idle.idleState | PWM_PRETTY_CLOSE);
|
||||
return; // value is pretty close, let's leave the poor valve alone
|
||||
}
|
||||
|
||||
engine->engineState.idle.currentIdlePosition = iacPosition;
|
||||
idleState = (idle_state_e)(idleState | ADJUSTING);
|
||||
engine->engineState.idle.idleState = (idle_state_e)(engine->engineState.idle.idleState | ADJUSTING);
|
||||
applyIACposition(engine->engineState.idle.currentIdlePosition);
|
||||
}
|
||||
};
|
||||
|
@ -475,8 +473,17 @@ void startIdleThread(Logging*sharedLogger) {
|
|||
// todo: re-initialize idle pins on the fly
|
||||
initIdleHardware();
|
||||
|
||||
engine->engineState.idle.currentIdlePosition = -100.0f;
|
||||
engine->engineState.idle.baseIdlePosition = -100.0f;
|
||||
DISPLAY_TEXT(Idle_State);
|
||||
engine->engineState.idle.DISPLAY_FIELD(idleState) = INIT;
|
||||
DISPLAY_TEXT(EOL);
|
||||
DISPLAY_TEXT(Base_Position);
|
||||
engine->engineState.idle.DISPLAY_FIELD(baseIdlePosition) = -100.0f;
|
||||
DISPLAY_TEXT(Position_with_Adjustments);
|
||||
engine->engineState.idle.DISPLAY_FIELD(currentIdlePosition) = -100.0f;
|
||||
DISPLAY_TEXT(EOL);
|
||||
DISPLAY_TEXT(Throttle_Up_State);
|
||||
DISPLAY(DISPLAY_FIELD(throttleUpState));
|
||||
DISPLAY(DISPLAY_CONFIG(throttlePedalUpPin));
|
||||
|
||||
|
||||
//scheduleMsg(logger, "initial idle %d", idlePositionController.value);
|
||||
|
|
|
@ -847,6 +847,8 @@ case IM_MANUAL:
|
|||
}
|
||||
const char *getIdle_state_e(idle_state_e value){
|
||||
switch(value) {
|
||||
case Force_4bytes_size_idle_state_e:
|
||||
return "Force_4bytes_size_idle_state_e";
|
||||
case ADJUSTING:
|
||||
return "ADJUSTING";
|
||||
case BLIP:
|
||||
|
|
|
@ -835,7 +835,10 @@ typedef enum {
|
|||
PID_UPPER = 16,
|
||||
ADJUSTING = 32,
|
||||
BLIP = 64,
|
||||
|
||||
/**
|
||||
* Live Docs reads 4 byte value so we want 4 byte enum
|
||||
*/
|
||||
Force_4bytes_size_idle_state_e = ENUM_32_BITS,
|
||||
} idle_state_e;
|
||||
|
||||
#endif /* RUSEFI_ENUMS_H_ */
|
||||
|
|
|
@ -812,6 +812,6 @@ int getRusEfiVersion(void) {
|
|||
if (initBootloader() != 0)
|
||||
return 123;
|
||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||
return 20190720;
|
||||
return 20190721;
|
||||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
|
|
@ -29,6 +29,7 @@ java -DSystemOut.name=gen_config2 ^
|
|||
-java_destination ../java_console/models/src/com/rusefi/config/generated/TriggerState.java ^
|
||||
-c_destination controllers/generated/trigger_structs.h
|
||||
|
||||
%LIVE_DOCS_COMMAND% controllers/actuators/idle_thread.cpp
|
||||
%LIVE_DOCS_COMMAND% controllers/trigger/trigger_decoder.cpp
|
||||
%LIVE_DOCS_COMMAND% controllers/sensors/thermistors.cpp
|
||||
%LIVE_DOCS_COMMAND% controllers/sensors/tps.cpp
|
||||
|
|
|
@ -46,7 +46,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20190720;
|
||||
public static final int CONSOLE_VERSION = 20190721;
|
||||
public static final String INPUT_FILES_PATH = "..";
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.rusefi.ldmp.generated;
|
||||
|
||||
import com.rusefi.ldmp.*;
|
||||
|
||||
public class IdleThreadMeta {
|
||||
public static final Request[] CONTENT = new Request[]{
|
||||
new TextRequest("Idle_State"),
|
||||
new FieldRequest("idleState"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Base_Position"),
|
||||
new FieldRequest("baseIdlePosition"),
|
||||
new TextRequest("Position_with_Adjustments"),
|
||||
new FieldRequest("currentIdlePosition"),
|
||||
new TextRequest("EOL"),
|
||||
new TextRequest("Throttle_Up_State"),
|
||||
new FieldRequest("throttleUpState"),
|
||||
new ConfigRequest("throttlePedalUpPin"),
|
||||
};
|
||||
}
|
|
@ -10,10 +10,7 @@ import com.rusefi.config.generated.TriggerState;
|
|||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.ldmp.*;
|
||||
import com.rusefi.ldmp.generated.SpeedDensityMeta;
|
||||
import com.rusefi.ldmp.generated.ThermistorsMeta;
|
||||
import com.rusefi.ldmp.generated.TpsMeta;
|
||||
import com.rusefi.ldmp.generated.TriggerDecoderMeta;
|
||||
import com.rusefi.ldmp.generated.*;
|
||||
import com.rusefi.ui.livedocs.controls.Toolbox;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
@ -186,6 +183,9 @@ public class LiveDocPanel {
|
|||
liveDocs.add(createPanel("Trigger", "", Fields.LDS_TRIGGER_INDEX,
|
||||
TriggerState.VALUES, TriggerDecoderMeta.CONTENT), CONSTRAINTS);
|
||||
|
||||
liveDocs.add(createPanel("Idle", "", Fields.LDS_ENGINE_STATE_INDEX,
|
||||
EngineState.VALUES, IdleThreadMeta.CONTENT), CONSTRAINTS);
|
||||
|
||||
return liveDocs;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue