[SAFE] Debug cleanups (#1403)

* electronic throttle: inprove debug

* idle thread: show debug info for configured idle driver

* gpio-chips: make private functions static
This commit is contained in:
dron0gus 2020-05-07 03:06:50 +03:00 committed by GitHub
parent 07e6e2c4ad
commit 5987fb8b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 20 deletions

View File

@ -126,12 +126,9 @@ void setDcMotorDuty(size_t index, float duty) {
} }
#if EFI_PROD_CODE #if EFI_PROD_CODE
void showDcMotorInfo(Logging* logger) { void showDcMotorInfo(Logging* logger, int i) {
for (int i = 0 ; i < engine->etbActualCount; i++) { EtbHardware *etb = &etbHardware[i];
EtbHardware *etb = &etbHardware[i];
scheduleMsg(logger, "ETB %d", i); scheduleMsg(logger, " motor: dir=%d DC=%f", etb->dcMotor.isOpenDirection(), etb->dcMotor.get());
scheduleMsg(logger, "Motor: dir=%d DC=%f", etb->dcMotor.isOpenDirection(), etb->dcMotor.get());
}
} }
#endif #endif

View File

@ -20,5 +20,5 @@ void setDcMotorFrequency(size_t index, int hz);
void setDcMotorDuty(size_t index, float duty); void setDcMotorDuty(size_t index, float duty);
#if EFI_PROD_CODE #if EFI_PROD_CODE
void showDcMotorInfo(Logging* logger); void showDcMotorInfo(Logging* logger, int i);
#endif #endif

View File

@ -502,10 +502,15 @@ static void showEthInfo(void) {
hwPortname(CONFIG(etbIo[0].controlPin1)), hwPortname(CONFIG(etbIo[0].controlPin1)),
currentEtbDuty, currentEtbDuty,
engineConfiguration->etbFreq); engineConfiguration->etbFreq);
scheduleMsg(&logger, "dir1=%s", hwPortname(CONFIG(etbIo[0].directionPin1))); int i;
scheduleMsg(&logger, "dir2=%s", hwPortname(CONFIG(etbIo[0].directionPin2))); for (i = 0; i < engine->etbActualCount; i++) {
scheduleMsg(&logger, "ETB%d", i);
showDcMotorInfo(&logger); scheduleMsg(&logger, " dir1=%s", hwPortname(CONFIG(etbIo[i].directionPin1)));
scheduleMsg(&logger, " dir2=%s", hwPortname(CONFIG(etbIo[i].directionPin2)));
scheduleMsg(&logger, " control=%s", hwPortname(CONFIG(etbIo[i].controlPin1)));
scheduleMsg(&logger, " disable=%s", hwPortname(CONFIG(etbIo[i].disablePin)));
showDcMotorInfo(&logger, i);
}
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }

View File

@ -120,12 +120,16 @@ static void showIdleInfo(void) {
getIdlePosition(), boolToString(CONFIG(useStepperIdle))); getIdlePosition(), boolToString(CONFIG(useStepperIdle)));
if (CONFIG(useStepperIdle)) { if (CONFIG(useStepperIdle)) {
scheduleMsg(logger, "directionPin=%s reactionTime=%.2f", hwPortname(CONFIG(idle).stepperDirectionPin), if (CONFIG(useHbridges)) {
engineConfiguration->idleStepperReactionTime); /* TODO */
scheduleMsg(logger, "stepPin=%s steps=%d", hwPortname(CONFIG(idle).stepperStepPin), } else {
engineConfiguration->idleStepperTotalSteps); scheduleMsg(logger, "directionPin=%s reactionTime=%.2f", hwPortname(CONFIG(idle).stepperDirectionPin),
scheduleMsg(logger, "enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin), engineConfiguration->idleStepperReactionTime);
engineConfiguration->stepperEnablePinMode); scheduleMsg(logger, "stepPin=%s steps=%d", hwPortname(CONFIG(idle).stepperStepPin),
engineConfiguration->idleStepperTotalSteps);
scheduleMsg(logger, "enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin),
engineConfiguration->stepperEnablePinMode);
}
} else { } else {
if (!CONFIG(isDoubleSolenoidIdle)) { if (!CONFIG(isDoubleSolenoidIdle)) {
scheduleMsg(logger, "idle valve freq=%d on %s", CONFIG(idle).solenoidFrequency, scheduleMsg(logger, "idle valve freq=%d on %s", CONFIG(idle).solenoidFrequency,

View File

@ -630,7 +630,7 @@ void requestTLE8888initialization(void) {
/* Driver exported functions. */ /* Driver exported functions. */
/*==========================================================================*/ /*==========================================================================*/
int tle8888_writePad(void *data, unsigned int pin, int value) { static int tle8888_writePad(void *data, unsigned int pin, int value) {
if ((pin >= TLE8888_OUTPUTS) || (data == NULL)) if ((pin >= TLE8888_OUTPUTS) || (data == NULL))
return -1; return -1;
@ -736,7 +736,7 @@ void tle8888_read_reg(uint16_t reg, uint16_t *val)
tle8888_spi_rw(chip, CMD_R(reg), val); tle8888_spi_rw(chip, CMD_R(reg), val);
} }
int tle8888_init(void * data) static int tle8888_init(void * data)
{ {
int ret; int ret;
struct tle8888_priv *chip; struct tle8888_priv *chip;
@ -763,7 +763,7 @@ int tle8888_init(void * data)
return 0; return 0;
} }
int tle8888_deinit(void *data) static int tle8888_deinit(void *data)
{ {
(void)data; (void)data;