This commit is contained in:
jharvey 2020-05-16 05:41:39 -04:00
commit 56baa8dc18
63 changed files with 669 additions and 471 deletions

View File

@ -986,6 +986,7 @@
#define GAUGE_NAME_AFR "Air/Fuel Ratio"
#define GAUGE_NAME_AIR_FLOW "MAF air flow"
#define GAUGE_NAME_AIR_MASS "air mass"
#define GAUGE_NAME_BARO_PRESSURE "Barometric pressure"
#define GAUGE_NAME_CPU_TEMP "CPU Temperature"
#define GAUGE_NAME_DEBUG_F1 "debug f1"
#define GAUGE_NAME_DEBUG_F2 "debug f2: iTerm"
@ -2268,6 +2269,8 @@
#define ts_show_hip9011 true
#define ts_show_joystick true
#define ts_show_lcd true
#define ts_show_main_relay true
#define ts_show_main_relay_microRusEFI_message false
#define ts_show_sd_card true
#define ts_show_spi true
#define ts_show_trigger_comparator true

View File

@ -11,3 +11,5 @@
#define ts_show_sd_card true
#define ts_show_can_pins false
#define ts_show_tunerstudio_port false
#define ts_show_main_relay false
#define ts_show_main_relay_microRusEFI_message true

View File

@ -37,7 +37,6 @@
#define BOARD_NAME "STM32 Nucleo144-F746ZI for RusEFI"
#define EFI_USB_AF 10U
#define EFI_USB_SERIAL_ID GPIOA_10
#define EFI_USB_SERIAL_DM GPIOA_11
#define EFI_USB_SERIAL_DP GPIOA_12

View File

@ -37,7 +37,6 @@
#define BOARD_NAME "STM32 Nucleo144-F767ZI for RusEFI"
#define EFI_USB_AF 10U
#define EFI_USB_SERIAL_ID GPIOA_10
#define EFI_USB_SERIAL_DM GPIOA_11
#define EFI_USB_SERIAL_DP GPIOA_12

View File

@ -33,7 +33,6 @@
#define BOARD_NAME "STM32F407 for RusEFI"
#define EFI_USB_AF 10U
#define EFI_USB_SERIAL_ID GPIOA_10
#define EFI_USB_SERIAL_DM GPIOA_11
#define EFI_USB_SERIAL_DP GPIOA_12

View File

