Reinitialize TLE8888 if it resets #904

nasty "solution"
This commit is contained in:
rusefi 2019-09-06 20:30:27 -04:00
parent ea05118bb6
commit e77b703beb
10 changed files with 41 additions and 18 deletions

View File

@ -31,6 +31,10 @@
#define isRunningBenchTest() true
#endif /* EFI_PROD_CODE */
#if (BOARD_TLE8888_COUNT > 0)
#include "gpio/tle8888.h"
#endif
static TriggerState initState CCM_OPTIONAL;
LoggingWithStorage engineLogger("engine");
@ -113,6 +117,8 @@ static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif
}
static efitick_t tle8888CrankingResetTime = 0;
void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
watchdog();
updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -124,6 +130,18 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
cylinderCleanupControl(PASS_ENGINE_PARAMETER_SIGNATURE);
#if (BOARD_TLE8888_COUNT > 0)
if (CONFIG(useTLE8888_cranking_hack) && ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
efitick_t nowNt = getTimeNowNt();
if (nowNt - tle8888CrankingResetTime > US2NT(MS2US(300))) {
requestTLE8888initialization();
// let's reset TLE8888 every 300ms while cranking since that's the best we can do to deal with undervoltage reset
// PS: oh yes, it's a horrible design! Please suggest something better!
tle8888CrankingResetTime = nowNt;
}
}
#endif
slowCallBackWasInvoked = TRUE;
}

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Wed Sep 04 00:19:03 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Sep 06 19:09:15 EDT 2019
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -1092,7 +1092,7 @@ struct engine_configuration_s {
bool useTLE8888_hall_mode : 1;
/**
offset 76 bit 17 */
bool issue_294_17 : 1;
bool useTLE8888_cranking_hack : 1;
/**
offset 76 bit 18 */
bool issue_294_18 : 1;
@ -2821,4 +2821,4 @@ typedef struct persistent_config_s persistent_config_s;
#endif
// end
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Wed Sep 04 00:19:03 EDT 2019
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Sep 06 19:09:15 EDT 2019

View File

@ -1262,8 +1262,6 @@
#define isMapAveragingEnabled_offset_hex 5c4
#define isSdCardEnabled_offset 744
#define isSdCardEnabled_offset_hex 2e8
#define issue_294_17_offset 76
#define issue_294_17_offset_hex 4c
#define issue_294_18_offset 76
#define issue_294_18_offset_hex 4c
#define issue_294_19_offset 76
@ -1947,6 +1945,8 @@
#define useSerialPort_offset_hex 2e8
#define useStepperIdle_offset 744
#define useStepperIdle_offset_hex 2e8
#define useTLE8888_cranking_hack_offset 76
#define useTLE8888_cranking_hack_offset_hex 4c
#define useTLE8888_hall_mode_offset 76
#define useTLE8888_hall_mode_offset_hex 4c
#define useTpicAdvancedMode_offset 744

View File

@ -299,7 +299,7 @@ bit etb2_use_two_wires;
bit showSdCardWarning;
bit cj125isUrDivided;looks like 3v range should be enough, divider not needed
bit useTLE8888_hall_mode;
bit issue_294_17;
bit useTLE8888_cranking_hack;
bit issue_294_18;
bit issue_294_19;
bit issue_294_21;

View File

@ -82,7 +82,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Thu Sep 05 10:29:45 EDT 2019
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Sep 06 19:09:15 EDT 2019
pageSize = 20000
page = 1
@ -108,7 +108,7 @@ page = 1
showSdCardWarning = bits, U32, 76, [14:14], "false", "true"
cj125isUrDivided = bits, U32, 76, [15:15], "false", "true"
useTLE8888_hall_mode = bits, U32, 76, [16:16], "false", "true"
issue_294_17 = bits, U32, 76, [17:17], "false", "true"
useTLE8888_cranking_hack= bits, U32, 76, [17:17], "false", "true"
issue_294_18 = bits, U32, 76, [18:18], "false", "true"
issue_294_19 = bits, U32, 76, [19:19], "false", "true"
issue_294_21 = bits, U32, 76, [20:20], "false", "true"
@ -3164,6 +3164,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
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
commandButton = "Reinit", cmd_tle8888_init
dialog = connection, "", yAxis

View File

@ -2184,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
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
commandButton = "Reinit", cmd_tle8888_init
dialog = connection, "", yAxis

View File

@ -82,7 +82,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Thu Sep 05 10:29:50 EDT 2019
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Sep 06 19:09:21 EDT 2019
pageSize = 20000
page = 1
@ -108,7 +108,7 @@ page = 1
showSdCardWarning = bits, U32, 76, [14:14], "false", "true"
cj125isUrDivided = bits, U32, 76, [15:15], "false", "true"
useTLE8888_hall_mode = bits, U32, 76, [16:16], "false", "true"
issue_294_17 = bits, U32, 76, [17:17], "false", "true"
useTLE8888_cranking_hack= bits, U32, 76, [17:17], "false", "true"
issue_294_18 = bits, U32, 76, [18:18], "false", "true"
issue_294_19 = bits, U32, 76, [19:19], "false", "true"
issue_294_21 = bits, U32, 76, [20:20], "false", "true"
@ -3164,6 +3164,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
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
commandButton = "Reinit", cmd_tle8888_init
dialog = connection, "", yAxis

View File

@ -82,7 +82,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Thu Sep 05 10:29:47 EDT 2019
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Sep 06 19:09:18 EDT 2019
pageSize = 20000
page = 1
@ -108,7 +108,7 @@ page = 1
showSdCardWarning = bits, U32, 76, [14:14], "false", "true"
cj125isUrDivided = bits, U32, 76, [15:15], "false", "true"
useTLE8888_hall_mode = bits, U32, 76, [16:16], "false", "true"
issue_294_17 = bits, U32, 76, [17:17], "false", "true"
useTLE8888_cranking_hack= bits, U32, 76, [17:17], "false", "true"
issue_294_18 = bits, U32, 76, [18:18], "false", "true"
issue_294_19 = bits, U32, 76, [19:19], "false", "true"
issue_294_21 = bits, U32, 76, [20:20], "false", "true"
@ -3149,6 +3149,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
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
commandButton = "Reinit", cmd_tle8888_init
dialog = connection, "", yAxis

View File

@ -82,7 +82,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Thu Sep 05 10:29:52 EDT 2019
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Sep 06 19:09:23 EDT 2019
pageSize = 20000
page = 1
@ -108,7 +108,7 @@ page = 1
showSdCardWarning = bits, U32, 76, [14:14], "false", "true"
cj125isUrDivided = bits, U32, 76, [15:15], "false", "true"
useTLE8888_hall_mode = bits, U32, 76, [16:16], "false", "true"
issue_294_17 = bits, U32, 76, [17:17], "false", "true"
useTLE8888_cranking_hack= bits, U32, 76, [17:17], "false", "true"
issue_294_18 = bits, U32, 76, [18:18], "false", "true"
issue_294_19 = bits, U32, 76, [19:19], "false", "true"
issue_294_21 = bits, U32, 76, [20:20], "false", "true"
@ -3160,6 +3160,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
field = "useTLE8888 cranking reset hack", useTLE8888_cranking_hack
commandButton = "Reinit", cmd_tle8888_init
dialog = connection, "", yAxis

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Wed Sep 04 00:19:03 EDT 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Sep 06 19:09:15 EDT 2019
// by class com.rusefi.output.JavaFieldsConsumer
import com.rusefi.config.*;
@ -838,7 +838,6 @@ public class Fields {
public static final int isManualSpinningMode_offset = 1476;
public static final int isMapAveragingEnabled_offset = 1476;
public static final int isSdCardEnabled_offset = 744;
public static final int issue_294_17_offset = 76;
public static final int issue_294_18_offset = 76;
public static final int issue_294_19_offset = 76;
public static final int issue_294_21_offset = 76;
@ -1256,6 +1255,7 @@ public class Fields {
public static final int useSeparateVeForIdle_offset = 1476;
public static final int useSerialPort_offset = 744;
public static final int useStepperIdle_offset = 744;
public static final int useTLE8888_cranking_hack_offset = 76;
public static final int useTLE8888_hall_mode_offset = 76;
public static final int useTpicAdvancedMode_offset = 744;
public static final int useTPSAdvanceTable_offset = 1476;
@ -1306,7 +1306,7 @@ public class Fields {
public static final Field SHOWSDCARDWARNING = Field.create("SHOWSDCARDWARNING", 76, FieldType.BIT, 14);
public static final Field CJ125ISURDIVIDED = Field.create("CJ125ISURDIVIDED", 76, FieldType.BIT, 15);
public static final Field USETLE8888_HALL_MODE = Field.create("USETLE8888_HALL_MODE", 76, FieldType.BIT, 16);
public static final Field ISSUE_294_17 = Field.create("ISSUE_294_17", 76, FieldType.BIT, 17);
public static final Field USETLE8888_CRANKING_HACK = Field.create("USETLE8888_CRANKING_HACK", 76, FieldType.BIT, 17);
public static final Field ISSUE_294_18 = Field.create("ISSUE_294_18", 76, FieldType.BIT, 18);
public static final Field ISSUE_294_19 = Field.create("ISSUE_294_19", 76, FieldType.BIT, 19);
public static final Field ISSUE_294_21 = Field.create("ISSUE_294_21", 76, FieldType.BIT, 20);
@ -2090,7 +2090,7 @@ public class Fields {
SHOWSDCARDWARNING,
CJ125ISURDIVIDED,
USETLE8888_HALL_MODE,
ISSUE_294_17,
USETLE8888_CRANKING_HACK,
ISSUE_294_18,
ISSUE_294_19,
ISSUE_294_21,