tle8888 reinit command

This commit is contained in:
rusefi 2019-09-05 10:30:27 -04:00
parent 280271ab1e
commit 12d9bc50b3
4 changed files with 24 additions and 3 deletions

View File

@ -37,11 +37,18 @@
#include "idle_thread.h"
#include "periodic_thread_controller.h"
#include "tps.h"
#if EFI_PROD_CODE
#include "rusefi.h"
#include "mpu_util.h"
#endif /* EFI_PROD_CODE */
#if (BOARD_TLE8888_COUNT > 0)
#include "gpio/tle8888.h"
#endif
EXTERN_ENGINE
;
@ -261,12 +268,19 @@ static void handleCommandX14(uint16_t index) {
case 3:
grabTPSIsWideOpen();
return;
case 4:
// case 4: tps2_closed
// case 5: tps2_wot
case 6:
grabPedalIsUp();
return;
case 5:
case 7:
grabPedalIsWideOpen();
return;
case 8:
#if (BOARD_TLE8888_COUNT > 0)
requestTLE8888initialization();
#endif
return;
}

View File

@ -373,7 +373,7 @@ static THD_FUNCTION(tle8888_driver_thread, p) {
/* set state to TLE8888_FAILED or force reinit? */
}
/* if bit OE is cleared - reset happend */
/* if bit OE is cleared - reset happened */
if (!(chip->OpStat[1] & (1 << 6))) {
needInitialSpi = true;
}
@ -381,6 +381,10 @@ static THD_FUNCTION(tle8888_driver_thread, p) {
}
}
void requestTLE8888initialization(void) {
needInitialSpi = true;
}
/*==========================================================================*/
/* Driver interrupt handlers. */
/*==========================================================================*/

View File

@ -51,6 +51,7 @@ extern "C"
* @return return gpio chip base
*/
int tle8888_add(unsigned int index, const struct tle8888_config *cfg);
void requestTLE8888initialization(void);
#ifdef __cplusplus
}

View File

@ -1302,6 +1302,7 @@ cmd_calibrate_tps_2_closed = "w\x00\x14\x00\x04"
cmd_calibrate_tps_2_wot = "w\x00\x14\x00\x05"
cmd_calibrate_pedal_up = "w\x00\x14\x00\x06"
cmd_calibrate_pedal_down = "w\x00\x14\x00\x07"
cmd_tle8888_init = "w\x00\x14\x00\x08"
cmd_test_radiator_fan = "w\x00\x15\x00\x01"
cmd_test_check_engine_light = "w\x00\x16\x00\x01"
@ -2183,6 +2184,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
field = "TLE8888 Chip Select", tle8888_cs
field = "TLE8888 SPI", tle8888spiDevice
field = "useTLE8888_hall_mode", useTLE8888_hall_mode
commandButton = "Reinit", cmd_tle8888_init
dialog = connection, "", yAxis
field = "STM32 vRef voltage", adcVcc