cj125 diag

This commit is contained in:
rusEfi 2020-04-09 00:12:27 -04:00
parent 32e83062d1
commit 19184033dd
3 changed files with 25 additions and 5 deletions

View File

@ -716,6 +716,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0) if (initBootloader() != 0)
return 123; return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */ #endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20200408; return 20200409;
} }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */

View File

@ -489,6 +489,7 @@ static void cjRestart(void) {
globalInstance.state = CJ125_INIT; globalInstance.state = CJ125_INIT;
globalInstance.errorCode = CJ125_NO_ERROR; globalInstance.errorCode = CJ125_NO_ERROR;
cjInfo(); cjInfo();
cjStart(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */

View File

@ -11,6 +11,8 @@
EXTERN_ENGINE; EXTERN_ENGINE;
#define LOW_VOLTAGE "Low Voltage"
CJ125::CJ125() : wboHeaterControl("wbo"), CJ125::CJ125() : wboHeaterControl("wbo"),
heaterPid(&heaterPidConfig) { heaterPid(&heaterPidConfig) {
} }
@ -48,6 +50,20 @@ void CJ125::StartHeaterControl(pwm_gen_callback *stateChangeCallback DECLARE_ENG
SetIdleHeater(PASS_ENGINE_PARAMETER_SIGNATURE); SetIdleHeater(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
static void printDiagCode(Logging * logging, const char *msg, int code, const char *code1message) {
switch(code & 0x3) {
case 0:
scheduleMsg(logging, "%s Short to GND", msg);
return;
case 1:
scheduleMsg(logging, "%s %s", msg, code1message);
return;
case 2:
scheduleMsg(logging, "%s Short to Vbatt", msg);
return;
}
}
/** /**
* @return true in case of positive SPI identification * @return true in case of positive SPI identification
* false in case of unexpected SPI response * false in case of unexpected SPI response
@ -78,11 +94,14 @@ bool CJ125::cjIdentify(void) {
state = CJ125_ERROR; state = CJ125_ERROR;
return false; return false;
} }
#if 0 if (diag == CJ125_DIAG_NORM) {
if (diag != CJ125_DIAG_NORM) { scheduleMsg(logger, "cj125: Looks great!");
scheduleMsg(logger, "cj125: Diag error!"); } else {
printDiagCode(logger, "VM", diag, LOW_VOLTAGE);
printDiagCode(logger, "UN", diag >> 2, LOW_VOLTAGE);
printDiagCode(logger, "UN", diag >> 4, LOW_VOLTAGE);
printDiagCode(logger, "HR", diag >> 6, "open load");
} }
#endif
return true; return true;
} }