TLE8888 diag says OK on disconnected pins and bench test #3737

This commit is contained in:
rusefillc 2022-01-03 20:33:35 -05:00
parent dd95b28d6e
commit 914deedb0f
4 changed files with 15 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "rusefi_hw_enums.h"
// was generated automatically by rusEFI tool from rusefi_hw_enums.h // by enum2string.jar tool on Mon Jul 12 21:09:56 EDT 2021
// was generated automatically by rusEFI tool from rusefi_hw_enums.h // by enum2string.jar tool on Mon Jan 03 20:26:28 EST 2022
// see also gen_config_and_enums.bat
@ -50,6 +50,8 @@ case EFI_ADC_NONE:
}
const char *getBrain_pin_diag_e(brain_pin_diag_e value){
switch(value) {
case PIN_DRIVER_OFF:
return "PIN_DRIVER_OFF";
case PIN_DRIVER_OVERTEMP:
return "PIN_DRIVER_OVERTEMP";
case PIN_INVALID:

View File

@ -252,6 +252,7 @@ typedef enum __attribute__ ((__packed__))
PIN_SHORT_TO_BAT = 0x04,
PIN_OVERLOAD = 0x08,
PIN_DRIVER_OVERTEMP = 0x10,
PIN_DRIVER_OFF = 0x20,
PIN_INVALID = 0x80
} brain_pin_diag_e;

View File

@ -40,6 +40,8 @@
#include "gpio/gpio_ext.h"
#include "os_util.h"
static Timer diagResponse;
/*
* TODO list:
*/
@ -889,6 +891,8 @@ static THD_FUNCTION(tle8888_driver_thread, p) {
ret = chip->update_status_and_diag();
if (ret) {
/* set state to TLE8888_FAILED or force reinit? */
} else {
diagResponse.reset();
}
/* TODO:
* Procedure to switch on after failure condition occurred:
@ -989,8 +993,11 @@ int Tle8888::readPad(size_t pin) {
return -1;
}
brain_pin_diag_e Tle8888::getOutputDiag(size_t pin)
{
brain_pin_diag_e Tle8888::getOutputDiag(size_t pin) {
if (diagResponse.hasElapsedMs(500)) {
// has been to long since we've recieved diagnostics
return PIN_DRIVER_OFF;
}
/* OUT1..OUT4, indexes 0..3 */
if (pin < 4)
return tle8888_2b_to_diag_with_temp((OutDiag[0] >> ((pin - 0) * 2)) & 0x03);

View File

@ -117,7 +117,8 @@ void pinDiag2string(char *buffer, size_t size, brain_pin_diag_e pin_diag) {
if (pin_diag == PIN_OK) {
chsnprintf(buffer, size, "Ok");
} else if (pin_diag != PIN_INVALID) {
chsnprintf(buffer, size, "%s%s%s%s%s",
chsnprintf(buffer, size, "%s%s%s%s%s%s",
pin_diag & PIN_DRIVER_OFF ? "driver_off " : "",
pin_diag & PIN_OPEN ? "open_load " : "",
pin_diag & PIN_SHORT_TO_GND ? "short_to_gnd " : "",
pin_diag & PIN_SHORT_TO_BAT ? "short_to_bat " : "",