auto-sync
This commit is contained in:
parent
4874cdebe1
commit
642844e6d7
|
@ -360,6 +360,10 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
|
||||||
engineConfiguration->bc.fsio_setting[0] = 0.2;
|
engineConfiguration->bc.fsio_setting[0] = 0.2;
|
||||||
setFsioExt(engineConfiguration, 0, GPIOE_5, "0 fsio_setting", 400);
|
setFsioExt(engineConfiguration, 0, GPIOE_5, "0 fsio_setting", 400);
|
||||||
|
|
||||||
|
boardConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED;
|
||||||
|
engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
|
||||||
|
engineConfiguration->hasVehicleSpeedSensor = true;
|
||||||
|
|
||||||
// engineConfiguration->isCanEnabled = true;
|
// engineConfiguration->isCanEnabled = true;
|
||||||
boardConfiguration->canTxPin = GPIOB_6;
|
boardConfiguration->canTxPin = GPIOB_6;
|
||||||
boardConfiguration->canRxPin = GPIOB_12;
|
boardConfiguration->canRxPin = GPIOB_12;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "ec2.h"
|
#include "ec2.h"
|
||||||
|
|
||||||
#include "adc_inputs.h"
|
#include "adc_inputs.h"
|
||||||
#if EFI_WAVE_ANALYZER
|
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
||||||
#include "wave_analyzer.h"
|
#include "wave_analyzer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "lcd_controller.h"
|
#include "lcd_controller.h"
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
// todo: move this logic to algo folder!
|
// todo: move this logic to algo folder!
|
||||||
#include "rtc_helper.h"
|
#include "rtc_helper.h"
|
||||||
#include "lcd_HD44780.h"
|
#include "lcd_HD44780.h"
|
||||||
|
@ -62,6 +62,7 @@
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#include "max31855.h"
|
#include "max31855.h"
|
||||||
|
#include "vehicle_speed.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// this 'true' value is needed for simulator
|
// this 'true' value is needed for simulator
|
||||||
|
@ -73,7 +74,7 @@ extern board_configuration_s *boardConfiguration;
|
||||||
extern bool hasFirmwareErrorFlag;
|
extern bool hasFirmwareErrorFlag;
|
||||||
#define FULL_LOGGING_KEY "fl"
|
#define FULL_LOGGING_KEY "fl"
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
||||||
static Logging logger;
|
static Logging logger;
|
||||||
|
|
||||||
static void setWarningEnabled(int value) {
|
static void setWarningEnabled(int value) {
|
||||||
|
@ -82,25 +83,25 @@ static void setWarningEnabled(int value) {
|
||||||
|
|
||||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||||
|
|
||||||
#if EFI_FILE_LOGGING
|
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||||
static Logging fileLogger;
|
static Logging fileLogger;
|
||||||
#endif /* EFI_FILE_LOGGING */
|
#endif /* EFI_FILE_LOGGING */
|
||||||
|
|
||||||
static void reportSensorF(const char *caption, float value, int precision) {
|
static void reportSensorF(const char *caption, float value, int precision) {
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
||||||
debugFloat(&logger, caption, value, precision);
|
debugFloat(&logger, caption, value, precision);
|
||||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||||
|
|
||||||
#if EFI_FILE_LOGGING
|
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||||
debugFloat(&fileLogger, caption, value, precision);
|
debugFloat(&fileLogger, caption, value, precision);
|
||||||
#endif /* EFI_FILE_LOGGING */
|
#endif /* EFI_FILE_LOGGING */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reportSensorI(const char *caption, int value) {
|
static void reportSensorI(const char *caption, int value) {
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
||||||
debugInt(&logger, caption, value);
|
debugInt(&logger, caption, value);
|
||||||
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
|
||||||
#if EFI_FILE_LOGGING
|
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||||
debugInt(&fileLogger, caption, value);
|
debugInt(&fileLogger, caption, value);
|
||||||
#endif /* EFI_FILE_LOGGING */
|
#endif /* EFI_FILE_LOGGING */
|
||||||
}
|
}
|
||||||
|
@ -110,7 +111,7 @@ static const char* boolean2string(int value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void printSensors(Engine *engine) {
|
void printSensors(Engine *engine) {
|
||||||
#if EFI_FILE_LOGGING
|
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||||
resetLogging(&fileLogger);
|
resetLogging(&fileLogger);
|
||||||
#endif /* EFI_FILE_LOGGING */
|
#endif /* EFI_FILE_LOGGING */
|
||||||
|
|
||||||
|
@ -134,7 +135,11 @@ void printSensors(Engine *engine) {
|
||||||
if (engineConfiguration->hasAfrSensor) {
|
if (engineConfiguration->hasAfrSensor) {
|
||||||
reportSensorF("afr", getAfr(), 2);
|
reportSensorF("afr", getAfr(), 2);
|
||||||
}
|
}
|
||||||
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
|
if (engineConfiguration->hasVehicleSpeedSensor) {
|
||||||
|
reportSensorF("vss", getVehicleSpeed(), 2);
|
||||||
|
}
|
||||||
|
#endif /* EFI_PROD_CODE */
|
||||||
reportSensorF("vref", getVRef(engineConfiguration), 2);
|
reportSensorF("vref", getVRef(engineConfiguration), 2);
|
||||||
reportSensorF("vbatt", getVBatt(engineConfiguration), 2);
|
reportSensorF("vbatt", getVBatt(engineConfiguration), 2);
|
||||||
|
|
||||||
|
@ -151,7 +156,7 @@ void printSensors(Engine *engine) {
|
||||||
|
|
||||||
// debugFloat(&logger, "tch", getTCharge1(tps), 2);
|
// debugFloat(&logger, "tch", getTCharge1(tps), 2);
|
||||||
|
|
||||||
#if EFI_FILE_LOGGING
|
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
|
||||||
appendPrintf(&fileLogger, "\r\n");
|
appendPrintf(&fileLogger, "\r\n");
|
||||||
appendToLog(fileLogger.buffer);
|
appendToLog(fileLogger.buffer);
|
||||||
#endif /* EFI_FILE_LOGGING */
|
#endif /* EFI_FILE_LOGGING */
|
||||||
|
@ -205,7 +210,7 @@ static void printStatus(void) {
|
||||||
*/
|
*/
|
||||||
static systime_t timeOfPreviousPrintVersion = (systime_t) -1;
|
static systime_t timeOfPreviousPrintVersion = (systime_t) -1;
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
static void printOutPin(const char *pinName, brain_pin_e hwPin) {
|
static void printOutPin(const char *pinName, brain_pin_e hwPin) {
|
||||||
appendPrintf(&logger, "outpin%s%s@%s%s", DELIMETER, pinName, hwPortname(hwPin), DELIMETER);
|
appendPrintf(&logger, "outpin%s%s@%s%s", DELIMETER, pinName, hwPortname(hwPin), DELIMETER);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +230,7 @@ static void printInfo(Engine *engine, systime_t nowSeconds) {
|
||||||
appendPrintf(&logger, "rusEfiVersion%s%d@%s %s%s", DELIMETER, getRusEfiVersion(), VCS_VERSION,
|
appendPrintf(&logger, "rusEfiVersion%s%d@%s %s%s", DELIMETER, getRusEfiVersion(), VCS_VERSION,
|
||||||
getConfigurationName(engineConfiguration->engineType),
|
getConfigurationName(engineConfiguration->engineType),
|
||||||
DELIMETER);
|
DELIMETER);
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
printOutPin(WC_CRANK1, boardConfiguration->triggerInputPins[0]);
|
printOutPin(WC_CRANK1, boardConfiguration->triggerInputPins[0]);
|
||||||
printOutPin(WC_CRANK2, boardConfiguration->triggerInputPins[1]);
|
printOutPin(WC_CRANK2, boardConfiguration->triggerInputPins[1]);
|
||||||
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
||||||
|
@ -261,7 +266,7 @@ void updateDevConsoleState(Engine *engine) {
|
||||||
// checkIfShouldHalt();
|
// checkIfShouldHalt();
|
||||||
printPending();
|
printPending();
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
// todo: unify with simulator!
|
// todo: unify with simulator!
|
||||||
if (hasFirmwareError()) {
|
if (hasFirmwareError()) {
|
||||||
printMsg(&logger, "firmware error: %s", errorMessageBuffer);
|
printMsg(&logger, "firmware error: %s", errorMessageBuffer);
|
||||||
|
@ -476,7 +481,7 @@ void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputC
|
||||||
tsOutputChannels->cylinder_cleanup_enabled = engineConfiguration->isCylinderCleanupEnabled;
|
tsOutputChannels->cylinder_cleanup_enabled = engineConfiguration->isCylinderCleanupEnabled;
|
||||||
tsOutputChannels->cylinder_cleanup_activated = engine->isCylinderCleanupMode;
|
tsOutputChannels->cylinder_cleanup_activated = engine->isCylinderCleanupMode;
|
||||||
tsOutputChannels->secondTriggerChannelEnabled = engineConfiguration->secondTriggerChannelEnabled;
|
tsOutputChannels->secondTriggerChannelEnabled = engineConfiguration->secondTriggerChannelEnabled;
|
||||||
|
tsOutputChannels->vehicleSpeedKph = getVehicleSpeed();
|
||||||
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engine));
|
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engine));
|
||||||
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(engine));
|
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(engine));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -407,6 +407,7 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
float fanOffTemperature;
|
float fanOffTemperature;
|
||||||
|
|
||||||
|
// offset 960
|
||||||
brain_pin_e vehicleSpeedSensorInputPin;
|
brain_pin_e vehicleSpeedSensorInputPin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -504,6 +505,7 @@ typedef struct {
|
||||||
bool_t hasCltSensor : 1; // bit 6
|
bool_t hasCltSensor : 1; // bit 6
|
||||||
bool_t canReadEnabled : 1; // bit 7
|
bool_t canReadEnabled : 1; // bit 7
|
||||||
bool_t canWriteEnabled : 1; // bit 8
|
bool_t canWriteEnabled : 1; // bit 8
|
||||||
|
bool_t hasVehicleSpeedSensor : 1; // bit 9
|
||||||
|
|
||||||
int unused6284;
|
int unused6284;
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "engine_state.h"
|
#include "engine_state.h"
|
||||||
#include "can_header.h"
|
#include "can_header.h"
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
|
#include "vehicle_speed.h"
|
||||||
|
|
||||||
#if EFI_CAN_SUPPORT || defined(__DOXYGEN__)
|
#if EFI_CAN_SUPPORT || defined(__DOXYGEN__)
|
||||||
|
|
||||||
|
@ -122,8 +123,7 @@ static void canMazdaRX8(void) {
|
||||||
|
|
||||||
commonTxInit(CAN_MAZDA_RX_RPM_SPEED);
|
commonTxInit(CAN_MAZDA_RX_RPM_SPEED);
|
||||||
|
|
||||||
float mph = 123;
|
float kph = getVehicleSpeed();
|
||||||
float kph = mph * 1.60934;
|
|
||||||
|
|
||||||
setShortValue(&txmsg, SWAP_UINT16(engine_rpm * 4), 0);
|
setShortValue(&txmsg, SWAP_UINT16(engine_rpm * 4), 0);
|
||||||
setShortValue(&txmsg, 0xFFFF, 2);
|
setShortValue(&txmsg, 0xFFFF, 2);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "adc_inputs.h"
|
#include "adc_inputs.h"
|
||||||
#include "stepper.h"
|
#include "stepper.h"
|
||||||
|
#include "vehicle_speed.h"
|
||||||
|
|
||||||
#include "trigger_input.h"
|
#include "trigger_input.h"
|
||||||
#include "eficonsole.h"
|
#include "eficonsole.h"
|
||||||
|
@ -331,6 +332,8 @@ void initHardware(Logging *logger, Engine *engine) {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
initVehicleSpeed(logger);
|
||||||
|
|
||||||
printMsg(logger, "initHardware() OK!");
|
printMsg(logger, "initHardware() OK!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,54 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vehicle_speed.h"
|
#include "vehicle_speed.h"
|
||||||
|
#include "engine.h"
|
||||||
|
#include "wave_analyzer_hw.h"
|
||||||
|
#include "pin_repository.h"
|
||||||
|
|
||||||
void initVehicleSpeed(void) {
|
EXTERN_ENGINE
|
||||||
|
;
|
||||||
|
|
||||||
|
static Logging *logger;
|
||||||
|
|
||||||
|
static WaveReaderHw vehicleSpeedInput;
|
||||||
|
|
||||||
|
static uint64_t lastSignalTimeNt = 0;
|
||||||
|
static uint64_t vssDiff = 0;
|
||||||
|
static int vssCounter = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return vehicle speed, in kilometers per hour
|
||||||
|
*/
|
||||||
|
float getVehicleSpeed(void) {
|
||||||
|
uint64_t nowNt = getTimeNowNt();
|
||||||
|
if (nowNt - lastSignalTimeNt > US2NT(US_PER_SECOND_LL))
|
||||||
|
return 0; // previous signal time is too long ago - we are stopped
|
||||||
|
|
||||||
|
return engineConfiguration->vehicleSpeedCoef * US_PER_SECOND_LL / vssDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vsAnaWidthCallback(void) {
|
||||||
|
vssCounter++;
|
||||||
|
uint64_t nowNt = getTimeNowNt();
|
||||||
|
vssDiff = nowNt - lastSignalTimeNt;
|
||||||
|
lastSignalTimeNt = nowNt;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void speedInfo(void) {
|
||||||
|
scheduleMsg(logger, "VSS@%s c=%f eventCounter=%d speed=%f",
|
||||||
|
hwPortname(engineConfiguration->vehicleSpeedSensorInputPin),
|
||||||
|
engineConfiguration->vehicleSpeedCoef,
|
||||||
|
vssCounter,
|
||||||
|
getVehicleSpeed());
|
||||||
|
}
|
||||||
|
|
||||||
|
void initVehicleSpeed(Logging *l) {
|
||||||
|
logger = l;
|
||||||
|
if (engineConfiguration->vehicleSpeedSensorInputPin == GPIO_UNASSIGNED)
|
||||||
|
return;
|
||||||
|
initWaveAnalyzerDriver(&vehicleSpeedInput, engineConfiguration->vehicleSpeedSensorInputPin);
|
||||||
|
startInputDriver(&vehicleSpeedInput, true);
|
||||||
|
|
||||||
|
registerCallback(&vehicleSpeedInput.widthListeners, (IntListener) vsAnaWidthCallback, NULL);
|
||||||
|
addConsoleAction("speedinfo", speedInfo);
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
void initVehicleSpeed(void);
|
float getVehicleSpeed(void);
|
||||||
|
void initVehicleSpeed(Logging *logger);
|
||||||
|
|
||||||
#endif /* HW_LAYER_VEHICLE_SPEED_H_ */
|
#endif /* HW_LAYER_VEHICLE_SPEED_H_ */
|
||||||
|
|
|
@ -265,5 +265,5 @@ int getRusEfiVersion(void) {
|
||||||
return 1; // this is here to make the compiler happy about the unused array
|
return 1; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE == 0)
|
if (UNUSED_CCM_SIZE == 0)
|
||||||
return 1; // this is here to make the compiler happy about the unused array
|
return 1; // this is here to make the compiler happy about the unused array
|
||||||
return 20141227;
|
return 20141228;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ public enum Sensor {
|
||||||
AFR("A/F ratio", SensorCategory.SENSOR_INPUTS, "", 0, 20),
|
AFR("A/F ratio", SensorCategory.SENSOR_INPUTS, "", 0, 20),
|
||||||
MAF("MAF", SensorCategory.SENSOR_INPUTS, "Volts", 4),
|
MAF("MAF", SensorCategory.SENSOR_INPUTS, "Volts", 4),
|
||||||
TPS("throttle", SensorCategory.SENSOR_INPUTS, "%", 100),
|
TPS("throttle", SensorCategory.SENSOR_INPUTS, "%", 100),
|
||||||
|
VSS("Speed", SensorCategory.SENSOR_INPUTS, "kph", 100),
|
||||||
|
|
||||||
TRG_0_DUTY("trg0 duty", SensorCategory.SENSOR_INPUTS, "%", 100),
|
TRG_0_DUTY("trg0 duty", SensorCategory.SENSOR_INPUTS, "%", 100),
|
||||||
TRG_1_DUTY("trg1 duty", SensorCategory.SENSOR_INPUTS, "%", 100),
|
TRG_1_DUTY("trg1 duty", SensorCategory.SENSOR_INPUTS, "%", 100),
|
||||||
|
|
|
@ -90,6 +90,7 @@ public class SensorCentral {
|
||||||
addDoubleSensor("clt", Sensor.CLT, es);
|
addDoubleSensor("clt", Sensor.CLT, es);
|
||||||
addDoubleSensor("tp", Sensor.TPS, es);
|
addDoubleSensor("tp", Sensor.TPS, es);
|
||||||
|
|
||||||
|
addDoubleSensor(Sensor.VSS, es);
|
||||||
addDoubleSensor(Sensor.DWELL0, es);
|
addDoubleSensor(Sensor.DWELL0, es);
|
||||||
addDoubleSensor(Sensor.DWELL1, es);
|
addDoubleSensor(Sensor.DWELL1, es);
|
||||||
addDoubleSensor(Sensor.DWELL2, es);
|
addDoubleSensor(Sensor.DWELL2, es);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import javax.swing.*;
|
||||||
* @see WavePanel
|
* @see WavePanel
|
||||||
*/
|
*/
|
||||||
public class Launcher extends FrameHelper {
|
public class Launcher extends FrameHelper {
|
||||||
public static final int CONSOLE_VERSION = 20141213;
|
public static final int CONSOLE_VERSION = 20141228;
|
||||||
public static final boolean SHOW_STIMULATOR = true;
|
public static final boolean SHOW_STIMULATOR = true;
|
||||||
private final String port;
|
private final String port;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue