ETB CLI progress

This commit is contained in:
rusEfi 2018-11-26 22:17:16 -05:00
parent 409cfca5e3
commit 73ba5aca89
3 changed files with 21 additions and 10 deletions

View File

@ -213,25 +213,27 @@ static void showEthInfo(void) {
pid.showPidStatus(&logger, "ETB");
}
static void applyPidSettings(void) {
pid.updateFactors(engineConfiguration->etb.pFactor, engineConfiguration->etb.iFactor, 0);
}
void setEtbPFactor(float value) {
engineConfiguration->etb.pFactor = value;
applyPidSettings();
pid.reset();
showEthInfo();
}
void setEtbIFactor(float value) {
engineConfiguration->etb.iFactor = value;
applyPidSettings();
pid.reset();
showEthInfo();
}
void setEtbDFactor(float value) {
engineConfiguration->etb.dFactor = value;
applyPidSettings();
pid.reset();
showEthInfo();
}
void setEtbOffset(int value) {
engineConfiguration->etb.offset = value;
pid.reset();
showEthInfo();
}
@ -341,7 +343,7 @@ void initElectronicThrottle(void) {
addConsoleActionI("set_etbat_period", setAutoPeriod);
addConsoleActionI("set_etbat_offset", setAutoOffset);
applyPidSettings();
pid.reset();
chThdCreateStatic(etbTreadStack, sizeof(etbTreadStack), NORMALPRIO, (tfunc_t) etbThread, NULL);
}

View File

@ -14,6 +14,7 @@ void setDefaultEtbParameters(void);
void setEtbPFactor(float value);
void setEtbIFactor(float value);
void setEtbDFactor(float value);
void setEtbOffset(int value);
bool isETBRestartNeeded(void);
void stopETBPins(void);
void startETBPins(void);

View File

@ -1165,11 +1165,14 @@ command_f_s commandsF[] = {{"mock_iat_voltage", setMockIatVoltage},
{"idle_p", setIdlePFactor},
{"idle_i", setIdleIFactor},
{"idle_d", setIdleDFactor},
#endif /* EFI_IDLE_CONTROL */
#endif /* EFI_PROD_CODE */
#if EFI_ELECTRONIC_THROTTLE_BODY
{"etb_p", setEtbPFactor},
{"etb_i", setEtbIFactor},
{"etb_d", setEtbDFactor},
#endif /* EFI_IDLE_CONTROL */
#endif /* EFI_PROD_CODE */
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
// {"", },
// {"", },
@ -1223,6 +1226,11 @@ command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode},
{"idle_dt", setIdleDT},
#endif /* EFI_IDLE_CONTROL */
#endif /* EFI_PROD_CODE */
#if EFI_ELECTRONIC_THROTTLE_BODY
{"etb_o", setEtbOffset},
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
// {"", },
// {"", },
// {"", },