CJ125 PI commands

This commit is contained in:
rusefi 2020-05-01 20:22:49 -04:00
parent 87925f3adb
commit d371af5b89
4 changed files with 15 additions and 11 deletions

View File

@ -300,7 +300,7 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
#endif /* EFI_IDLE_CONTROL */ #endif /* EFI_IDLE_CONTROL */
} else if (subsystem == 0x18) { } else if (subsystem == 0x18) {
#if EFI_CJ125 && HAL_USE_SPI #if EFI_CJ125 && HAL_USE_SPI
cjCalibrate(); cjStartCalibration();
#endif /* EFI_CJ125 */ #endif /* EFI_CJ125 */
} else if (subsystem == 0x20 && index == 0x3456) { } else if (subsystem == 0x20 && index == 0x3456) {
// call to pit // call to pit

View File

@ -219,7 +219,7 @@ static void cjPrintErrorCode(cj125_error_e errCode) {
} }
static void cjPrintState() { static void cjPrintState() {
scheduleMsg(logger, "cj125: state=%s diag=0x%x (vUa=%.3f vUr=%.3f) (vUaCal=%.3f vUrCal=%.3f)", scheduleMsg(logger, "cj125: state=%s diag=0x%x (current Ua=%.3f Ur=%.3f) (calibration Ua=%.3f Ur=%.3f)",
getCjState(globalInstance.state), globalInstance.diag, getCjState(globalInstance.state), globalInstance.diag,
globalInstance.vUa, globalInstance.vUr, globalInstance.vUa, globalInstance.vUr,
globalInstance.vUaCal, globalInstance.vUrCal); globalInstance.vUaCal, globalInstance.vUrCal);
@ -236,6 +236,14 @@ static void cjPrintState() {
globalInstance.heaterPidConfig.dFactor); globalInstance.heaterPidConfig.dFactor);
} }
static void cjSetP(float value) {
globalInstance.heaterPidConfig.pFactor = value;
}
static void cjSetI(float value) {
globalInstance.heaterPidConfig.iFactor = value;
}
static void cjInfo() { static void cjInfo() {
cjPrintState(); cjPrintState();
#if HAL_USE_SPI #if HAL_USE_SPI
@ -278,12 +286,6 @@ static void cjUpdateAnalogValues() {
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
#if ! EFI_UNIT_TEST
void cjCalibrate(void) {
globalInstance.calibrate(PASS_ENGINE_PARAMETER_SIGNATURE);
}
#endif /* EFI_UNIT_TEST */
void CJ125::calibrate(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void CJ125::calibrate(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
cjIdentify(PASS_ENGINE_PARAMETER_SIGNATURE); cjIdentify(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -532,7 +534,7 @@ static bool cjCheckConfig(void) {
return true; return true;
} }
static void cjStartCalibration(void) { void cjStartCalibration(void) {
if (!cjCheckConfig()) if (!cjCheckConfig())
return; return;
if (globalInstance.isWorkingState()) { if (globalInstance.isWorkingState()) {
@ -642,6 +644,8 @@ void initCJ125(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
addConsoleAction("cj125_info", cjInfo); addConsoleAction("cj125_info", cjInfo);
addConsoleActionF("cj125_set_p", cjSetP);
addConsoleActionF("cj125_set_i", cjSetI);
addConsoleAction("cj125_restart", cjRestart); addConsoleAction("cj125_restart", cjRestart);
addConsoleAction("cj125_calibrate", cjStartCalibration); addConsoleAction("cj125_calibrate", cjStartCalibration);

View File

@ -105,7 +105,7 @@ void cjPostState(TunerStudioOutputChannels *tsOutputChannels);
void initCJ125(Logging *shared DECLARE_ENGINE_PARAMETER_SUFFIX); void initCJ125(Logging *shared DECLARE_ENGINE_PARAMETER_SUFFIX);
void cjRestart(void); void cjRestart(void);
void cjCalibrate(void); void cjStartCalibration(void);
float cjGetAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE); float cjGetAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE);
bool cjHasAfrSensor(DECLARE_CONFIG_PARAMETER_SIGNATURE); bool cjHasAfrSensor(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void cj125defaultPinout(DECLARE_CONFIG_PARAMETER_SIGNATURE); void cj125defaultPinout(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -1504,7 +1504,7 @@ cmd_test_starter_relay = "w\x00\x14\x00\x0B"
cmd_etb_autotune = "w\x00\x14\x00\x0C" cmd_etb_autotune = "w\x00\x14\x00\x0C"
cmd_enable_self_stim = "w\x00\x14\x00\x0D" cmd_enable_self_stim = "w\x00\x14\x00\x0D"
cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E" cmb_etb_auto_calibrate = "w\x00\x14\x00\x0E"
cmd_disable_self_stim = "w\x00\x14\x00\x0F" cmd_disable_self_stim = "w\x00\x14\x00\x0F"
cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_radiator_fan = "w\x00\x15\x00\x01"
cmd_test_check_engine_light = "w\x00\x16\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01"