critical error usability improvements

This commit is contained in:
rusefi 2020-03-28 21:28:32 -04:00
parent d1b5a51400
commit 5c2794c2e0
27 changed files with 107 additions and 87 deletions

View File

@ -807,9 +807,9 @@ void chDbgPanic3(const char *msg, const char * file, int line);
* so that it would not crash the error handler in case of stack issues
*/
#if CH_DBG_SYSTEM_STATE_CHECK
#define hasFatalError() (ch.dbg.panic_msg != NULL)
#define hasOsPanicError() (ch.dbg.panic_msg != NULL)
#else
#define hasFatalError() (FALSE)
#define hasOsPanicError() (FALSE)
#endif

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Mar 28 19:52:44 EDT 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Mar 28 21:08:55 EDT 2020
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONFIG_BOARDS_KINETIS_CONFIG_CONTROLLERS_ALGO_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -2947,8 +2947,8 @@ struct engine_configuration_s {
/**
* offset 4140
*/
int mainUnusedEnd[475];
/** total size 6040*/
int mainUnusedEnd[465];
/** total size 6000*/
};
typedef struct engine_configuration_s engine_configuration_s;
@ -2960,7 +2960,7 @@ struct persistent_config_s {
*/
engine_configuration_s engineConfiguration;
/**
* offset 6040
* offset 6000
*/
critical_error_message_t critical_error_message;
/**
@ -3250,4 +3250,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 Sat Mar 28 19:52:44 EDT 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Mar 28 21:08:55 EDT 2020

View File

@ -485,8 +485,9 @@
#define crankingTpsBins_offset_hex 688
#define crankingTpsCoef_offset 1640
#define crankingTpsCoef_offset_hex 668
#define critical_error_message_offset 6040
#define critical_error_message_offset_hex 1798
#define critical_error_message_offset 6000
#define critical_error_message_offset_hex 1770
#define CRITICAL_PREFIX "CRITICAL"
#define cutFuelOnHardLimit_offset 1464
#define cutFuelOnHardLimit_offset_hex 5b8
#define cutSparkOnHardLimit_offset 1464
@ -564,7 +565,7 @@
#define engineSnifferRpmThreshold_offset_hex 4
#define engineType_offset 0
#define engineType_offset_hex 0
#define ERROR_BUFFER_SIZE 80
#define ERROR_BUFFER_SIZE 120
#define ETB_BIAS_CURVE_LENGTH 8
#define ETB_COUNT 2
#define etb_dFactor_offset 1744

View File

@ -762,9 +762,9 @@ void chDbgPanic3(const char *msg, const char * file, int line);
* so that it would not crash the error handler in case of stack issues
*/
#if CH_DBG_SYSTEM_STATE_CHECK
#define hasFatalError() (ch.dbg.panic_msg != NULL)
#define hasOsPanicError() (ch.dbg.panic_msg != NULL)
#else
#define hasFatalError() (FALSE)
#define hasOsPanicError() (FALSE)
#endif

View File

@ -764,9 +764,9 @@ void chDbgPanic3(const char *msg, const char * file, int line);
* so that it would not crash the error handler in case of stack issues
*/
#if CH_DBG_SYSTEM_STATE_CHECK
#define hasFatalError() (ch.dbg.panic_msg != NULL)
#define hasOsPanicError() (ch.dbg.panic_msg != NULL)
#else
#define hasFatalError() (FALSE)
#define hasOsPanicError() (FALSE)
#endif

View File

@ -57,7 +57,7 @@ typedef struct {
unsigned int isIatError : 1; // bit 21
unsigned int isAcSwitchEngaged : 1; // bit 22
unsigned int isTriggerError : 1; // bit 23
unsigned int hasFatalError : 1; // bit 24
unsigned int hasCriticalError : 1; // bit 24
unsigned int isWarnNow : 1; // bit 25
unsigned int isPedalError : 1; // bit 26
unsigned int isKnockChipOk : 1; // bit 27

View File

@ -29,7 +29,7 @@
static LoggingWithStorage logger("console");
static void myfatal(void) {
static void testCritical(void) {
chDbgCheck(0);
}
@ -183,7 +183,7 @@ void initializeConsole(Logging *sharedLogger) {
addConsoleAction("reset", scheduleReset);
#endif
addConsoleAction("fatal", myfatal);
addConsoleAction("critical", testCritical);
addConsoleAction("error", myerror);
addConsoleAction("threadsinfo", cmd_threads);
}

View File

@ -494,7 +494,7 @@ void updateDevConsoleState(void) {
#if EFI_PROD_CODE
// todo: unify with simulator!
if (hasFirmwareError()) {
scheduleMsg(&logger, "FATAL error: %s", getFirmwareError());
scheduleMsg(&logger, "%s error: %s", CRITICAL_PREFIX, getFirmwareError());
warningEnabled = false;
scheduleLogging(&logger);
return;
@ -613,8 +613,8 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
}
void setAllLeds(int value) {
// make sure we do not turn the fatal LED off if already have
// fatal error by now
// make sure we do not turn the critical LED off if already have
// critical error by now
for (uint32_t i = 0; !hasFirmwareError() && i < sizeof(leds) / sizeof(leds[0]); i++) {
leds[i]->setValue(value);
}
@ -633,9 +633,9 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
enginePins.warningLedPin.setValue(0);
} else {
if (hasFirmwareError()) {
// special behavior in case of fatal error - not equal on/off time
// special behavior in case of critical error - not equal on/off time
// this special behaviour helps to notice that something is not right, also
// differentiates software firmware error from fatal interrupt error with CPU halt.
// differentiates software firmware error from critical interrupt error with CPU halt.
offTimeMs = 50;
onTimeMs = 450;
} else {
@ -825,7 +825,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->knockCount = engine->knockCount;
tsOutputChannels->knockLevel = engine->knockVolts;
tsOutputChannels->hasFatalError = hasFirmwareError();
tsOutputChannels->hasCriticalError = hasFirmwareError();
tsOutputChannels->isWarnNow = engine->engineState.warnings.isWarningNow(timeSeconds, true);
#if EFI_HIP_9011

View File

@ -31,7 +31,7 @@ EXTERN_ENGINE;
extern int warningEnabled;
extern bool main_loop_started;
static fatal_msg_t criticalErrorMessageBuffer;
static critical_msg_t criticalErrorMessageBuffer;
bool hasFirmwareErrorFlag = false;
const char *dbg_panic_file;
@ -53,7 +53,7 @@ extern ioportmask_t errorLedPin;
/**
* low-level function is used here to reduce stack usage
*/
#define ON_FATAL_ERROR() \
#define ON_CRITICAL_ERROR() \
palWritePad(errorLedPort, errorLedPin, 1); \
turnAllPinsOff(); \
enginePins.communicationLedPin.setValue(1);
@ -62,7 +62,7 @@ extern ioportmask_t errorLedPin;
#if EFI_SIMULATOR || EFI_PROD_CODE
void chDbgPanic3(const char *msg, const char * file, int line) {
if (hasFatalError())
if (hasOsPanicError())
return;
dbg_panic_file = file;
dbg_panic_line = line;
@ -71,7 +71,7 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
#endif /* CH_DBG_SYSTEM_STATE_CHECK */
#if EFI_PROD_CODE
ON_FATAL_ERROR();
ON_CRITICAL_ERROR();
#else
printf("chDbgPanic3 %s %s%d", msg, file, line);
exit(-1);
@ -82,7 +82,7 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
#endif /* EFI_HD44780_LCD */
if (!main_loop_started) {
print("fatal %s %s:%d\r\n", msg, file, line);
print("%s %s %s:%d\r\n", CRITICAL_PREFIX, msg, file, line);
// chThdSleepSeconds(1);
chSysHalt("Main loop did not start");
}
@ -161,7 +161,7 @@ bool warning(obd_code_e code, const char *fmt, ...) {
return false;
}
char *getWarning(void) {
char *getWarningMessage(void) {
return warningBuffer;
}
@ -224,7 +224,7 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
printWarning(fmt, ap);
va_end(ap);
#endif
ON_FATAL_ERROR()
ON_CRITICAL_ERROR()
;
hasFirmwareErrorFlag = true;
if (indexOf(fmt, '%') == -1) {

View File

@ -23,7 +23,7 @@ extern "C"
*/
bool warning(obd_code_e code, const char *fmt, ...);
typedef uint8_t fatal_msg_t[200];
typedef uint8_t critical_msg_t[ERROR_BUFFER_SIZE];
/**
* Something really bad had happened - firmware cannot function, we cannot run the engine
*
@ -38,7 +38,7 @@ char *getFirmwareError(void);
void initErrorHandlingDataStructures(void);
// todo: rename to getWarningMessage?
char *getWarning(void);
char *getWarningMessage(void);
// todo: better place for this shared declaration?
int getRusEfiVersion(void);

View File

@ -297,7 +297,7 @@ void updateHD44780lcd(void) {
}
const char * message = hasFirmwareErrorFlag ? getFirmwareError() : getWarning();
const char * message = hasFirmwareErrorFlag ? getFirmwareError() : getWarningMessage();
memcpy(buffer, message, engineConfiguration->HD44780width);
buffer[engineConfiguration->HD44780width] = 0;
lcd_HD44780_set_position(engineConfiguration->HD44780height - 1, 0);
@ -334,7 +334,7 @@ void updateHD44780lcd(void) {
//
// lcd_HD44780_set_position(1, 0);
// memset(buffer, ' ', LCD_WIDTH);
// memcpy(buffer, getWarning(), LCD_WIDTH);
// memcpy(buffer, getWarningMessage(), LCD_WIDTH);
// buffer[LCD_WIDTH] = 0;
// lcd_HD44780_print_string(buffer);
//

View File

@ -1,4 +1,4 @@
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 19:52:31 EDT 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:37 EDT 2020
// by class com.rusefi.output.CHeaderConsumer
// begin
#ifndef CONTROLLERS_GENERATED_ENGINE_CONFIGURATION_GENERATED_STRUCTURES_H
@ -2947,8 +2947,8 @@ struct engine_configuration_s {
/**
* offset 4140
*/
int mainUnusedEnd[475];
/** total size 6040*/
int mainUnusedEnd[465];
/** total size 6000*/
};
typedef struct engine_configuration_s engine_configuration_s;
@ -2960,7 +2960,7 @@ struct persistent_config_s {
*/
engine_configuration_s engineConfiguration;
/**
* offset 6040
* offset 6000
*/
critical_error_message_t critical_error_message;
/**
@ -3250,4 +3250,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 Sat Mar 28 19:52:31 EDT 2020
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:37 EDT 2020

View File

@ -485,8 +485,9 @@
#define crankingTpsBins_offset_hex 688
#define crankingTpsCoef_offset 1640
#define crankingTpsCoef_offset_hex 668
#define critical_error_message_offset 6040
#define critical_error_message_offset_hex 1798
#define critical_error_message_offset 6000
#define critical_error_message_offset_hex 1770
#define CRITICAL_PREFIX "CRITICAL"
#define cutFuelOnHardLimit_offset 1464
#define cutFuelOnHardLimit_offset_hex 5b8
#define cutSparkOnHardLimit_offset 1464
@ -564,7 +565,7 @@
#define engineSnifferRpmThreshold_offset_hex 4
#define engineType_offset 0
#define engineType_offset_hex 0
#define ERROR_BUFFER_SIZE 80
#define ERROR_BUFFER_SIZE 120
#define ETB_BIAS_CURVE_LENGTH 8
#define ETB_COUNT 2
#define etb_dFactor_offset 1744

View File

@ -58,7 +58,6 @@ struct persistent_config_s
struct_no_prefix engine_configuration_s
! todo there is still a spot where this 200 is hard-coded
#define LE_COMMAND_LENGTH 200
! see 'blockingFactor' in rusefi.ini
@ -738,12 +737,12 @@ custom maf_sensor_type_e 4 bits, S32, @OFFSET@, [0:7], @@maf_sensor_type_e_enum@
maf_sensor_type_e mafSensorType;
#define CRITICAL_PREFIX "CRITICAL"
! same length used for critical and soft error messages
#define ERROR_BUFFER_SIZE 80
#define ERROR_BUFFER_SIZE 120
! todo: improve code generator so that we could use reuse 'ERROR_BUFFER_SIZE' for type size
custom critical_error_message_t 80 string, ASCII, @OFFSET@, @@ERROR_BUFFER_SIZE@@
custom le_formula_t 200 string, ASCII, @OFFSET@, 200
custom critical_error_message_t @@ERROR_BUFFER_SIZE@@ string, ASCII, @OFFSET@, @@ERROR_BUFFER_SIZE@@
custom le_formula_t @@LE_COMMAND_LENGTH@@ string, ASCII, @OFFSET@, @@LE_COMMAND_LENGTH@@
brain_pin_e[FSIO_COMMAND_COUNT iterate] fsioDigitalInputs;todo:not finished\nThese input pins allow us to pull toggle buttons state;
brain_input_pin_e vehicleSpeedSensorInputPin;
@ -1197,7 +1196,7 @@ uint8_t[4] unusuedsw;
uint8_t[IAC_PID_MULT_SIZE] iacPidMultLoadBins;;"Load", 1, 0.0, 0, 500.0, 2
uint8_t[IAC_PID_MULT_SIZE] iacPidMultRpmBins;;"RPM", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0.0, 12000.0, 0
int[475] mainUnusedEnd;
int[465] mainUnusedEnd;
! end of engine_configuration_s
end_struct

View File

@ -85,7 +85,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 Sat Mar 28 20:11:35 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:37 EDT 2020
pageSize = 20000
page = 1
@ -1011,7 +1011,7 @@ page = 1
iacPidMultLoadBins = array, U08, 4124, [8], "Load", 1, 0.0, 0, 500.0, 2
iacPidMultRpmBins = array, U08, 4132, [8], "RPM", 50, 0, 0.0, 12000.0, 0
;no TS info - skipping mainUnusedEnd offset 4140
critical_error_message = string, ASCII, 6040, 80
critical_error_message = string, ASCII, 6000, 120
afterstartCoolantBins = array, F32, 6120, [8], "C", 1, 0, -100.0, 250.0, 0
afterstartHoldTime = array, F32, 6152, [8], "Seconds", 1, 0, 0, 100, 1
afterstartEnrich = array, F32, 6184, [8], "%", 1, 0, 0, 600, 1

View File

@ -85,7 +85,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 Sat Mar 28 20:11:41 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:44 EDT 2020
pageSize = 20000
page = 1
@ -1011,7 +1011,7 @@ page = 1
iacPidMultLoadBins = array, U08, 4124, [8], "Load", 1, 0.0, 0, 500.0, 2
iacPidMultRpmBins = array, U08, 4132, [8], "RPM", 50, 0, 0.0, 12000.0, 0
;no TS info - skipping mainUnusedEnd offset 4140
critical_error_message = string, ASCII, 6040, 80
critical_error_message = string, ASCII, 6000, 120
afterstartCoolantBins = array, F32, 6120, [8], "C", 1, 0, -100.0, 250.0, 0
afterstartHoldTime = array, F32, 6152, [8], "Seconds", 1, 0, 0, 100, 1
afterstartEnrich = array, F32, 6184, [8], "%", 1, 0, 0, 600, 1

View File

@ -85,7 +85,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 Sat Mar 28 19:52:44 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/rusefi_config.txt Sat Mar 28 21:08:55 EDT 2020
pageSize = 20000
page = 1
@ -1011,7 +1011,7 @@ page = 1
iacPidMultLoadBins = array, U08, 4124, [8], "Load", 1, 0.0, 0, 500.0, 2
iacPidMultRpmBins = array, U08, 4132, [8], "RPM", 50, 0, 0.0, 12000.0, 0
;no TS info - skipping mainUnusedEnd offset 4140
critical_error_message = string, ASCII, 6040, 80
critical_error_message = string, ASCII, 6000, 120
afterstartCoolantBins = array, F32, 6120, [8], "C", 1, 0, -100.0, 250.0, 0
afterstartHoldTime = array, F32, 6152, [8], "Seconds", 1, 0, 0, 100, 1
afterstartEnrich = array, F32, 6184, [8], "%", 1, 0, 0, 600, 1
@ -2828,7 +2828,6 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
field = mc33816_driven, mc33816_driven
field = mc33816spiDevice, mc33816spiDevice
field = "Warning Led", warningLedPin
; field = "Fatal Error Led", fatalErrorPin
field = "tle6240_cs", tle6240_cs
field = "tle6240 SPI", tle6240spiDevice
field = "mc33972_cs", mc33972_cs
@ -3238,7 +3237,6 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
field = "Running status LED", runningLedPin
field = "TS communication status LED", communicationLedPin
field = "Trigger error LED", triggerErrorPin
; field = "Fatal Error Led", fatalErrorPin
; Engine->MIL Settings
dialog = malfunction, "Check Engine Settings"

View File

@ -85,7 +85,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 Sat Mar 28 20:11:38 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:40 EDT 2020
pageSize = 20000
page = 1
@ -1011,7 +1011,7 @@ page = 1
iacPidMultLoadBins = array, U08, 4124, [8], "Load", 1, 0.0, 0, 500.0, 2
iacPidMultRpmBins = array, U08, 4132, [8], "RPM", 50, 0, 0.0, 12000.0, 0
;no TS info - skipping mainUnusedEnd offset 4140
critical_error_message = string, ASCII, 6040, 80
critical_error_message = string, ASCII, 6000, 120
afterstartCoolantBins = array, F32, 6120, [8], "C", 1, 0, -100.0, 250.0, 0
afterstartHoldTime = array, F32, 6152, [8], "Seconds", 1, 0, 0, 100, 1
afterstartEnrich = array, F32, 6184, [8], "%", 1, 0, 0, 600, 1

View File

@ -85,7 +85,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 Sat Mar 28 20:11:43 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:48 EDT 2020
pageSize = 20000
page = 1
@ -1011,7 +1011,7 @@ page = 1
iacPidMultLoadBins = array, U08, 4124, [8], "Load", 1, 0.0, 0, 500.0, 2
iacPidMultRpmBins = array, U08, 4132, [8], "RPM", 50, 0, 0.0, 12000.0, 0
;no TS info - skipping mainUnusedEnd offset 4140
critical_error_message = string, ASCII, 6040, 80
critical_error_message = string, ASCII, 6000, 120
afterstartCoolantBins = array, F32, 6120, [8], "C", 1, 0, -100.0, 250.0, 0
afterstartHoldTime = array, F32, 6152, [8], "Seconds", 1, 0, 0, 100, 1
afterstartEnrich = array, F32, 6184, [8], "%", 1, 0, 0, 600, 1

View File

@ -85,7 +85,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 Sat Mar 28 20:11:46 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:51 EDT 2020
pageSize = 20000
page = 1
@ -1011,7 +1011,7 @@ page = 1
iacPidMultLoadBins = array, U08, 4124, [8], "Load", 1, 0.0, 0, 500.0, 2
iacPidMultRpmBins = array, U08, 4132, [8], "RPM", 50, 0, 0.0, 12000.0, 0
;no TS info - skipping mainUnusedEnd offset 4140
critical_error_message = string, ASCII, 6040, 80
critical_error_message = string, ASCII, 6000, 120
afterstartCoolantBins = array, F32, 6120, [8], "C", 1, 0, -100.0, 250.0, 0
afterstartHoldTime = array, F32, 6152, [8], "Seconds", 1, 0, 0, 100, 1
afterstartEnrich = array, F32, 6184, [8], "%", 1, 0, 0, 600, 1

View File

@ -16,7 +16,6 @@ import com.rusefi.waves.EngineReport;
import static com.rusefi.IoUtil.*;
import static com.rusefi.IoUtil.getEnableCommand;
import static com.rusefi.TestingUtils.*;
import static com.rusefi.config.generated.Fields.CMD_PINS;
import static com.rusefi.config.generated.Fields.MOCK_MAF_COMMAND;
import static com.rusefi.waves.EngineReport.isCloseEnough;
@ -31,14 +30,14 @@ import static com.rusefi.waves.EngineReport.isCloseEnough;
public class AutoTest {
public static final int COMPLEX_COMMAND_RETRY = 10000;
static int currentEngineType;
private static String fatalError;
private static String criticalError;
static void mainTestBody() throws Exception {
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
@Override
public void onMessage(Class clazz, String message) {
if (message.startsWith(ConnectionStatus.FATAL_MESSAGE_PREFIX))
fatalError = message;
if (message.startsWith(Fields.CRITICAL_PREFIX))
criticalError = message;
}
});
@ -445,7 +444,7 @@ public class AutoTest {
}
private static void sendCommand(String command, int retryTimeoutMs, int totalTimeoutSeconds) {
assertNull("Fatal not expected", fatalError);
assertNull("Fatal not expected", criticalError);
IoUtil.sendCommand(command, retryTimeoutMs, totalTimeoutSeconds);
}

View File

@ -1,6 +1,7 @@
package com.rusefi.io;
import com.rusefi.Timeouts;
import com.rusefi.config.generated.Fields;
import com.rusefi.core.EngineTimeListener;
import com.rusefi.core.MessagesCentral;
import com.rusefi.core.Sensor;
@ -17,8 +18,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
* todo: eliminate logic duplication with {@link ConnectionWatchdog}
*/
public class ConnectionStatus {
// todo: react to any message as connected? how to know if message from controller, not internal message?
public static final String FATAL_MESSAGE_PREFIX = "FATAL";
@NotNull
private Value value = Value.NOT_CONNECTED;
@ -71,7 +70,7 @@ public class ConnectionStatus {
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
@Override
public void onMessage(Class clazz, String message) {
if (message.startsWith(FATAL_MESSAGE_PREFIX))
if (message.startsWith(Fields.CRITICAL_PREFIX))
markConnected();
}
});

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 Sat Mar 28 19:52:31 EDT 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Mar 28 21:08:37 EDT 2020
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
@ -318,8 +318,9 @@ public class Fields {
public static final int crankingTpsBins_offset_hex = 688;
public static final int crankingTpsCoef_offset = 1640;
public static final int crankingTpsCoef_offset_hex = 668;
public static final int critical_error_message_offset = 6040;
public static final int critical_error_message_offset_hex = 1798;
public static final int critical_error_message_offset = 6000;
public static final int critical_error_message_offset_hex = 1770;
public static final String CRITICAL_PREFIX = "CRITICAL";
public static final int cutFuelOnHardLimit_offset = 1464;
public static final int cutSparkOnHardLimit_offset = 1464;
public static final int cylinderBore_offset = 408;
@ -370,7 +371,7 @@ public class Fields {
public static final int engineSnifferRpmThreshold_offset_hex = 4;
public static final int engineType_offset = 0;
public static final int engineType_offset_hex = 0;
public static final int ERROR_BUFFER_SIZE = 80;
public static final int ERROR_BUFFER_SIZE = 120;
public static final int ETB_BIAS_CURVE_LENGTH = 8;
public static final int ETB_COUNT = 2;
public static final int etb_dFactor_offset = 1744;
@ -2378,7 +2379,7 @@ public class Fields {
public static final Field IDLERPMPID2_MINVALUE = Field.create("IDLERPMPID2_MINVALUE", 4056, FieldType.INT16);
public static final Field IDLERPMPID2_MAXVALUE = Field.create("IDLERPMPID2_MAXVALUE", 4058, FieldType.INT16);
public static final Field IACPIDMULTTABLE = Field.create("IACPIDMULTTABLE", 4060, FieldType.INT);
public static final Field CRITICAL_ERROR_MESSAGE = Field.create("CRITICAL_ERROR_MESSAGE", 6040, FieldType.INT);
public static final Field CRITICAL_ERROR_MESSAGE = Field.create("CRITICAL_ERROR_MESSAGE", 6000, FieldType.INT);
public static final Field BOOSTTABLEOPENLOOP = Field.create("BOOSTTABLEOPENLOOP", 6248, FieldType.INT);
public static final Field BOOSTTABLECLOSEDLOOP = Field.create("BOOSTTABLECLOSEDLOOP", 6328, FieldType.INT);
public static final Field PEDALTOTPSTABLE = Field.create("PEDALTOTPSTABLE", 6400, FieldType.INT);

View File

@ -49,7 +49,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20200323;
public static final int CONSOLE_VERSION = 20200328;
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
@ -66,8 +66,8 @@ public class Launcher {
private static final String TOOL_NAME_COMPILE = "compile";
private final String port;
// todo: the logic around 'fatalError' could be implemented nicer
private String fatalError;
// todo: the logic around 'criticalError' could be implemented nicer
private String criticalError;
public static EngineSnifferPanel engineSnifferPanel;
private static SensorCentral.SensorListener wrongVersionListener;
@ -93,8 +93,8 @@ public class Launcher {
default:
text = "";
}
if (fatalError != null) {
text = fatalError;
if (criticalError != null) {
text = criticalError;
g.setColor(Color.red);
}
int labelWidth = g.getFontMetrics().stringWidth(text);
@ -149,8 +149,8 @@ public class Launcher {
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
@Override
public void onMessage(Class clazz, String message) {
if (message.startsWith(ConnectionStatus.FATAL_MESSAGE_PREFIX))
fatalError = message;
if (message.startsWith(Fields.CRITICAL_PREFIX))
criticalError = message;
}
});

View File

@ -1,8 +1,8 @@
package com.rusefi.ui;
import com.rusefi.FileLog;
import com.rusefi.config.generated.Fields;
import com.rusefi.core.MessagesCentral;
import com.rusefi.io.ConnectionStatus;
import com.rusefi.ui.util.UiUtils;
import javax.swing.*;
@ -18,7 +18,7 @@ public class WarningPanel {
private final JLabel label = new JLabel();
private final JButton reset = new JButton("clear warning");
private final Timer fatalBlinking = new Timer(1000, new ActionListener() {
private final Timer criticalErrorBlinking = new Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
label.setVisible(!label.isVisible());
@ -50,9 +50,9 @@ public class WarningPanel {
if (haveFatalError)
return;
if (message.startsWith(ConnectionStatus.FATAL_MESSAGE_PREFIX)) {
if (message.startsWith(Fields.CRITICAL_PREFIX)) {
haveFatalError = true;
fatalBlinking.start();
criticalErrorBlinking.start();
label.setText(message);
return;
}

View File

@ -51,6 +51,28 @@ public class ConfigFieldParserTest {
assertEquals(16, TypesHelper.getElementSize(state, "pid_s"));
}
@Test
public void useCustomType() throws IOException {
ReaderState state = new ReaderState();
String test = "struct pid_s\n" +
"#define ERROR_BUFFER_SIZE 120\n" +
"\tcustom critical_error_message_t @@ERROR_BUFFER_SIZE@@ string, ASCII, @OFFSET@, @@ERROR_BUFFER_SIZE@@\n" +
"\tcritical_error_message_t var;\n" +
"\tint16_t periodMs;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +
"end_struct\n" +
"";
BufferedReader reader = new BufferedReader(new StringReader(test));
JavaFieldsConsumer javaFieldsConsumer = new TestJavaFieldsConsumer(state);
state.readBufferedReader(reader, Arrays.asList(javaFieldsConsumer));
assertEquals("\tpublic static final Field VAR = Field.create(\"VAR\", 0, FieldType.INT);\n" +
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 120, FieldType.INT16);\n",
javaFieldsConsumer.getJavaFieldsWriter());
}
@Test
public void testFsioVisible() throws IOException {
{

View File

@ -28,7 +28,7 @@
#define EFI_UNIT_TEST FALSE
#define hasFatalError() (FALSE)
#define hasOsPanicError() (FALSE)
#define US_TO_NT_MULTIPLIER 100