auto-sync

This commit is contained in:
rusEfi 2014-12-28 11:03:29 -06:00
parent 6e86ae5e82
commit 848a6963d2
12 changed files with 87 additions and 21 deletions

View File

@ -360,6 +360,10 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
engineConfiguration->bc.fsio_setting[0] = 0.2;
setFsioExt(engineConfiguration, 0, GPIOE_5, "0 fsio_setting", 400);
boardConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED;
engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
engineConfiguration->hasVehicleSpeedSensor = true;
// engineConfiguration->isCanEnabled = true;
boardConfiguration->canTxPin = GPIOB_6;
boardConfiguration->canRxPin = GPIOB_12;

View File

@ -29,7 +29,7 @@
#include "ec2.h"
#include "adc_inputs.h"
#if EFI_WAVE_ANALYZER
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
#include "wave_analyzer.h"
#endif
@ -54,7 +54,7 @@
#include "engine.h"
#include "lcd_controller.h"
#if EFI_PROD_CODE
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// todo: move this logic to algo folder!
#include "rtc_helper.h"
#include "lcd_HD44780.h"
@ -62,6 +62,7 @@
#include "pin_repository.h"
#include "flash_main.h"
#include "max31855.h"
#include "vehicle_speed.h"
#endif
// this 'true' value is needed for simulator
@ -73,7 +74,7 @@ extern board_configuration_s *boardConfiguration;
extern bool hasFirmwareErrorFlag;
#define FULL_LOGGING_KEY "fl"
#if EFI_PROD_CODE || EFI_SIMULATOR
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
static Logging logger;
static void setWarningEnabled(int value) {
@ -82,25 +83,25 @@ static void setWarningEnabled(int value) {
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
#if EFI_FILE_LOGGING
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
static Logging fileLogger;
#endif /* EFI_FILE_LOGGING */
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);
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
#if EFI_FILE_LOGGING
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
debugFloat(&fileLogger, caption, value, precision);
#endif /* EFI_FILE_LOGGING */
}
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);
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
#if EFI_FILE_LOGGING
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
debugInt(&fileLogger, caption, value);
#endif /* EFI_FILE_LOGGING */
}
@ -110,7 +111,7 @@ static const char* boolean2string(int value) {
}
void printSensors(Engine *engine) {
#if EFI_FILE_LOGGING
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
resetLogging(&fileLogger);
#endif /* EFI_FILE_LOGGING */
@ -134,7 +135,11 @@ void printSensors(Engine *engine) {
if (engineConfiguration->hasAfrSensor) {
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("vbatt", getVBatt(engineConfiguration), 2);
@ -151,7 +156,7 @@ void printSensors(Engine *engine) {
// debugFloat(&logger, "tch", getTCharge1(tps), 2);
#if EFI_FILE_LOGGING
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
appendPrintf(&fileLogger, "\r\n");
appendToLog(fileLogger.buffer);
#endif /* EFI_FILE_LOGGING */
@ -205,7 +210,7 @@ static void printStatus(void) {
*/
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) {
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,
getConfigurationName(engineConfiguration->engineType),
DELIMETER);
#if EFI_PROD_CODE
#if EFI_PROD_CODE || defined(__DOXYGEN__)
printOutPin(WC_CRANK1, boardConfiguration->triggerInputPins[0]);
printOutPin(WC_CRANK2, boardConfiguration->triggerInputPins[1]);
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
@ -261,7 +266,7 @@ void updateDevConsoleState(Engine *engine) {
// checkIfShouldHalt();
printPending();
#if EFI_PROD_CODE
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// todo: unify with simulator!
if (hasFirmwareError()) {
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_activated = engine->isCylinderCleanupMode;
tsOutputChannels->secondTriggerChannelEnabled = engineConfiguration->secondTriggerChannelEnabled;
tsOutputChannels->vehicleSpeedKph = getVehicleSpeed();
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature(engine));
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature(engine));
#endif

View File

@ -407,6 +407,7 @@ typedef struct {
*/
float fanOffTemperature;
// offset 960
brain_pin_e vehicleSpeedSensorInputPin;
/**
@ -504,6 +505,7 @@ typedef struct {
bool_t hasCltSensor : 1; // bit 6
bool_t canReadEnabled : 1; // bit 7
bool_t canWriteEnabled : 1; // bit 8
bool_t hasVehicleSpeedSensor : 1; // bit 9
int unused6284;

View File

@ -16,6 +16,7 @@
#include "engine_state.h"
#include "can_header.h"
#include "engine_configuration.h"
#include "vehicle_speed.h"
#if EFI_CAN_SUPPORT || defined(__DOXYGEN__)
@ -122,8 +123,7 @@ static void canMazdaRX8(void) {
commonTxInit(CAN_MAZDA_RX_RPM_SPEED);
float mph = 123;
float kph = mph * 1.60934;
float kph = getVehicleSpeed();
setShortValue(&txmsg, SWAP_UINT16(engine_rpm * 4), 0);
setShortValue(&txmsg, 0xFFFF, 2);

View File

@ -16,6 +16,7 @@
#include "adc_inputs.h"
#include "stepper.h"
#include "vehicle_speed.h"
#include "trigger_input.h"
#include "eficonsole.h"
@ -331,6 +332,8 @@ void initHardware(Logging *logger, Engine *engine) {
// }
// }
initVehicleSpeed(logger);
printMsg(logger, "initHardware() OK!");
}

View File

@ -6,8 +6,54 @@
*/
#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);
}

View File

@ -10,6 +10,7 @@
#include "main.h"
void initVehicleSpeed(void);
float getVehicleSpeed(void);
void initVehicleSpeed(Logging *logger);
#endif /* HW_LAYER_VEHICLE_SPEED_H_ */

View File

@ -265,5 +265,5 @@ int getRusEfiVersion(void) {
return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE == 0)
return 1; // this is here to make the compiler happy about the unused array
return 20141227;
return 20141228;
}

View File

@ -452,6 +452,7 @@ fileVersion = { 20141225 }
ind_check_engine= bits, U32, 72, [8:8], "true", "false";
ind_need_burn = bits, U32, 72, [9:9], "true", "false";
ind_2nd_trigger_en=bits, U32, 72, [10:10], "true", "false";
vehicleSpeedKph = scalar, F32, 76, "kph", 1, 0.0;
ind_tps_error = bits, U32, 80, [0:0], "true", "false";
ind_clt_error = bits, U32, 80, [1:1], "true", "false";
@ -594,6 +595,7 @@ fileVersion = { 20141225 }
; accelEnrichGauge = accDecEnrich, "Accel Enrich", "%", 50, 150, -1, -1, 999, 999, 0, 0
dwellGauge = sparkDwell, "Dwell", "mSec", 0, 10, 0.5, 1.0, 6.0, 8.0, 1, 1
egt0Gauge = egt0, "EGT#0", "C", 0, 2000
vssGauge = vehicleSpeedKph, "Speed", "kmh", 0, 200, 0, 1, 3, 4, 1, 1
[FrontPage]
; Gauges are numbered left to right, top to bottom.
@ -650,6 +652,7 @@ fileVersion = { 20141225 }
entry = pulseWidth, "injPulse", float, "%.3f"
entry = baseFuel, "baseFuel", float, "%.2f"
entry = ign_adv, "ignAdv", float, "%.2f"
entry = vehicleSpeedKph, "speed", float, "%.2f"
; tpsADC = U16, "ADC",
; alignmet = U16, "al",

View File

@ -23,6 +23,7 @@ public enum Sensor {
AFR("A/F ratio", SensorCategory.SENSOR_INPUTS, "", 0, 20),
MAF("MAF", SensorCategory.SENSOR_INPUTS, "Volts", 4),
TPS("throttle", SensorCategory.SENSOR_INPUTS, "%", 100),
VSS("Speed", SensorCategory.SENSOR_INPUTS, "kph", 100),
TRG_0_DUTY("trg0 duty", SensorCategory.SENSOR_INPUTS, "%", 100),
TRG_1_DUTY("trg1 duty", SensorCategory.SENSOR_INPUTS, "%", 100),

View File

@ -90,6 +90,7 @@ public class SensorCentral {
addDoubleSensor("clt", Sensor.CLT, es);
addDoubleSensor("tp", Sensor.TPS, es);
addDoubleSensor(Sensor.VSS, es);
addDoubleSensor(Sensor.DWELL0, es);
addDoubleSensor(Sensor.DWELL1, es);
addDoubleSensor(Sensor.DWELL2, es);

View File

@ -19,7 +19,7 @@ import javax.swing.*;
* @see WavePanel
*/
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;
private final String port;