auto-sync

This commit is contained in:
rusEfi 2015-02-23 11:08:21 -06:00
parent 68438213ae
commit 74c260b29e
6 changed files with 82 additions and 38 deletions

View File

@ -16,6 +16,15 @@
#include "thermistors.h"
#include "citroenBerlingoTU3JP.h"
void setLCD(board_configuration_s *boardConfiguration) {
boardConfiguration->HD44780_rs = GPIOE_7;
boardConfiguration->HD44780_e = GPIOE_9;
boardConfiguration->HD44780_db4 = GPIOE_11;
boardConfiguration->HD44780_db5 = GPIOE_13;
boardConfiguration->HD44780_db6 = GPIOE_15;
boardConfiguration->HD44780_db7 = GPIOB_10;
}
static const fuel_table_t tps_fuel_table = {
{/*0 engineLoad=0.00*/ /*0 800.0*/4.00, /*1 1213.0*/4.00, /*2 1626.0*/4.00, /*3 2040.0*/4.00, /*4 2453.0*/4.00, /*5 2866.0*/4.00, /*6 3280.0*/4.00, /*7 3693.0*/4.00, /*8 4106.0*/4.00, /*9 4520.0*/4.00, /*10 4933.0*/4.00, /*11 5346.0*/4.00, /*12 5760.0*/4.00, /*13 6173.0*/4.00, /*14 6586.0*/4.00, /*15 7000.0*/4.00},
{/*1 engineLoad=6.66*/ /*0 800.0*/5.07, /*1 1213.0*/5.07, /*2 1626.0*/5.07, /*3 2040.0*/5.07, /*4 2453.0*/5.07, /*5 2866.0*/5.07, /*6 3280.0*/5.07, /*7 3693.0*/5.07, /*8 4106.0*/5.07, /*9 4520.0*/5.07, /*10 4933.0*/5.07, /*11 5346.0*/5.07, /*12 5760.0*/5.07, /*13 6173.0*/5.07, /*14 6586.0*/5.07, /*15 7000.0*/5.07},
@ -125,6 +134,8 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur
boardConfiguration->fuelPumpPin = GPIOB_9;
boardConfiguration->fuelPumpPinMode = OM_DEFAULT;
setLCD(boardConfiguration);
boardConfiguration->fanPin = GPIO_UNASSIGNED;
// boardConfiguration->fanPinMode = OM_DEFAULT;
@ -178,7 +189,7 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur
* vBatt
*/
engineConfiguration->vbattAdcChannel = EFI_ADC_0;
engineConfiguration->vbattDividerCoeff = ((float) (2.6 + 11)) / 2.6 * 2;
engineConfiguration->vbattDividerCoeff = ((float) (2.6 + 10.1)) / 2.6 * 2;
/**
* WBO Innovate LC-1
*/

View File

@ -22,16 +22,23 @@
#include "engine.h"
#include "efiGpio.h"
#if EFI_PROD_CODE
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "rusefi.h"
#include "pin_repository.h"
#include "hardware.h"
#endif /* EFI_PROD_CODE */
#if EFI_INTERNAL_FLASH
#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__)
#include "flash_main.h"
#endif /* EFI_INTERNAL_FLASH */
#if EFI_WAVE_CHART || defined(__DOXYGEN__)
#include "wave_chart.h"
extern int waveChartUsedSize;
extern WaveChart waveChart;
#endif /* EFI_WAVE_CHART */
static char LOGGING_BUFFER[1000];
static Logging logger("settings control", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
@ -93,15 +100,16 @@ static void printOutputs(engine_configuration_s *engineConfiguration) {
hwPortname(boardConfiguration->mainRelayPin));
}
EXTERN_ENGINE;
EXTERN_ENGINE
;
/**
* These should be not very long because these are displayed on the LCD as is
*/
const char* getConfigurationName(engine_type_e engineType) {
switch (engineType) {
case CUSTOM_ENGINE:
return "CUSTOM";
case CUSTOM_ENGINE:
return "CUSTOM";
#if EFI_SUPPORT_DODGE_NEON
case DODGE_NEON_1995:
return "Neon95";
@ -156,12 +164,12 @@ const char* getConfigurationName(engine_type_e engineType) {
return "MX596";
case BMW_E34:
return "BMWe34";
case TEST_ENGINE:
return "Test";
case SACHS:
return "SACHS";
case MAZDA_626:
return "Mazda626";
case TEST_ENGINE:
return "Test";
case SACHS:
return "SACHS";
case MAZDA_626:
return "Mazda626";
default:
firmwareError("Unexpected: engineType %d", engineType);
return NULL;
@ -214,8 +222,7 @@ void printConfiguration(engine_configuration_s *engineConfiguration) {
scheduleMsg(&logger, "fixedModeTiming: %d", (int) engineConfiguration->fixedModeTiming);
scheduleMsg(&logger, "ignitionOffset=%f", engineConfiguration->ignitionBaseAngle);
scheduleMsg(&logger, "injection %s offset=%f/enabled=%s", getInjection_mode_e(engineConfiguration->injectionMode),
(double) engineConfiguration->injectionAngle,
boolToString(engineConfiguration->isInjectionEnabled));
(double) engineConfiguration->injectionAngle, boolToString(engineConfiguration->isInjectionEnabled));
if (engineConfiguration->useConstantDwellDuringCranking) {
scheduleMsg(&logger, "ignitionDwellForCrankingMs=%f", engineConfiguration->ignitionDwellForCrankingMs);
@ -243,11 +250,13 @@ void printConfiguration(engine_configuration_s *engineConfiguration) {
boolToString(engineConfiguration->isManualSpinningMode),
boolToString(engineConfiguration->isCylinderCleanupEnabled));
scheduleMsg(&logger, "clutchUp@%s: %s", hwPortname(engineConfiguration->clutchUpPin), boolToString(engine->clutchUpState));
scheduleMsg(&logger, "clutchDown@%s: %s", hwPortname(boardConfiguration->clutchDownPin), boolToString(engine->clutchDownState));
scheduleMsg(&logger, "clutchUp@%s: %s", hwPortname(engineConfiguration->clutchUpPin),
boolToString(engine->clutchUpState));
scheduleMsg(&logger, "clutchDown@%s: %s", hwPortname(boardConfiguration->clutchDownPin),
boolToString(engine->clutchDownState));
scheduleMsg(&logger, "boardTestModeJumperPin: %s/nesting=%d", hwPortname(boardConfiguration->boardTestModeJumperPin),
maxNesting);
scheduleMsg(&logger, "boardTestModeJumperPin: %s/nesting=%d",
hwPortname(boardConfiguration->boardTestModeJumperPin), maxNesting);
scheduleMsg(&logger, "digitalPotentiometerSpiDevice %d", boardConfiguration->digitalPotentiometerSpiDevice);
@ -266,7 +275,6 @@ static void doPrintConfiguration(Engine *engine) {
printConfiguration(engineConfiguration);
}
static void setFixedModeTiming(int value) {
engineConfiguration->fixedModeTiming = value;
doPrintConfiguration(engine);
@ -282,6 +290,11 @@ static void setTimingMode(int value) {
void setEngineType(int value) {
engineConfiguration->engineType = (engine_type_e) value;
resetConfigurationExt(&logger, (engine_type_e) value, engine);
#if EFI_WAVE_CHART || defined(__DOXYGEN__)
if (engine->isTestMode)
waveChart.resetWaveChart();
#endif
#if EFI_INTERNAL_FLASH
writeToFlashNow();
// scheduleReset();
@ -332,7 +345,7 @@ static void setMalfunctionIndicatorPinMode(int value) {
}
static void setAnalogChartMode(int value) {
boardConfiguration->analogChartMode = (analog_chart_e)value;
boardConfiguration->analogChartMode = (analog_chart_e) value;
doPrintConfiguration(engine);
}
@ -352,8 +365,8 @@ static void printThermistor(const char *msg, Thermistor *thermistor) {
scheduleMsg(&logger, "%s v=%f C=%f R=%f on channel %d", msg, voltage, t, r, adcChannel);
scheduleMsg(&logger, "@%s", getPinNameByAdcChannel(adcChannel, pinNameBuffer));
scheduleMsg(&logger, "bias=%f A=%..100000f B=%..100000f C=%..100000f", thermistor->config->bias_resistor, thermistor->config->s_h_a,
thermistor->config->s_h_b, thermistor->config->s_h_c);
scheduleMsg(&logger, "bias=%f A=%..100000f B=%..100000f C=%..100000f", thermistor->config->bias_resistor,
thermistor->config->s_h_a, thermistor->config->s_h_b, thermistor->config->s_h_c);
//#if EFI_ANALOG_INPUTS
scheduleMsg(&logger, "==============================");
//#endif
@ -362,8 +375,7 @@ static void printThermistor(const char *msg, Thermistor *thermistor) {
#if EFI_PROD_CODE
static void printMAPInfo(void) {
#if EFI_ANALOG_INPUTS
scheduleMsg(&logger, "map type=%d raw=%f MAP=%f", engineConfiguration->map.sensor.type, getRawMap(),
getMap());
scheduleMsg(&logger, "map type=%d raw=%f MAP=%f", engineConfiguration->map.sensor.type, getRawMap(), getMap());
if (engineConfiguration->map.sensor.type == MT_CUSTOM) {
scheduleMsg(&logger, "at0=%f at5=%f", engineConfiguration->map.sensor.valueAt0,
engineConfiguration->map.sensor.valueAt5);
@ -380,7 +392,7 @@ static void printMAPInfo(void) {
static void printTPSInfo(void) {
#if (EFI_PROD_CODE && HAL_USE_ADC) || defined(__DOXYGEN__)
if(!engineConfiguration->hasTpsSensor) {
if (!engineConfiguration->hasTpsSensor) {
scheduleMsg(&logger, "NO TPS SENSOR");
return;
}
@ -395,7 +407,6 @@ static void printTPSInfo(void) {
getTpsRateOfChange());
}
static void printTemperatureInfo(void) {
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
printThermistor("CLT", &engine->clt);
@ -502,7 +513,7 @@ static void setCltBias(float value) {
}
static void setFanSetting(float onTempC, float offTempC) {
if(onTempC <= offTempC) {
if (onTempC <= offTempC) {
scheduleMsg(&logger, "ON temp [%f] should be above OFF temp [%f]", onTempC, offTempC);
return;
}
@ -846,10 +857,6 @@ void stopEngine(void) {
engine->stopEngineRequestTimeNt = getTimeNowNt();
}
#if EFI_WAVE_CHART
extern int waveChartUsedSize;
#endif
static void printAllInfo(void) {
printTemperatureInfo();
printTPSInfo();
@ -910,7 +917,7 @@ void initSettings(engine_configuration_s *engineConfiguration) {
addConsoleActionI("set_rpm_hard_limit", setRpmHardLimit);
addConsoleActionI("set_firing_order", setFiringOrder);
addConsoleActionI("set_algorithm", setAlgorithm);
addConsoleAction("stopengine", (Void)stopEngine);
addConsoleAction("stopengine", (Void) stopEngine);
// todo: refactor this - looks like all boolean flags should be controlled with less code duplication
addConsoleAction("enable_injection", enableInjection);

View File

@ -46,7 +46,8 @@ void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIn
// print("hello %d\r\n", chTimeNow());
}
EXTERN_ENGINE;
EXTERN_ENGINE
;
/*
* todo: should we simply re-use instances used by trigger_decoder?
@ -71,7 +72,13 @@ static bool isEmulating = true;
static Logging *logger;
static LocalVersionHolder emulatorConfigVersion;
EXTERN_ENGINE;
EXTERN_ENGINE
;
#if EFI_WAVE_CHART
#include "wave_chart.h"
extern WaveChart waveChart;
#endif /* EFI_WAVE_CHART */
void setTriggerEmulatorRPM(int rpm, Engine *engine) {
engineConfiguration->bc.triggerSimulatorFrequency = rpm;
@ -85,6 +92,11 @@ void setTriggerEmulatorRPM(int rpm, Engine *engine) {
float gRpm = rpm * engineConfiguration->rpmMultiplier / 60.0; // per minute converted to per second
triggerSignal.periodNt = US2NT(frequency2periodUs(gRpm));
}
#if EFI_WAVE_CHART
if (engine->isTestMode)
waveChart.resetWaveChart();
#endif /* EFI_WAVE_CHART */
scheduleMsg(logger, "Emulating position sensor(s). RPM=%d", rpm);
}
@ -142,8 +154,8 @@ void initTriggerEmulatorLogic(Logging *sharedLogger, Engine *engine) {
triggerSignal.weComplexInit("position sensor", s->getSize(), s->wave.switchTimes, PWM_PHASE_MAX_WAVE_PER_PWM,
pinStates, updateTriggerShapeIfNeeded, emulatorApplyPinState);
addConsoleActionIP("rpm", (VoidIntVoidPtr)setTriggerEmulatorRPM, engine);
addConsoleActionIP("stop_stimulator_at_index", (VoidIntVoidPtr)setEmulatorAtIndex, engine);
addConsoleActionIP("rpm", (VoidIntVoidPtr) setTriggerEmulatorRPM, engine);
addConsoleActionIP("stop_stimulator_at_index", (VoidIntVoidPtr) setEmulatorAtIndex, engine);
addConsoleActionP("resume_stimulator", (VoidPtr) resumeStimulator, engine);
}
#endif

View File

@ -64,6 +64,14 @@ static Logging debugLogging;
static LoggingWithStorage logger("wave info");
#if ! EFI_UNIT_TEST
extern WaveChart waveChart;
static void resetWaveChartNow(void) {
waveChart.resetWaveChart();
}
#endif
void WaveChart::resetWaveChart() {
#if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "reset while at ", counter);
@ -242,6 +250,9 @@ void initWaveChart(WaveChart *chart) {
addConsoleActionI("chartsize", setChartSize);
addConsoleActionI("chart", setChartActive);
#if ! EFI_UNIT_TEST
addConsoleAction("reset_wave_chart", resetWaveChartNow);
#endif
}
#endif /* EFI_WAVE_CHART */

View File

@ -123,8 +123,11 @@ public class AutoTest {
setEngineType(2);
WaveChart chart;
sendCommand("set_whole_fuel_map 3");
IoUtil.changeRpm(2000);
sendCommand("set_ignition_mode 1");
/**
* note that command order matters - RPM change resets wave chart
*/
IoUtil.changeRpm(2000);
chart = nextChart();
String msg = "1995 Neon";

View File

@ -30,7 +30,7 @@ public class TestingUtils {
}
private static String printRange(double current, double ratio) {
return " expected range from " + current * (1 - ratio) + " to " + current + (1 + ratio);
return " expected range from " + current * (1 - ratio) + " to " + current * (1 + ratio);
}
private static double fixAngle(double angle) {