@ -128,8 +128,8 @@ void setToyota_2jz_vics(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->debugMode = DBG_VVT;
// todo: these magic values would be hardcoded once we find out proper magic values
engineConfiguration->fsio_setting[14] = -90;
engineConfiguration->fsio_setting[15] = +90;
engineConfiguration->fsio_setting[14] = 175 - 45;
engineConfiguration->fsio_setting[15] = 175 + 45;
engineConfiguration->auxPidPins[0] = GPIOE_3; // VVT solenoid control

View File

@ -129,13 +129,6 @@ static int logFileLineIndex = 0;
static void reportSensorF(Logging *log, const char *caption, const char *units, float value,
int precision) {
bool isLogFileFormatting = true;
if (!isLogFileFormatting) {
#if EFI_PROD_CODE || EFI_SIMULATOR
debugFloat(log, caption, value, precision);
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
} else {
#if EFI_FILE_LOGGING
if (logFileLineIndex == 0) {
@ -153,7 +146,6 @@ static void reportSensorF(Logging *log, const char *caption, const char *units,
UNUSED(precision);
#endif /* EFI_FILE_LOGGING */
}
}
static void reportSensorI(Logging *log, const char *caption, const char *units, int value) {
#if EFI_FILE_LOGGING

View File

@ -130,8 +130,6 @@ static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif
}
static efitick_t tle8888CrankingResetTime = 0;
void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
ScopePerf perf(PE::EnginePeriodicSlowCallback);
@ -152,6 +150,8 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
standardAirCharge = getStandardAirCharge(PASS_ENGINE_PARAMETER_SIGNATURE);
#if (BOARD_TLE8888_COUNT > 0)
static efitick_t tle8888CrankingResetTime = 0;
if (CONFIG(useTLE8888_cranking_hack) && ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
efitick_t nowNt = getTimeNowNt();
if (nowNt - tle8888CrankingResetTime > MS2NT(300)) {

View File

@ -2083,7 +2083,7 @@ typedef enum {
CUSTOM_NO_ETB_FOR_IDLE = 6723,
CUSTOM_ERR_6724 = 6724,
CUSTOM_ERR_6725 = 6725,
CUSTOM_ERR_6726 = 6726,
CUSTOM_ERR_VVT_OUT_OF_RANGE = 6726,
CUSTOM_ERR_6727 = 6727,
CUSTOM_ERR_6728 = 6728,
CUSTOM_ERR_6729 = 6729,

View File

@ -717,6 +717,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20200514;
return 20200515;
}
#endif /* EFI_UNIT_TEST */

View File

@ -986,6 +986,7 @@
#define GAUGE_NAME_AFR "Air/Fuel Ratio"
#define GAUGE_NAME_AIR_FLOW "MAF air flow"
#define GAUGE_NAME_AIR_MASS "air mass"
#define GAUGE_NAME_BARO_PRESSURE "Barometric pressure"
#define GAUGE_NAME_CPU_TEMP "CPU Temperature"
#define GAUGE_NAME_DEBUG_F1 "debug f1"
#define GAUGE_NAME_DEBUG_F2 "debug f2: iTerm"
@ -2268,6 +2269,8 @@
#define ts_show_hip9011 true
#define ts_show_joystick true
#define ts_show_lcd true
#define ts_show_main_relay true
#define ts_show_main_relay_microRusEFI_message false
#define ts_show_sd_card true
#define ts_show_spi true
#define ts_show_trigger_comparator false

View File

@ -255,12 +255,6 @@ void NamedOutputPin::setLow() {
// turn off the output
setValue(false);
#if EFI_DEFAILED_LOGGING
// systime_t after = getTimeNowUs();
// debugInt(&signal->logging, "a_time", after - signal->hi_time);
// scheduleLogging(&signal->logging);
#endif /* EFI_DEFAILED_LOGGING */
#if EFI_ENGINE_SNIFFER
addEngineSnifferEvent(getShortName(), PROTOCOL_ES_DOWN);
#endif /* EFI_ENGINE_SNIFFER */

View File

@ -32,7 +32,8 @@ public:
OutputPin();
/**
* initializes pin & registers it in pin repository
* todo: add a comment explaining why outputMode POINTER not VALUE?
* outputMode being a pointer allow us to change configuration (for example invert logical pin) in configuration and get resuts applied
* away, or at least I hope that's why
*/
void initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode);
/**

View File

@ -41,16 +41,11 @@ WaveChart waveChart;
#endif /* EFI_ENGINE_SNIFFER */
trigger_central_s::trigger_central_s() : hwEventCounters() {
static_assert(TRIGGER_TYPE_60_2 == TT_TOOTHED_WHEEL_60_2, "One we will have one source of this magic constant");
static_assert(TRIGGER_TYPE_36_1 == TT_TOOTHED_WHEEL_36_1, "One we will have one source of this magic constant");
static_assert(TRIGGER_TYPE_60_2 == TT_TOOTHED_WHEEL_60_2, "One day we will have one source of this magic constant");
static_assert(TRIGGER_TYPE_36_1 == TT_TOOTHED_WHEEL_36_1, "One day we will have one source of this magic constant");
}
TriggerCentral::TriggerCentral() : trigger_central_s() {
clearCallbacks(&triggerListeneres);
triggerState.resetTriggerState();
noiseFilter.resetAccumSignalData();
@ -105,6 +100,14 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
if (!CONFIG(displayLogicLevelsInEngineSniffer)) {
addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
#if EFI_TOOTH_LOGGER
if (front == TV_RISE) {
LogTriggerTooth(SHAFT_SECONDARY_RISING, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
} else {
LogTriggerTooth(SHAFT_SECONDARY_FALLING, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
}
#endif /* EFI_TOOTH_LOGGER */
}
@ -160,7 +163,9 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
switch(engineConfiguration->vvtMode) {
case VVT_2JZ:
if (currentPosition < engineConfiguration->fsio_setting[14] || currentPosition > engineConfiguration->fsio_setting[15]) {
// we do not know if we are in sync or out of sync, so we have to be looking for both possibilities
if ((currentPosition < engineConfiguration->fsio_setting[14] || currentPosition > engineConfiguration->fsio_setting[15]) &&
(currentPosition < engineConfiguration->fsio_setting[14] + 360 || currentPosition > engineConfiguration->fsio_setting[15] + 360)) {
// outside of the expected range
return;
}
@ -203,7 +208,12 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_
tc->vvtSyncTimeNt = nowNt;
// we do NOT clamp VVT position into the [0, engineCycle) range - we expect vvtOffset to be configured so that
// it's not necessary
tc->vvtPosition = engineConfiguration->vvtOffset - currentPosition;
if (tc->vvtPosition < 0 || tc->vvtPosition > ENGINE(engineCycle)) {
warning(CUSTOM_ERR_VVT_OUT_OF_RANGE, "Please adjust vvtOffset since position %f", tc->vvtPosition);
}
switch (engineConfiguration->vvtMode) {
case VVT_FIRST_HALF:

View File

@ -442,8 +442,6 @@ public:
}
};
static char errorMsgBuff[_MAX_FILLER + 2];
void addChannel(const char *name, adc_channel_e setting, adc_channel_mode_e mode) {
if (setting == EFI_ADC_NONE) {
return;

View File

@ -314,17 +314,18 @@ static int tle6240_wake_driver(struct tle6240_priv *chip)
{
(void)chip;
if (isIsrContext()) {
// this is for normal runtime
int wasLocked = lockAnyContext();
/* Entering a reentrant critical zone.*/
syssts_t sts = chSysGetStatusAndLockX();
chSemSignalI(&tle6240_wake);
if (!wasLocked) {
unlockAnyContext();
}
} else {
// this is for start-up to not hang up
chSemSignal(&tle6240_wake);
if (!port_is_isr_context()) {
/**
* chSemSignalI above requires rescheduling
* interrupt handlers have implicit rescheduling
*/
chSchRescheduleS();
}
/* Leaving the critical zone.*/
chSysRestoreStatusX(sts);
return 0;
}

View File

@ -40,7 +40,6 @@ void usb_serial_start(void) {
usbConnectBus(serusbcfg.usbp);
#if HAL_USE_SERIAL
efiSetPadMode("USB ID", EFI_USB_SERIAL_ID, PAL_MODE_ALTERNATE(EFI_USB_AF));
efiSetPadMode("USB DM", EFI_USB_SERIAL_DM, PAL_MODE_ALTERNATE(EFI_USB_AF));
efiSetPadMode("USB DP", EFI_USB_SERIAL_DP, PAL_MODE_ALTERNATE(EFI_USB_AF));
/*

View File

@ -1431,6 +1431,8 @@ end_struct
#define GAUGE_NAME_ACCEL_Y "Acceleration: Y"
#define GAUGE_NAME_ACCEL_Z "Acceleration: Z"
#define GAUGE_NAME_BARO_PRESSURE "Barometric pressure"
#define GAUGE_NAME_ECU_TEMPERATURE "ECU temperature"
@ -1551,6 +1553,8 @@ end_struct
! some board files override this value using prepend file
#define ts_show_hip9011 true
#define ts_show_main_relay true
#define ts_show_main_relay_microRusEFI_message false
#define ts_show_cj125 true
#define ts_show_etb true
#define ts_show_etb_pins true

View File

@ -1,12 +1,12 @@
// This file was generated by Version2Header
// Fri Apr 24 12:30:26 EDT 2020
// Sat May 16 01:51:18 EDT 2020
#ifndef GIT_HASH
#define GIT_HASH "24ecb69e28eec77f5722fcafcf17b14464a10bca"
#define GIT_HASH "c9409ce69379772e2b3cac3016518e56abf97851"
#endif
#ifndef VCS_VERSION
#define VCS_VERSION "22343"
#define VCS_VERSION "22876"
#endif

View File

@ -89,7 +89,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 gen_config.bat integration\rusefi_config.txt Thu May 14 23:44:58 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri May 15 16:34:17 EDT 2020
pageSize = 20000
page = 1
@ -1651,15 +1651,15 @@ page = 1
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
@ -2509,7 +2509,7 @@ menuDialog = main
subMenu = std_separator
# Digital outputs
subMenu = mainRelay, "Main relay"
subMenu = mainRelayDialog, "Main relay"
subMenu = starterRelay, "Starter Disable relay"
subMenu = fuelPump, "Fuel pump & rail"
subMenu = fanSetting, "Fan"
@ -3589,7 +3589,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Controller->Actuator Outputs
dialog = mainRelay, "Main relay output"
dialog = mainRelayDialog, "Main relay output"
field = "Pin", mainRelayPin
field = "Pin mode", mainRelayPinMode

View File

@ -391,15 +391,15 @@ enable2ndByteCanID = false
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
@ -960,8 +960,8 @@ gaugeCategory = Sensors - Extra 1
VSSGauge = vehicleSpeedKph, "Vehicle speed", "kmh", 0, 200, 0, 1, 3, 4, 1, 1
accelerationXGauge = accelerationX, @@GAUGE_NAME_ACCEL_X@@, "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
accelerationYGauge = accelerationY, @@GAUGE_NAME_ACCEL_Y@@, "acc", -11, 11, 1.0, 1.2, 100, 100, 3, 1
atmPresCGauge = baroPressure, "Barometric pressure", "kPa", 0, 1024, 0, 0, 0, 0, 0, 0
vvtPositionGauge = vvtPosition, "VVT position", "deg", 0, 100, 0, 0, 720, 720, 0, 0
atmPresCGauge = baroPressure, @@GAUGE_NAME_BARO_PRESSURE@@, "kPa", 0, 1024, 0, 0, 0, 0, 0, 0
vvtPositionGauge = vvtPosition, @@GAUGE_NAME_VVT@@, "deg", 0, 100, 0, 0, 720, 720, 0, 0
internalMcuTemperatureGauge = internalMcuTemperature, @@GAUGE_NAME_ECU_TEMPERATURE@@, "C", 0, 100, 0, 0, 75, 100, 0, 0
OilPressGauge = oilPressure, "Oil Pressure", "kPa", 0, 750, 35, 75, 550, 700, 0, 0
idleAirValvePositionGauge = idleAirValvePosition, "Idle position", "%", 0, 100, 0, 0, 100, 100, 1, 1
@ -1249,7 +1249,7 @@ menuDialog = main
subMenu = std_separator
# Digital outputs
subMenu = mainRelay, "Main relay"
subMenu = mainRelayDialog, "Main relay"
subMenu = starterRelay, "Starter Disable relay"
subMenu = fuelPump, "Fuel pump & rail"
subMenu = fanSetting, "Fan"
@ -2319,9 +2319,10 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Controller->Actuator Outputs
dialog = mainRelay, "Main relay output"
field = "Pin", mainRelayPin
field = "Pin mode", mainRelayPinMode
dialog = mainRelayDialog, "Main relay output"
field = "microRusEFI main relay control is hard wired on pin #29"@@if_ts_show_main_relay_microRusEFI_message
field = "Pin", mainRelayPin@@if_ts_show_main_relay
field = "Pin mode", mainRelayPinMode@@if_ts_show_main_relay
dialog = starterRelay, "Starter relay output"
field = "Pin", starterRelayDisablePin

View File

@ -89,7 +89,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 gen_config.bat integration\rusefi_config.txt Thu May 14 23:45:33 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri May 15 16:34:25 EDT 2020
pageSize = 20000
page = 1
@ -1651,15 +1651,15 @@ page = 1
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
@ -2509,7 +2509,7 @@ menuDialog = main
subMenu = std_separator
# Digital outputs
subMenu = mainRelay, "Main relay"
subMenu = mainRelayDialog, "Main relay"
subMenu = starterRelay, "Starter Disable relay"
subMenu = fuelPump, "Fuel pump & rail"
subMenu = fanSetting, "Fan"
@ -3589,7 +3589,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Controller->Actuator Outputs
dialog = mainRelay, "Main relay output"
dialog = mainRelayDialog, "Main relay output"
field = "Pin", mainRelayPin
field = "Pin mode", mainRelayPinMode

View File

@ -89,7 +89,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 kineris_gen_config.bat integration/rusefi_config.txt Thu May 14 20:41:28 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kineris_gen_config.bat integration/rusefi_config.txt Fri May 15 21:04:28 EDT 2020
pageSize = 20000
page = 1
@ -855,7 +855,7 @@ page = 1
storageMode = bits, U32, 2260, [0:7], "Auto", "Always", "Never"
narrowToWideOxygenBins = array, F32, 2264, [8], "V", 1, 0, -10.0, 10.0, 3
narrowToWideOxygen = array, F32, 2296, [8], "ratio", 1, 0, -40.0, 40.0, 2
vvtMode = bits, U32, 2328, [0:7], "First half", "Second half", "2GZ", "Miata NB2", "mode4", "mode5", "mode6", "mode7"
vvtMode = bits, U32, 2328, [0:7], "Inactive", "Second half", "2GZ", "Miata NB2", "First half", "mode5", "mode6", "mode7"
;no TS info - skipping unusedOldBiquad offset 2332
cltTimingBins = array, F32, 2352, [8], "C", 1, 0, -100.0, 250.0, 1
cltTimingExtra = array, F32, 2384, [8], "degree", 1, 0, -400.0, 400.0, 0
@ -1651,15 +1651,15 @@ page = 1
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
@ -2509,7 +2509,7 @@ menuDialog = main
subMenu = std_separator
# Digital outputs
subMenu = mainRelay, "Main relay"
subMenu = mainRelayDialog, "Main relay"
subMenu = starterRelay, "Starter Disable relay"
subMenu = fuelPump, "Fuel pump & rail"
subMenu = fanSetting, "Fan"
@ -3590,7 +3590,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Controller->Actuator Outputs
dialog = mainRelay, "Main relay output"
dialog = mainRelayDialog, "Main relay output"
field = "Pin", mainRelayPin
field = "Pin mode", mainRelayPinMode

View File

@ -89,7 +89,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 gen_config.bat integration\rusefi_config.txt Thu May 14 23:04:50 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri May 15 16:34:21 EDT 2020
pageSize = 20000
page = 1
@ -1651,15 +1651,15 @@ page = 1
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
@ -2509,7 +2509,7 @@ menuDialog = main
subMenu = std_separator
# Digital outputs
subMenu = mainRelay, "Main relay"
subMenu = mainRelayDialog, "Main relay"
subMenu = starterRelay, "Starter Disable relay"
subMenu = fuelPump, "Fuel pump & rail"
subMenu = fanSetting, "Fan"
@ -3569,9 +3569,8 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Controller->Actuator Outputs
dialog = mainRelay, "Main relay output"
field = "Pin", mainRelayPin
field = "Pin mode", mainRelayPinMode
dialog = mainRelayDialog, "Main relay output"
field = "microRusEFI main relay control is hard wired on pin #29"
dialog = starterRelay, "Starter relay output"
field = "Pin", starterRelayDisablePin

View File

@ -89,7 +89,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 gen_config.bat integration\rusefi_config.txt Thu May 14 23:45:56 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri May 15 16:34:28 EDT 2020
pageSize = 20000
page = 1
@ -1651,15 +1651,15 @@ page = 1
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
@ -2509,7 +2509,7 @@ menuDialog = main
subMenu = std_separator
# Digital outputs
subMenu = mainRelay, "Main relay"
subMenu = mainRelayDialog, "Main relay"
subMenu = starterRelay, "Starter Disable relay"
subMenu = fuelPump, "Fuel pump & rail"
subMenu = fanSetting, "Fan"
@ -3585,7 +3585,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Controller->Actuator Outputs
dialog = mainRelay, "Main relay output"
dialog = mainRelayDialog, "Main relay output"
field = "Pin", mainRelayPin
field = "Pin mode", mainRelayPinMode

View File

@ -89,7 +89,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 gen_config.bat integration\rusefi_config.txt Thu May 14 23:46:05 EDT 2020
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri May 15 16:34:31 EDT 2020
pageSize = 20000
page = 1
@ -1651,15 +1651,15 @@ page = 1
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
@ -2509,7 +2509,7 @@ menuDialog = main
subMenu = std_separator
# Digital outputs
subMenu = mainRelay, "Main relay"
subMenu = mainRelayDialog, "Main relay"
subMenu = starterRelay, "Starter Disable relay"
subMenu = fuelPump, "Fuel pump & rail"
subMenu = fanSetting, "Fan"
@ -3564,7 +3564,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Controller->Actuator Outputs
dialog = mainRelay, "Main relay output"
dialog = mainRelayDialog, "Main relay output"
field = "Pin", mainRelayPin
field = "Pin mode", mainRelayPinMode

35
firmware/util/common.h Normal file
View File

@ -0,0 +1,35 @@
/**
* @file common.h
* @brief Common macros definitions
*
* @date May, 2019
* @author Andrey Gusakov, (c) 2019
*
* This file is part of rusEfi - see http://rusefi.com
*
* rusEfi is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMON_H_INCLUDED
#define COMMON_H_INCLUDED
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define CLAMP(x, low, high) ({\
__typeof__(x) __x = (x); \
__typeof__(low) __low = (low);\
__typeof__(high) __high = (high);\
(__x > __high) ? __high : ((__x < __low) ? __low : __x);\
})
#endif /* COMMON_H_INCLUDED */

View File

@ -153,12 +153,6 @@ int isInitialized(Logging *logging) {
return logging->isInitialized;
}
void debugInt(Logging *logging, const char *caption, int value) {
append(logging, caption);
append(logging, DELIMETER);
appendPrintf(logging, "%d%s", value, DELIMETER);
}
void appendFloat(Logging *logging, float value, int precision) {
/**
* todo: #1 this implementation is less than perfect
@ -190,14 +184,6 @@ void appendFloat(Logging *logging, float value, int precision) {
}
}
void debugFloat(Logging *logging, const char *caption, float value, int precision) {
append(logging, caption);
append(logging, DELIMETER);
appendFloat(logging, value, precision);
append(logging, DELIMETER);
}
static char header[16];
/**

View File

@ -51,9 +51,6 @@ int isInitialized(Logging *logging);
void initLoggingExt(Logging *logging, const char *name, char *buffer, int bufferSize);
void debugInt(Logging *logging, const char *caption, int value);
void debugFloat(Logging *logging, const char *text, float value, int precision);
void appendFloat(Logging *logging, float value, int precision);
void resetLogging(Logging *logging);

113
firmware/util/unaligned.c Normal file
View File

@ -0,0 +1,113 @@
/**
* @file unaligned.c
* @brief unaligned data access helpers
*
* @date May, 2019
* @author Andrey Gusakov, (c) 2019
*
* This file is part of rusEfi - see http://rusefi.com
*
* rusEfi is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "unaligned.h"
#include "common.h"
/* generate mask */
static inline uint32_t bit_mask(unsigned int from, unsigned int to)
{
uint32_t mask = 0;
uint32_t shift;
if (to < from)
return 0;
shift = to - from + 1U;
if ((shift > 0U) && (shift <= 32U) && (from <= 31U)) {
if (shift < 32U) {
mask = (uint32_t)((1UL << shift) - 1UL);
mask = mask << from;
} else {
mask = 0xFFFFFFFFUL;
}
}
return mask;
}
/* get upto 32 bits from char array p, from bit position pos, lenght len */
uint32_t bits_get(uint8_t *p, unsigned int pos, int len)
{
int i;
unsigned int offset = 0;
uint32_t res = 0;
i = (int)pos / 8;
while (len > 0) {
uint32_t tmp;
uint32_t mask;
int nbits = 8 - ((int)pos % 8);
/* get */
tmp = (uint32_t)p[i];
/* shift */
tmp = tmp >> (8U - (uint32_t)nbits);
/* mask */
mask = bit_mask(0, MIN((uint32_t)len - 1U, (uint32_t)nbits - 1U));
tmp = tmp & mask;
res = res | ((tmp) << offset);
/* adjust for the next iteration */
offset += (unsigned int)nbits;
len -= nbits;
pos += (unsigned int)nbits;
i++;
}
return res;
}
/* set upto 32 bits in char array p, from bit position pos, lenght len */
void bits_set(uint8_t *p, unsigned int pos, int len, uint32_t val)
{
int i;
unsigned int offset = 0;
i = (int)pos / 8;
while (len > 0) {
uint32_t tmp;
uint32_t mask;
/* get number of bits to shift to get to the target range */
int shift = (int)pos % 8;
/* get next byte */
tmp = (val >> offset) & 0xffU;
/* shift temporary value to the start of the target range */
tmp = tmp << (uint8_t)shift;
/* calculate mask */
mask = bit_mask((uint32_t)shift, MIN(8U - 1U, (unsigned int)shift + (unsigned int)len - 1U));
/* clean all bits outside of the target range */
tmp &= mask;
/* pre-clean all target bits */
p[i] = p[i] & ~((uint8_t)mask);
/* finally set active bits */
p[i] |= (uint8_t)tmp;
/* adjust for the next iteration */
offset += ((uint32_t)8U - (uint32_t)shift);
len -= (8 - shift);
pos += ((unsigned int)8U - (unsigned int)shift);
i++;
}
}

105
firmware/util/unaligned.h Normal file
View File

@ -0,0 +1,105 @@
/**
* @file unaligned.h
* @brief unaligned data access helpers header file
*
* @date May, 2019
* @author Andrey Gusakov, (c) 2019
*
* This file is part of rusEfi - see http://rusefi.com
*
* rusEfi is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UNALIGNED_H_INCLUDED
#define UNALIGNED_H_INCLUDED
#include <stdint.h>
/* bit operations */
uint32_t bits_get(uint8_t *p, unsigned int pos, int len);
void bits_set(uint8_t *p, unsigned int pos, int len, uint32_t val);
#define bit_set(p, pos) do {(p)[(pos) / 8] |= (1 << ((pos) % 8));} while(0)
#define bit_clr(p, pos) do {(p)[(pos) / 8] &= ~(1 << ((pos) % 8));} while(0)
#define bit_get(p, pos) (!!((p)[(pos) / 8] & (1 << ((pos) % 8))))
/* unaligned access */
static inline void put_be8(uint8_t *p, uint8_t v)
{
p[0] = v;
}
static inline void put_le8(uint8_t *p, uint8_t v)
{
p[0] = v;
}
static inline void put_be16(uint8_t *p, uint16_t v)
{
p[0] = (uint8_t)(v >> 8);
p[1] = (uint8_t)(v >> 0);
}
static inline void put_le16(uint8_t *p, uint16_t v)
{
p[0] = (uint8_t)(v >> 0);
p[1] = (uint8_t)(v >> 8);
}
static inline void put_be32(uint8_t *p, uint32_t v)
{
p[0] = (uint8_t)(v >> 24);
p[1] = (uint8_t)(v >> 16);
p[2] = (uint8_t)(v >> 8);
p[3] = (uint8_t)(v >> 0);
}
static inline void put_le32(uint8_t *p, uint32_t v)
{
p[0] = (uint8_t)(v >> 0);
p[1] = (uint8_t)(v >> 8);
p[2] = (uint8_t)(v >> 16);
p[3] = (uint8_t)(v >> 24);
}
static inline uint8_t get_be8(uint8_t *p)
{
return p[0];
}
static inline uint8_t get_le8(uint8_t *p)
{
return p[0];
}
static inline uint16_t get_be16(uint8_t *p)
{
return ((uint16_t)p[0] << 8) | p[1];
}
static inline uint16_t get_le16(uint8_t *p)
{
return ((uint16_t)p[1] << 8) | p[0];
}
static inline uint32_t get_be32(uint8_t *p)
{
return ((uint32_t)p[0] << 24) | ((uint32_t)p[1] << 16) |
((uint32_t)p[2] << 8) | p[3];
}
static inline uint32_t get_le32(uint8_t *p)
{
return ((uint32_t)p[3] << 24) | ((uint32_t)p[2] << 16) |
((uint32_t)p[1] << 8) | p[0];
}
#endif /* UNALIGNED_H_INCLUDED */

View File

@ -4,7 +4,8 @@ UTILSRC = \
$(UTIL_DIR)/containers/data_buffer.c \
$(UTIL_DIR)/math/crc.c \
$(UTIL_DIR)/os_util.c \
$(UTIL_DIR)/histogram.c
$(UTIL_DIR)/histogram.c \
$(UTIL_DIR)/unaligned.c
UTILSRC_CPP = \
$(UTIL_DIR)/containers/cyclic_buffer.cpp \

View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Launcher headless" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.rusefi.Launcher" />
<module name="ui" />
<option name="PROGRAM_PARAMETERS" value="headless" />
<option name="VM_PARAMETERS" value="-Dini_file_path=../firmware/tunerstudio -Dshow_etb_pane=true" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -43,7 +43,7 @@ public class AutoTest {
}
});
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
// let's make sure 'burn' command works since sometimes it does not
bp.burn(Logger.CONSOLE);

View File

@ -43,8 +43,6 @@ public class IoUtil {
static void sendCommand(String command, int retryTimeoutMs, int totalTimeoutSeconds) {
final CountDownLatch responseLatch = new CountDownLatch(1);
long time = System.currentTimeMillis();
if (LinkManager.hasError())
throw new IllegalStateException("IO error");
FileLog.MAIN.logLine("Sending command [" + command + "]");
final long begin = System.currentTimeMillis();
CommandQueue.getInstance().write(command, retryTimeoutMs, new InvocationConfirmationListener() {
@ -57,8 +55,6 @@ public class IoUtil {
wait(responseLatch, totalTimeoutSeconds);
if (responseLatch.getCount() > 0)
FileLog.MAIN.logLine("No confirmation in " + retryTimeoutMs);
if (LinkManager.hasError())
throw new IllegalStateException("IO error");
FileLog.MAIN.logLine("Command [" + command + "] executed in " + (System.currentTimeMillis() - time));
}

View File

@ -27,6 +27,11 @@ import java.util.concurrent.TimeoutException;
import static com.rusefi.binaryprotocol.IoHelper.*;
/**
* This object represents logical state of physical connection.
*
* Instance is connected until we experience issues. Once we decide to close the connection there is no restart -
* new instance of this class would need to be created once we establish a new physical connection.
*
* (c) Andrey Belomutskiy
* 3/6/2015
* @see BinaryProtocolHolder
@ -83,7 +88,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
CommunicationLoggingHolder.communicationLoggingListener.onPortHolderMessage(BinaryProtocol.class, "Sending [" + command + "]");
}
Future f = LinkManager.COMMUNICATION_EXECUTOR.submit(new Runnable() {
Future f = LinkManager.submit(new Runnable() {
@Override
public void run() {
sendTextCommand(command);
@ -134,7 +139,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
while (!isClosed) {
// FileLog.rlog("queue: " + LinkManager.COMMUNICATION_QUEUE.toString());
if (LinkManager.COMMUNICATION_QUEUE.isEmpty()) {
LinkManager.COMMUNICATION_EXECUTOR.submit(new Runnable() {
LinkManager.submit(new Runnable() {
@Override
public void run() {
if (requestOutputChannels())

View File

@ -2,28 +2,28 @@ package com.rusefi.binaryprotocol;
import com.opensr5.Logger;
import com.rusefi.io.IoStream;
import com.rusefi.io.LinkManager;
/**
* At any given moment of time JVM manages one communication stream
*
* TODO: remove this dead class?
*
* (c) Andrey Belomutskiy
* 6/21/2017.
*/
public enum BinaryProtocolHolder {
INSTANCE;
// todo: fix this? less horrible but still weird!
private BinaryProtocol instance;
public static BinaryProtocolHolder getInstance() {
return INSTANCE;
}
public BinaryProtocol get() {
return instance;
public static BinaryProtocol create(final Logger logger, IoStream stream) {
return new BinaryProtocol(logger, stream);
}
public static BinaryProtocol create(final Logger logger, IoStream stream) {
BinaryProtocol result = new BinaryProtocol(logger, stream);
getInstance().instance = result;
return result;
public static BinaryProtocol getCurrentStreamState() {
return LinkManager.connector.getBinaryProtocol();
}
}

View File

@ -1,5 +1,7 @@
package com.rusefi.io;
import com.rusefi.binaryprotocol.BinaryProtocol;
/**
* @author Andrey Belomutskiy
* 3/3/14
@ -11,7 +13,7 @@ public interface LinkConnector extends LinkDecoder {
}
@Override
public void send(String command, boolean fireEvent) throws InterruptedException {
public void send(String command, boolean fireEvent) {
}
@Override
@ -19,8 +21,8 @@ public interface LinkConnector extends LinkDecoder {
}
@Override
public boolean hasError() {
return false;
public BinaryProtocol getBinaryProtocol() {
return null;
}
@Override
@ -35,5 +37,5 @@ public interface LinkConnector extends LinkDecoder {
void restart();
boolean hasError();
BinaryProtocol getBinaryProtocol();
}

View File

@ -40,6 +40,14 @@ public class LinkManager {
return connected;
}
public static void execute(Runnable runnable) {
COMMUNICATION_EXECUTOR.execute(runnable);
}
public static Future submit(Runnable runnable) {
return COMMUNICATION_EXECUTOR.submit(runnable);
}
public enum LogLevel {
INFO,
DEBUG,
@ -87,12 +95,23 @@ public class LinkManager {
private static Thread COMMUNICATION_THREAD;
static {
COMMUNICATION_EXECUTOR.submit(new Runnable() {
/*
Future future = submit(new Runnable() {
@Override
public void run() {
// WAT? this is hanging?!
COMMUNICATION_THREAD = Thread.currentThread();
System.out.println("Done");
}
});
try {
// let's wait for the above trivial task to finish
future.get();
System.out.println("Done2");
} catch (InterruptedException | ExecutionException e) {
throw new IllegalStateException(e);
}
*/
}
public static void assertCommunicationThread() {
@ -107,6 +126,7 @@ public class LinkManager {
ConnectionWatchdog.onDataArrived();
}
});
public static LinkConnector connector;
/**
@ -162,10 +182,6 @@ public class LinkManager {
return connector.unpack(packet);
}
public static boolean hasError() {
return connector.hasError();
}
public static String unpackConfirmation(String message) {
if (message.startsWith(CommandQueue.CONFIRMATION_PREFIX))
return message.substring(CommandQueue.CONFIRMATION_PREFIX.length());

View File

@ -0,0 +1,11 @@
package com.rusefi.io.serial;
public enum BaudRateHolder {
INSTANCE;
/**
* Nasty code: this field is not final, we have UI which overrides this default!
*/
public int baudRate = 115200;
}

View File

@ -7,6 +7,7 @@ import com.rusefi.io.CommunicationLoggingHolder;
import com.rusefi.io.ConnectionStateListener;
import com.opensr5.io.DataListener;
import com.rusefi.io.IoStream;
import com.rusefi.io.LinkManager;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@ -19,26 +20,32 @@ import java.awt.*;
* (c) Andrey Belomutskiy
*/
public class PortHolder {
/**
* Nasty code: this field is not final, we have UI which overrides this default!
*/
public static int BAUD_RATE = 115200;
private static PortHolder instance = new PortHolder();
private static final DataListener dataListener = freshData -> LinkManager.engineState.processNewData(new String(freshData), LinkManager.ENCODER);
public ConnectionStateListener listener;
private final Object portLock = new Object();
@Nullable
private BinaryProtocol bp;
private PortHolder() {
protected PortHolder() {
}
@Nullable
private IoStream serialPort;
public String port;
boolean openPort(String port, DataListener dataListener, ConnectionStateListener listener) {
CommunicationLoggingHolder.communicationLoggingListener.onPortHolderMessage(SerialManager.class, "Opening port: " + port);
boolean connectAndReadConfiguration() {
if (port == null)
return false;
boolean result = open(port, dataListener);
CommunicationLoggingHolder.communicationLoggingListener.onPortHolderMessage(getClass(), "Opening port: " + port);
IoStream stream = SerialIoStreamJSerialComm.openPort(port);
synchronized (portLock) {
bp = BinaryProtocolHolder.getInstance().create(FileLog.LOGGER, stream);
portLock.notifyAll();
}
boolean result = bp.connectAndReadConfiguration(dataListener);
if (listener != null) {
if (result) {
listener.onConnectionEstablished();
@ -49,35 +56,12 @@ public class PortHolder {
return result;
}
/**
* @return true if everything fine
*/
private boolean open(String port, final DataListener listener) {
EstablishConnection establishConnection = new EstablishConnection(port).invoke();
if (!establishConnection.isConnected())
return false;
synchronized (portLock) {
PortHolder.this.serialPort = establishConnection.stream;
portLock.notifyAll();
}
IoStream stream = establishConnection.getStream();
bp = BinaryProtocolHolder.create(FileLog.LOGGER, stream);
return bp.connectAndReadConfiguration(listener);
}
private static boolean isWindows10() {
// todo: this code is fragile! What about Windows 11, 12 etc!? this is a problem for the later day :(
return System.getProperty(FileLog.OS_VERSION).startsWith("10");
}
public void close() {
synchronized (portLock) {
if (serialPort != null) {
if (bp != null) {
try {
serialPort.close();
serialPort = null;
bp.close();
bp = null;
} finally {
portLock.notifyAll();
}
@ -85,6 +69,11 @@ public class PortHolder {
}
}
@Nullable
public BinaryProtocol getBp() {
return bp;
}
/**
* this method blocks till a connection is available
*/
@ -99,41 +88,4 @@ public class PortHolder {
bp.doSend(command, fireEvent);
}
public static PortHolder getInstance() {
return instance;
}
public static class EstablishConnection {
private boolean isConnected;
private String port;
private IoStream stream;
public EstablishConnection(String port) {
this.port = port;
}
// todo: remove dead code - always true?
public boolean isConnected() {
return isConnected;
}
public IoStream getStream() {
return stream;
}
public EstablishConnection invoke() {
stream = SerialIoStreamJSerialComm.open(port, BAUD_RATE, FileLog.LOGGER);
/*
todo: remove dead code
if (stream == null) {
isConnected = false;
return this;
}
*/
isConnected = true;
return this;
}
}
}

View File

@ -1,6 +1,7 @@
package com.rusefi.io.serial;
import com.rusefi.FileLog;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.core.MessagesCentral;
import com.rusefi.io.ConnectionStateListener;
import com.rusefi.io.LinkConnector;
@ -11,43 +12,44 @@ import com.rusefi.io.LinkManager;
* 3/3/14
*/
public class SerialConnector implements LinkConnector {
private final PortHolder portHolder = new PortHolder();
public SerialConnector(String serialPort) {
SerialManager.port = serialPort;
portHolder.port = serialPort;
}
@Override
public void connect(ConnectionStateListener listener) {
FileLog.MAIN.logLine("SerialConnector: connecting");
SerialManager.listener = listener;
portHolder.listener = listener;
FileLog.MAIN.logLine("scheduleOpening");
LinkManager.COMMUNICATION_EXECUTOR.execute(new Runnable() {
LinkManager.execute(new Runnable() {
@Override
public void run() {
FileLog.MAIN.logLine("scheduleOpening>openPort");
PortHolder.getInstance().openPort(SerialManager.port, SerialManager.dataListener, SerialManager.listener);
portHolder.connectAndReadConfiguration();
}
});
}
@Override
public BinaryProtocol getBinaryProtocol() {
return portHolder.getBp();
}
@Override
public void restart() {
LinkManager.COMMUNICATION_EXECUTOR.execute(new Runnable() {
LinkManager.execute(new Runnable() {
@Override
public void run() {
MessagesCentral.getInstance().postMessage(SerialManager.class, "Restarting serial IO");
// if (closed)
// return;
PortHolder.getInstance().close();
PortHolder.getInstance().openPort(SerialManager.port, SerialManager.dataListener, SerialManager.listener);
MessagesCentral.getInstance().postMessage(getClass(), "Restarting serial IO");
portHolder.close();
portHolder.connectAndReadConfiguration();
}
});
}
@Override
public boolean hasError() {
return false;
}
@Override
public String unpack(String packet) {
return packet;
@ -55,6 +57,6 @@ public class SerialConnector implements LinkConnector {
@Override
public void send(String text, boolean fireEvent) throws InterruptedException {
PortHolder.getInstance().packAndSend(text, fireEvent);
portHolder.packAndSend(text, fireEvent);
}
}

View File

@ -5,6 +5,7 @@ import com.fazecast.jSerialComm.SerialPortDataListener;
import com.fazecast.jSerialComm.SerialPortEvent;
import com.opensr5.Logger;
import com.opensr5.io.DataListener;
import com.rusefi.FileLog;
import com.rusefi.io.IoStream;
import org.jetbrains.annotations.NotNull;
@ -67,14 +68,16 @@ public class SerialIoStreamJSerialComm implements IoStream {
sp.writeBytes(bytes, bytes.length);
}
public static IoStream openPort(String port) {
return openPort(port, BaudRateHolder.INSTANCE.baudRate, FileLog.LOGGER);
}
@NotNull
public static IoStream open(String port, int baudRate, Logger logger) {
private static IoStream openPort(String port, int baudRate, Logger logger) {
logger.info("[SerialIoStreamJSerialComm] " + port);
SerialPort sp = SerialPort.getCommPort(port);
sp.setBaudRate(baudRate);
sp.openPort();
return new SerialIoStreamJSerialComm(sp);
}
}

View File

@ -1,59 +0,0 @@
package com.rusefi.io.serial;
import com.rusefi.io.ConnectionStateListener;
import com.opensr5.io.DataListener;
import com.rusefi.io.LinkManager;
/**
* 7/9/13
* (c) Andrey Belomutskiy
*/
class SerialManager {
public static String port;
// private static boolean closed;
static DataListener dataListener = new DataListener() {
public void onDataArrived(byte freshData[]) {
// jTextAreaIn.append(string);
LinkManager.engineState.processNewData(new String(freshData), LinkManager.ENCODER);
}
};
public static ConnectionStateListener listener;
/*
static String[] findSerialPorts() {
List<String> result = new ArrayList<String>();
Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier.getPortIdentifiers();
while (portEnum.hasMoreElements()) {
CommPortIdentifier portIdentifier = portEnum.nextElement();
System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType()));
if (portIdentifier.getPortType() == CommPortIdentifier.PORT_SERIAL)
result.add(portIdentifier.getName());
}
return result.toArray(new String[result.size()]);
}
static String getPortTypeName(int portType) {
switch (portType) {
case CommPortIdentifier.PORT_I2C:
return "I2C";
case CommPortIdentifier.PORT_PARALLEL:
return "Parallel";
case CommPortIdentifier.PORT_RAW:
return "Raw";
case CommPortIdentifier.PORT_RS485:
return "RS485";
case CommPortIdentifier.PORT_SERIAL:
return "Serial";
default:
return "unknown type";
}
}
*/
// public static void close() {
// closed = true;
// SerialIO.getInstance().stop();
// }
}

View File

@ -111,7 +111,7 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
short offset = dis.readShort();
short count = dis.readShort(); // no swap here? interesting!
System.out.println("CRC check " + page + "/" + offset + "/" + count);
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
int result = IoHelper.getCrc32(bp.getController().getContent(), offset, count);
ByteArrayOutputStream response = new ByteArrayOutputStream();
response.write(TS_OK.charAt(0));
@ -127,7 +127,7 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
FileLog.MAIN.logLine("Error: negative read request " + offset + "/" + count);
} else {
System.out.println("read " + page + "/" + offset + "/" + count);
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
byte[] response = new byte[1 + count];
response[0] = (byte) TS_OK.charAt(0);
System.arraycopy(bp.getController().getContent(), offset, response, 1, count);
@ -141,7 +141,7 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
byte[] response = new byte[1 + Fields.TS_OUTPUT_SIZE];
response[0] = (byte) TS_OK.charAt(0);
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
byte[] currentOutputs = bp.currentOutputs;
if (currentOutputs != null)
System.arraycopy(currentOutputs, 1, response, 1, Fields.TS_OUTPUT_SIZE);

View File

@ -37,6 +37,10 @@ public class TcpConnector implements LinkConnector {
}
}
public BinaryProtocol getBinaryProtocol() {
return bp;
}
public static boolean isTcpPort(String port) {
try {
getTcpPort(port);
@ -118,7 +122,7 @@ public class TcpConnector implements LinkConnector {
};
// ioStream.setInputListener(listener1);
bp = BinaryProtocolHolder.create(FileLog.LOGGER, new TcpIoStream(stream, os));
bp = BinaryProtocolHolder.getInstance().create(FileLog.LOGGER, new TcpIoStream(stream, os));
boolean result = bp.connectAndReadConfiguration(listener1);
if (result) {
@ -130,18 +134,11 @@ public class TcpConnector implements LinkConnector {
@Override
public void restart() {
// FileLog.rlog("Restarting on " + port);
}
@Override
public boolean hasError() {
return false;
}
@Override
public String unpack(String packet) {
return packet;
// return EngineState.unpackString(packet);
}
@Override
@ -152,15 +149,6 @@ public class TcpConnector implements LinkConnector {
}
bp.doSend(command, fireEvent);
// String command = LinkManager.encodeCommand(text);
// FileLog.MAIN.logLine("Writing " + command);
// try {
// ioStream.write((command + "\n").getBytes());
// } catch (IOException e) {
// withError = true;
// System.err.println("err in send");
// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
// }
}
public static Collection<String> getAvailablePorts() {

View File

@ -14,7 +14,7 @@ import java.io.ByteArrayOutputStream;
class BinaryProtocolServerSandbox {
public static void main(String[] args) {
TcpIoStream stream = new TcpIoStream(new ByteArrayInputStream(new byte[0]), new ByteArrayOutputStream());
BinaryProtocol bp = BinaryProtocolHolder.create(FileLog.LOGGER, stream);
BinaryProtocol bp = BinaryProtocolHolder.getInstance().create(FileLog.LOGGER, stream);
bp.setController(new ConfigurationImage(new byte[14008]));
bp.currentOutputs = new byte[1 + Fields.TS_OUTPUT_SIZE];
BinaryProtocolServer.start();

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Thu May 14 23:44:58 EDT 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri May 15 21:04:15 EDT 2020
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
@ -653,6 +653,7 @@ public class Fields {
public static final String GAUGE_NAME_AFR = "Air/Fuel Ratio";
public static final String GAUGE_NAME_AIR_FLOW = "MAF air flow";
public static final String GAUGE_NAME_AIR_MASS = "air mass";
public static final String GAUGE_NAME_BARO_PRESSURE = "Barometric pressure";
public static final String GAUGE_NAME_CPU_TEMP = "CPU Temperature";
public static final String GAUGE_NAME_DEBUG_F1 = "debug f1";
public static final String GAUGE_NAME_DEBUG_F2 = "debug f2: iTerm";

View File

@ -57,7 +57,7 @@ public class BenchTestPane {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
BinaryProtocol bp = BinaryProtocolHolder.INSTANCE.get();
BinaryProtocol bp = BinaryProtocolHolder.INSTANCE.getCurrentStreamState();
bp.executeCommand(new byte[]{'r'}, "begin trace", false);
try {

View File

@ -8,8 +8,10 @@ import com.rusefi.core.MessagesCentral;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
import com.rusefi.io.*;
import com.rusefi.io.serial.PortHolder;
import com.rusefi.io.serial.BaudRateHolder;
import com.rusefi.io.serial.SerialConnector;
import com.rusefi.io.serial.SerialIoStreamJSerialComm;
import com.rusefi.maintenance.ExecHelper;
import com.rusefi.maintenance.FirmwareFlasher;
import com.rusefi.maintenance.VersionChecker;
import com.rusefi.ui.*;
@ -31,6 +33,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicReference;
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
@ -46,7 +49,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20200515;
public static final int CONSOLE_VERSION = 20200516;
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", ".");
@ -54,15 +57,21 @@ public class Launcher {
protected static final String PORT_KEY = "port";
protected static final String SPEED_KEY = "speed";
private static final String TOOL_NAME_COMPILE_FSIO_FILE = "compile_fsio_file";
private static final String TOOL_NAME_REBOOT_ECU = "reboot_ecu";
private static final String TOOL_NAME_FIRING_ORDER = "firing_order";
private static final String TOOL_NAME_FUNCTIONAL_TEST = "functional_test";
private static final String TOOL_NAME_PERF_ENUMS = "ptrace_enums";
// todo: rename to something more FSIO-specific? would need to update documentation somewhere
private static final String TOOL_NAME_COMPILE = "compile";
private static final int DEFAULT_TAB_INDEX = 0;
private static final String TOOL_NAME_HEADLESS = "headless";
private static Map<String, ConsoleTool> TOOLS = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
static {
TOOLS.put("help", args -> printTools());
TOOLS.put("headless", Launcher::runHeadless);
TOOLS.put("compile", Launcher::invokeCompileExpressionTool);
TOOLS.put("ptrace_enums", Launcher::runPerfTraceTool);
TOOLS.put("functional_test", Launcher::runFunctionalTest);
TOOLS.put("compile_fsio_file", Launcher::runCompileTool);
TOOLS.put("firing_order", Launcher::runFiringOrderTool);
TOOLS.put("reboot_ecu", args -> sendCommand(Fields.CMD_REBOOT));
TOOLS.put(Fields.CMD_REBOOT_DFU, args -> sendCommand(Fields.CMD_REBOOT_DFU));
}
public static String port;
public static EngineSnifferPanel engineSnifferPanel;
@ -89,7 +98,7 @@ public class Launcher {
FileLog.MAIN.logLine("Hardware: " + FirmwareFlasher.getHardwareKind());
getConfig().getRoot().setProperty(PORT_KEY, port);
getConfig().getRoot().setProperty(SPEED_KEY, PortHolder.BAUD_RATE);
getConfig().getRoot().setProperty(SPEED_KEY, BaudRateHolder.INSTANCE.baudRate);
LinkManager.start(port);
@ -191,60 +200,26 @@ public class Launcher {
/**
* rusEfi console entry point
*
* @see StartupFrame if no parameters specified
*/
public static void main(final String[] args) throws Exception {
String toolName = args.length == 0 ? null : args[0];
if (TOOL_NAME_HEADLESS.equalsIgnoreCase(toolName)) {
runHeadless();
if (args.length > 0) {
ConsoleTool consoleTool = TOOLS.get(toolName);
if (consoleTool != null) {
consoleTool.runTool(args);
return;
}
if (TOOL_NAME_FUNCTIONAL_TEST.equals(toolName)) {
// passing port argument if it was specified
String[] toolArgs = args.length == 1 ? new String[0] : new String[]{args[1]};
RealHwTest.main(toolArgs);
return;
}
if (TOOL_NAME_COMPILE_FSIO_FILE.equalsIgnoreCase(toolName)) {
int returnCode = invokeCompileFileTool(args);
System.exit(returnCode);
}
printTools();
if (TOOL_NAME_COMPILE.equals(toolName)) {
invokeCompileExpressionTool(args);
System.exit(0);
}
if (TOOL_NAME_FIRING_ORDER.equals(toolName)) {
FiringOrderTSLogic.invoke(args[1]);
System.exit(0);
}
if (TOOL_NAME_PERF_ENUMS.equals(toolName)) {
PerfTraceTool.readPerfTrace(args[1], args[2], args[3], args[4]);
System.exit(0);
}
System.out.println("Optional tools: " + Arrays.asList(TOOL_NAME_COMPILE_FSIO_FILE,
TOOL_NAME_COMPILE,
TOOL_NAME_REBOOT_ECU,
TOOL_NAME_FIRING_ORDER));
System.out.println("Starting rusEfi UI console " + CONSOLE_VERSION);
FileLog.MAIN.start();
if (TOOL_NAME_REBOOT_ECU.equalsIgnoreCase(toolName)) {
sendCommand(Fields.CMD_REBOOT);
return;
}
if (Fields.CMD_REBOOT_DFU.equalsIgnoreCase(toolName)) {
sendCommand(Fields.CMD_REBOOT_DFU);
return;
}
getConfig().load();
FileLog.suspendLogging = getConfig().getRoot().getBoolProperty(GaugesPanel.DISABLE_LOGS);
@ -257,7 +232,40 @@ public class Launcher {
});
}
private static void runHeadless() {
private static void runPerfTraceTool(String[] args) throws IOException {
PerfTraceTool.readPerfTrace(args[1], args[2], args[3], args[4]);
}
private static void runFiringOrderTool(String[] args) throws IOException {
FiringOrderTSLogic.invoke(args[1]);
}
private static void runCompileTool(String[] args) throws IOException {
int returnCode = invokeCompileFileTool(args);
System.exit(returnCode);
}
private static void runFunctionalTest(String[] args) throws InterruptedException {
// passing port argument if it was specified
String[] toolArgs = args.length == 1 ? new String[0] : new String[]{args[1]};
RealHwTest.main(toolArgs);
}
private static void runHeadless(String[] args) {
String onConnectedCallback = args.length > 1 ? args[1] : null;
String onDisconnectedCallback = args.length > 2 ? args[2] : null;
ConnectionStatusLogic.INSTANCE.addListener(new ConnectionStatusLogic.Listener() {
@Override
public void onConnectionStatus(boolean isConnected) {
if (isConnected) {
invokeCallback(onConnectedCallback);
} else {
invokeCallback(onDisconnectedCallback);
}
}
});
String autoDetectedPort = PortDetector.autoDetectSerial();
if (autoDetectedPort == null) {
System.err.println("rusEFI not detected");
@ -276,6 +284,21 @@ public class Launcher {
});
}
private static void invokeCallback(String callback) {
if (callback == null)
return;
ExecHelper.submitAction(new Runnable() {
@Override
public void run() {
try {
Runtime.getRuntime().exec(callback);
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}, "callback");
}
private static int invokeCompileFileTool(String[] args) throws IOException {
/**
* re-packaging array which contains input and output file names
@ -287,10 +310,7 @@ public class Launcher {
String autoDetectedPort = autoDetectPort();
if (autoDetectedPort == null)
return;
PortHolder.EstablishConnection establishConnection = new PortHolder.EstablishConnection(autoDetectedPort).invoke();
if (!establishConnection.isConnected())
return;
IoStream stream = establishConnection.getStream();
IoStream stream = SerialIoStreamJSerialComm.openPort(autoDetectedPort);
byte[] commandBytes = BinaryProtocol.getTextCommandBytes(command);
stream.sendPacket(commandBytes, FileLog.LOGGER);
}
@ -341,7 +361,7 @@ public class Launcher {
boolean isPortDefined = args.length > 0;
boolean isBaudRateDefined = args.length > 1;
if (isBaudRateDefined)
PortHolder.BAUD_RATE = Integer.parseInt(args[1]);
BaudRateHolder.INSTANCE.baudRate = Integer.parseInt(args[1]);
String port = null;
if (isPortDefined)
@ -371,4 +391,14 @@ public class Launcher {
public static Frame getFrame() {
return staticFrame;
}
private static void printTools() {
for (String key : TOOLS.keySet()) {
System.out.println("Tool available: " + key);
}
}
interface ConsoleTool {
void runTool(String args[]) throws Exception;
}
}

View File

@ -149,7 +149,7 @@ public class SensorLogger {
logFile.write("Captured " + FileLog.getDate() + "\r\n");
int debugMode = -1;
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
if (bp != null) {
ConfigurationImage ci = bp.getController();
if (ci != null) {

View File

@ -2,6 +2,7 @@ package com.rusefi;
import com.rusefi.autodetect.PortDetector;
import com.rusefi.io.LinkManager;
import com.rusefi.io.serial.BaudRateHolder;
import com.rusefi.io.serial.PortHolder;
import com.rusefi.maintenance.*;
import com.rusefi.ui.util.HorizontalLine;
@ -112,7 +113,7 @@ public class StartupFrame {
connectButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PortHolder.BAUD_RATE = Integer.parseInt((String) comboSpeeds.getSelectedItem());
BaudRateHolder.INSTANCE.baudRate = Integer.parseInt((String) comboSpeeds.getSelectedItem());
String selectedPort = comboPorts.getSelectedItem().toString();
if (SerialPortScanner.AUTO_SERIAL.equals(selectedPort)) {
String autoDetectedPort = PortDetector.autoDetectPort(StartupFrame.this.frame);

View File

@ -32,7 +32,7 @@ public class TableEditorPane extends JPanel {
add(editor.getContent());
BinaryProtocol instance = BinaryProtocolHolder.getInstance().get();
BinaryProtocol instance = BinaryProtocolHolder.getInstance().getCurrentStreamState();
if (instance == null)
throw new NullPointerException("instance");
ConfigurationImage image = instance.getController();

View File

@ -73,7 +73,7 @@ public class UploadChanges {
final ConfigurationImage ci2 = ConfigurationImageFile.readFromFile("rusefi_configuration.bin");
final BinaryProtocol bp = BinaryProtocolHolder.create(logger, new SerialIoStreamJSSC(serialPort, logger));
final BinaryProtocol bp = BinaryProtocolHolder.getInstance().create(logger, new SerialIoStreamJSSC(serialPort, logger));
bp.setController(ci1);
scheduleUpload(ci2);
@ -86,11 +86,11 @@ public class UploadChanges {
public static void scheduleUpload(final ConfigurationImage newVersion, final Runnable afterUpload) {
JFrame frame = wnd.getFrame();
frame.setVisible(true);
LinkManager.COMMUNICATION_EXECUTOR.execute(new Runnable() {
LinkManager.execute(new Runnable() {
@Override
public void run() {
try {
BinaryProtocolHolder.getInstance().get().uploadChanges(newVersion, logger);
BinaryProtocolHolder.getInstance().getCurrentStreamState().uploadChanges(newVersion, logger);
if (afterUpload != null)
afterUpload.run();
} catch (InterruptedException | EOFException | SerialPortException e) {

View File

@ -6,7 +6,7 @@ import com.rusefi.binaryprotocol.BinaryProtocolCommands;
import com.rusefi.binaryprotocol.IncomingDataBuffer;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.IoStream;
import com.rusefi.io.serial.PortHolder;
import com.rusefi.io.serial.SerialIoStreamJSerialComm;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
@ -27,10 +27,7 @@ class SerialAutoChecker implements Runnable {
@Override
public void run() {
PortHolder.EstablishConnection establishConnection = new PortHolder.EstablishConnection(serialPort).invoke();
if (!establishConnection.isConnected())
return;
IoStream stream = establishConnection.getStream();
IoStream stream = SerialIoStreamJSerialComm.openPort(serialPort);
Logger logger = FileLog.LOGGER;
IncomingDataBuffer incomingData = new IncomingDataBuffer(logger);
stream.setInputListener(incomingData::addData);

View File

@ -32,7 +32,7 @@ public class BinaryProtocolCmdSandbox {
if (!opened) {
logger.error("failed to open " + port);
}
BinaryProtocol bp = BinaryProtocolHolder.create(logger, new SerialIoStreamJSSC(serialPort, logger));
BinaryProtocol bp = BinaryProtocolHolder.getInstance().create(logger, new SerialIoStreamJSSC(serialPort, logger));
SerialIoStreamJSSC.setupPort(serialPort, 38400);
logger.info("Binary looks good!");

View File

@ -7,7 +7,7 @@ import com.rusefi.autodetect.PortDetector;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.config.generated.Fields;
import com.rusefi.io.IoStream;
import com.rusefi.io.serial.PortHolder;
import com.rusefi.io.serial.BaudRateHolder;
import com.rusefi.io.serial.SerialIoStreamJSerialComm;
import com.rusefi.ui.StatusWindow;
import com.rusefi.ui.util.URLLabel;
@ -50,7 +50,7 @@ public class DfuFlasher {
JOptionPane.showMessageDialog(Launcher.getFrame(), "rusEfi serial port not detected");
return;
}
IoStream stream = SerialIoStreamJSerialComm.open(port, PortHolder.BAUD_RATE, FileLog.LOGGER);
IoStream stream = SerialIoStreamJSerialComm.openPort(port);
byte[] command = BinaryProtocol.getTextCommandBytes(Fields.CMD_REBOOT_DFU);
try {
stream.sendPacket(command, FileLog.LOGGER);

View File

@ -76,7 +76,7 @@ public class ExecHelper {
return error.toString();
}
protected static void submitAction(Runnable runnable, String threadName) {
public static void submitAction(Runnable runnable, String threadName) {
Thread thread = new Thread(runnable, threadName);
thread.setDaemon(true);
thread.start();

View File

@ -105,7 +105,7 @@ public class FormulasPane {
}
private void updateFormula() {
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
if (bp == null)
return;
ConfigurationImage ci = bp.getController();

View File

@ -136,7 +136,7 @@ public class FuelTunePane {
private void uploadCurrentResult() {
byte[] newVeMap = FuelTunePane.this.newVeMap;
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
if (newVeMap == null || bp == null)
return;
ConfigurationImage ci = bp.getController().clone();
@ -313,7 +313,7 @@ public class FuelTunePane {
}
private byte[] reloadVeTable() {
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
byte[] content = bp.getController().getContent();
loadData(veTable.getXAxis(), content, veRpmOffset);
@ -329,7 +329,7 @@ public class FuelTunePane {
}
private void loadArray(double[] array, int offset) {
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
if (bp == null) {
FileLog.MAIN.logLine("bp not ready");
return;

View File

@ -28,7 +28,7 @@ public abstract class BaseConfigField {
}
private void processInitialValue(Field field) {
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
if (bp == null)
return;
ConfigurationImage ci = bp.getController();

View File

@ -111,7 +111,7 @@ public class MainFrame {
root.setProperty(Launcher.TAB_INDEX, tabbedPane.tabbedPane.getSelectedIndex());
GaugesPanel.DetachedRepository.INSTANCE.saveConfig();
getConfig().save();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
BinaryProtocol bp = BinaryProtocolHolder.getInstance().getCurrentStreamState();
if (bp != null && !bp.isClosed)
bp.close(); // it could be that serial driver wants to be closed explicitly
System.exit(0);

View File

@ -83,6 +83,7 @@ TEST(sensors, testCamInput) {
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
engineConfiguration->vvtMode = VVT_FIRST_HALF;
engineConfiguration->vvtOffset = 720;
eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX);
engineConfiguration->camInputs[0] = GPIOA_10; // we just need to indicate that we have CAM
@ -113,7 +114,7 @@ TEST(sensors, testCamInput) {
// asserting that error code has cleared
ASSERT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testCamInput #3";
ASSERT_NEAR(-181, engine->triggerCentral.getVVTPosition(), EPS3D);
ASSERT_NEAR(720 - 181, engine->triggerCentral.getVVTPosition(), EPS3D);
}
TEST(sensors, testNB2CamInput) {