auto-sync
This commit is contained in:
parent
f35d2cca07
commit
f3309b58b5
|
@ -72,7 +72,6 @@ extern bool_t main_loop_started;
|
|||
#endif
|
||||
|
||||
extern engine_pins_s enginePins;
|
||||
extern TriggerCentral triggerCentral;
|
||||
|
||||
static bool_t subscription[(int) RO_LAST_ELEMENT];
|
||||
|
||||
|
@ -242,13 +241,13 @@ static void printState(void) {
|
|||
if (subscription[(int) RO_TOTAL_REVOLUTION_COUNTER])
|
||||
debugInt(&logger, "ckp_c", getCrankEventCounter());
|
||||
if (subscription[(int) RO_RUNNING_REVOLUTION_COUNTER])
|
||||
debugInt(&logger, "ckp_r", triggerCentral.triggerState.runningRevolutionCounter);
|
||||
debugInt(&logger, "ckp_r", engine->triggerCentral.triggerState.runningRevolutionCounter);
|
||||
|
||||
if (subscription[(int) RO_RUNNING_TRIGGER_ERROR])
|
||||
debugInt(&logger, "trg_r_errors", triggerCentral.triggerState.runningTriggerErrorCounter);
|
||||
debugInt(&logger, "trg_r_errors", engine->triggerCentral.triggerState.runningTriggerErrorCounter);
|
||||
|
||||
if (subscription[(int) RO_RUNNING_ORDERING_TRIGGER_ERROR])
|
||||
debugInt(&logger, "trg_r_order_errors", triggerCentral.triggerState.runningOrderingErrorCounter);
|
||||
debugInt(&logger, "trg_r_order_errors", engine->triggerCentral.triggerState.runningOrderingErrorCounter);
|
||||
|
||||
if (subscription[(int) RO_WAVE_CHART_CURRENT_SIZE])
|
||||
debugInt(&logger, "wave_chart_current", 0);
|
||||
|
@ -590,7 +589,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->currentMapAccelDelta = engine->mapAccelEnrichment.getMapEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
|
||||
tsOutputChannels->tpsAccelFuel = engine->tpsAccelEnrichment.getTpsEnrichment(PASS_ENGINE_PARAMETER_F);
|
||||
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta();
|
||||
tsOutputChannels->triggerErrorsCounter = triggerCentral.triggerState.totalTriggerErrorCounter;
|
||||
tsOutputChannels->triggerErrorsCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter;
|
||||
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
|
||||
tsOutputChannels->pedalPosition = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_F) ? getPedalPosition(PASS_ENGINE_PARAMETER_F) : 0;
|
||||
tsOutputChannels->knockCount = engine->knockCount;
|
||||
|
@ -598,7 +597,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
|||
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER);
|
||||
tsOutputChannels->fuelLevel = engine->engineState.fuelLevel;
|
||||
tsOutputChannels->hasFatalError = hasFirmwareError();
|
||||
tsOutputChannels->totalTriggerErrorCounter = triggerCentral.triggerState.totalTriggerErrorCounter;
|
||||
tsOutputChannels->totalTriggerErrorCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter;
|
||||
tsOutputChannels->wallFuelAmount = wallFuel.getWallFuel(0);
|
||||
tsOutputChannels->totalFuelCorrection = engine->totalFuelCorrection;
|
||||
tsOutputChannels->wallFuelCorrection = engine->wallFuelCorrection;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "table_helper.h"
|
||||
#include "listener_array.h"
|
||||
#include "accel_enrichment.h"
|
||||
#include "trigger_central.h"
|
||||
|
||||
/**
|
||||
* This class knows about when to inject fuel
|
||||
|
@ -190,6 +191,8 @@ public:
|
|||
AccelEnrichmemnt mapAccelEnrichment;
|
||||
AccelEnrichmemnt tpsAccelEnrichment;
|
||||
|
||||
TriggerCentral triggerCentral;
|
||||
|
||||
/**
|
||||
* Fuel injection duration for current engine cycle, without wall wetting
|
||||
*/
|
||||
|
|
|
@ -559,6 +559,7 @@ typedef enum {
|
|||
*/
|
||||
SC_TRIGGER = 1, SC_MAP = 2,
|
||||
SC_RPM_ACCEL = 3,
|
||||
SC_DETAILED_RPM = 4,
|
||||
|
||||
Internal_ForceMyEnumIntSize_sensor_chart = ENUM_32_BITS,
|
||||
} sensor_chart_e;
|
||||
|
|
|
@ -32,21 +32,21 @@
|
|||
WaveChart waveChart;
|
||||
#endif /* EFI_ENGINE_SNIFFER */
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
static histogram_s triggerCallback;
|
||||
|
||||
// we need this initial to have not_running at first invocation
|
||||
static volatile efitime_t previousShaftEventTimeNt = (efitimems_t) -10 * US2NT(US_PER_SECOND_LL);
|
||||
|
||||
TriggerCentral triggerCentral;
|
||||
|
||||
static Logging *logger;
|
||||
|
||||
efitime_t getCrankEventCounter() {
|
||||
return triggerCentral.triggerState.getTotalEventCounter();
|
||||
efitime_t getCrankEventCounter(DECLARE_ENGINE_PARAMETER_F) {
|
||||
return engine->triggerCentral.triggerState.getTotalEventCounter();
|
||||
}
|
||||
|
||||
efitime_t getStartOfRevolutionIndex() {
|
||||
return triggerCentral.triggerState.getStartOfRevolutionIndex();
|
||||
efitime_t getStartOfRevolutionIndex(DECLARE_ENGINE_PARAMETER_F) {
|
||||
return engine->triggerCentral.triggerState.getStartOfRevolutionIndex();
|
||||
}
|
||||
|
||||
void TriggerCentral::addEventListener(ShaftPositionListener listener, const char *name, Engine *engine) {
|
||||
|
@ -61,7 +61,7 @@ void TriggerCentral::addEventListener(ShaftPositionListener listener, const char
|
|||
* that would be 116 events: 58 SHAFT_PRIMARY_UP and 58 SHAFT_PRIMARY_DOWN events.
|
||||
*/
|
||||
void addTriggerEventListener(ShaftPositionListener listener, const char *name, Engine *engine) {
|
||||
triggerCentral.addEventListener(listener, name, engine);
|
||||
engine->triggerCentral.addEventListener(listener, name, engine);
|
||||
}
|
||||
|
||||
uint32_t triggerHanlderEntryTime;
|
||||
|
@ -84,7 +84,7 @@ void hwHandleShaftSignal(trigger_event_e signal) {
|
|||
maxTriggerReentraint = triggerReentraint;
|
||||
triggerReentraint++;
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#8");
|
||||
triggerCentral.handleShaftSignal(signal PASS_ENGINE_PARAMETER);
|
||||
engine->triggerCentral.handleShaftSignal(signal PASS_ENGINE_PARAMETER);
|
||||
triggerReentraint--;
|
||||
triggerDuration = GET_TIMESTAMP() - triggerHanlderEntryTime;
|
||||
isInsideTriggerHandler = false;
|
||||
|
@ -97,6 +97,7 @@ TriggerCentral::TriggerCentral() {
|
|||
nowNt = 0;
|
||||
memset(hwEventCounters, 0, sizeof(hwEventCounters));
|
||||
clearCallbacks(&triggerListeneres);
|
||||
triggerState.reset();
|
||||
}
|
||||
|
||||
int TriggerCentral::getHwEventCounter(int index) {
|
||||
|
@ -304,12 +305,12 @@ void triggerInfo(void) {
|
|||
engineConfiguration->trigger.customSkippedToothCount);
|
||||
}
|
||||
|
||||
scheduleMsg(logger, "trigger#1 event counters up=%d/down=%d", triggerCentral.getHwEventCounter(0),
|
||||
triggerCentral.getHwEventCounter(1));
|
||||
scheduleMsg(logger, "trigger#1 event counters up=%d/down=%d", engine->triggerCentral.getHwEventCounter(0),
|
||||
engine->triggerCentral.getHwEventCounter(1));
|
||||
|
||||
if (engine->triggerShape.needSecondTriggerInput) {
|
||||
scheduleMsg(logger, "trigger#2 event counters up=%d/down=%d", triggerCentral.getHwEventCounter(2),
|
||||
triggerCentral.getHwEventCounter(3));
|
||||
scheduleMsg(logger, "trigger#2 event counters up=%d/down=%d", engine->triggerCentral.getHwEventCounter(2),
|
||||
engine->triggerCentral.getHwEventCounter(3));
|
||||
}
|
||||
scheduleMsg(logger, "expected cycle events %d/%d/%d", ts->expectedEventCount[0],
|
||||
engine->triggerShape.expectedEventCount[1], ts->expectedEventCount[2]);
|
||||
|
@ -320,8 +321,8 @@ void triggerInfo(void) {
|
|||
|
||||
scheduleMsg(logger, "synchronizationNeeded=%s/isError=%s/total errors=%d ord_err=%d/total revolutions=%d/self=%s",
|
||||
boolToString(ts->isSynchronizationNeeded),
|
||||
boolToString(isTriggerDecoderError()), triggerCentral.triggerState.totalTriggerErrorCounter,
|
||||
triggerCentral.triggerState.orderingErrorCounter, triggerCentral.triggerState.getTotalRevolutionCounter(),
|
||||
boolToString(isTriggerDecoderError()), engine->triggerCentral.triggerState.totalTriggerErrorCounter,
|
||||
engine->triggerCentral.triggerState.orderingErrorCounter, engine->triggerCentral.triggerState.getTotalRevolutionCounter(),
|
||||
boolToString(engineConfiguration->directSelfStimulation));
|
||||
|
||||
if (ts->isSynchronizationNeeded) {
|
||||
|
@ -385,13 +386,15 @@ void triggerInfo(void) {
|
|||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
#if ! EFI_UNIT_TEST
|
||||
float getTriggerDutyCycle(int index) {
|
||||
return triggerCentral.triggerState.getTriggerDutyCycle(index);
|
||||
return engine->triggerCentral.triggerState.getTriggerDutyCycle(index);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void resetRunningTriggerCounters() {
|
||||
triggerCentral.resetCounters();
|
||||
#if EFI_PROD_CODE
|
||||
#if !EFI_UNIT_TEST
|
||||
engine->triggerCentral.resetCounters();
|
||||
triggerInfo();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class Engine;
|
|||
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index DECLARE_ENGINE_PARAMETER_S);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "engine.h"
|
||||
class Engine;
|
||||
|
||||
#define HW_EVENT_TYPES 6
|
||||
|
||||
|
@ -37,8 +37,8 @@ private:
|
|||
#endif
|
||||
|
||||
void triggerInfo(void);
|
||||
efitime_t getCrankEventCounter(void);
|
||||
efitime_t getStartOfRevolutionIndex(void);
|
||||
efitime_t getCrankEventCounter(DECLARE_ENGINE_PARAMETER_F);
|
||||
efitime_t getStartOfRevolutionIndex(DECLARE_ENGINE_PARAMETER_F);
|
||||
void hwHandleShaftSignal(trigger_event_e signal);
|
||||
float getTriggerDutyCycle(int index);
|
||||
void initTriggerCentral(Logging *sharedLogger, Engine *engine);
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "sensor_chart.h"
|
||||
#endif
|
||||
|
||||
extern TriggerCentral triggerCentral;
|
||||
static OutputPin triggerDecoderErrorPin;
|
||||
|
||||
EXTERN_ENGINE
|
||||
|
@ -282,7 +281,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
// todo: angle diff should be pre-calculated
|
||||
fixAngle(angleDiff);
|
||||
|
||||
float r = (angleDiff / 360.0) / (NT2US(time) / 60000000.0);
|
||||
float r = (60000000.0 / 360 * US_TO_NT_MULTIPLIER) * angleDiff / time;
|
||||
|
||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
||||
scAddData(currentAngle, r);
|
||||
|
@ -483,7 +482,7 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET
|
|||
return;
|
||||
}
|
||||
wave.checkSwitchTimes(getSize());
|
||||
calculateTriggerSynchPoint(&triggerCentral.triggerState PASS_ENGINE_PARAMETER);
|
||||
calculateTriggerSynchPoint(&engine->triggerCentral.triggerState PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
TriggerStimulatorHelper::TriggerStimulatorHelper() {
|
||||
|
|
|
@ -460,8 +460,8 @@ custom fsio_setting_t 4 scalar, F32, @OFFSET@, "Val", 1, 0, 0,
|
|||
brain_pin_e joystickCPin;
|
||||
brain_pin_e joystickDPin;
|
||||
|
||||
#define sensor_chart_e_enum "none", "trigger", "MAP", "RPM ACCEL", "INVALID"
|
||||
custom sensor_chart_e 4 bits, S32, @OFFSET@, [0:1], @@sensor_chart_e_enum@@
|
||||
#define sensor_chart_e_enum "none", "trigger", "MAP", "RPM ACCEL", "DETAILED RPM", "INVALID"
|
||||
custom sensor_chart_e 4 bits, S32, @OFFSET@, [0:2], @@sensor_chart_e_enum@@
|
||||
sensor_chart_e sensorChartMode;
|
||||
|
||||
#define ego_sensor_e_enum "BPSX", "Innovate", "14Point7", "Narrow", "PLX"
|
||||
|
|
|
@ -40,7 +40,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated by ConfigDefinition.jar on Sat Sep 12 17:18:32 EDT 2015
|
||||
; this section was generated by ConfigDefinition.jar on Sun Sep 13 16:57:36 EDT 2015
|
||||
|
||||
pageSize = 15288
|
||||
page = 1
|
||||
|
@ -365,7 +365,7 @@ page = 1
|
|||
joystickBPin = bits, U32, 1396, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
joystickCPin = bits, U32, 1400, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
joystickDPin = bits, U32, 1404, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
sensorChartMode = bits, S32, 1408, [0:1], "none", "trigger", "MAP", "RPM ACCEL", "INVALID"
|
||||
sensorChartMode = bits, S32, 1408, [0:2], "none", "trigger", "MAP", "RPM ACCEL", "DETAILED RPM", "INVALID"
|
||||
;skipping mafSensorType offset 1412
|
||||
vehicleSpeedSensorInputPin = bits, U32, 1416, [0:6], "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PA5", "INVALID", "INVALID", "PA8", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PC6", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "PE5", "INVALID", "PE7", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
clutchUpPin = bits, U32, 1420, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.config;
|
||||
|
||||
// this file was generated automatically by ConfigDefinition.jar Sat Sep 12 17:18:32 EDT 2015
|
||||
// this file was generated automatically by ConfigDefinition.jar Sun Sep 13 16:57:36 EDT 2015
|
||||
public class Fields {
|
||||
public static final Field ENGINETYPE = new Field("ENGINETYPE", 0, FieldType.INT);
|
||||
public static final Field HEADERMAGICVALUE = new Field("HEADERMAGICVALUE", 4, FieldType.INT);
|
||||
|
@ -320,7 +320,7 @@ public class Fields {
|
|||
public static final Field JOYSTICKBPIN = new Field("JOYSTICKBPIN", 1396, FieldType.INT, brain_pin_e);
|
||||
public static final Field JOYSTICKCPIN = new Field("JOYSTICKCPIN", 1400, FieldType.INT, brain_pin_e);
|
||||
public static final Field JOYSTICKDPIN = new Field("JOYSTICKDPIN", 1404, FieldType.INT, brain_pin_e);
|
||||
public static final String[] sensor_chart_e = {"none", "trigger", "MAP", "RPM ACCEL", "INVALID"};
|
||||
public static final String[] sensor_chart_e = {"none", "trigger", "MAP", "RPM ACCEL", "DETAILED RPM", "INVALID"};
|
||||
public static final Field SENSORCHARTMODE = new Field("SENSORCHARTMODE", 1408, FieldType.INT, sensor_chart_e);
|
||||
public static final Field MAFSENSORTYPE = new Field("MAFSENSORTYPE", 1412, FieldType.INT);
|
||||
public static final Field VEHICLESPEEDSENSORINPUTPIN = new Field("VEHICLESPEEDSENSORINPUTPIN", 1416, FieldType.INT, brain_input_pin_e);
|
||||
|
|
|
@ -51,9 +51,9 @@ void EngineTestHelper::fireTriggerEvents() {
|
|||
for (int i = 0; i < 24; i++) {
|
||||
timeNow += 5000; // 5ms
|
||||
board_configuration_s * boardConfiguration = &engine.engineConfiguration->bc;
|
||||
triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
timeNow += 5000;
|
||||
triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,6 @@ void EngineTestHelper::initTriggerShapeAndRpmCalculator() {
|
|||
|
||||
incrementGlobalConfigurationVersion();
|
||||
|
||||
triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
||||
engine->triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ public:
|
|||
engine_configuration_s *ec;
|
||||
engine_configuration_s *engineConfiguration;
|
||||
|
||||
TriggerCentral triggerCentral;
|
||||
};
|
||||
|
||||
#endif /* ENGINE_TEST_HELPER_H_ */
|
||||
|
|
|
@ -48,7 +48,7 @@ int getTheAngle(engine_type_e engineType) {
|
|||
initDataStructures(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
TriggerShape * shape = ð.engine.triggerShape;
|
||||
return findTriggerZeroEventIndex(ð.triggerCentral.triggerState, shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER);
|
||||
return findTriggerZeroEventIndex(ð.engine.triggerCentral.triggerState, shape, &engineConfiguration->trigger PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
static void testDodgeNeonDecoder(void) {
|
||||
|
@ -305,11 +305,11 @@ static void testRpmCalculator(void) {
|
|||
|
||||
eth.fireTriggerEvents();
|
||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F));
|
||||
assertEqualsM("index #1", 15, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("index #1", 15, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
|
||||
static MainTriggerCallback triggerCallbackInstance;
|
||||
triggerCallbackInstance.init(ð.engine);
|
||||
eth.triggerCentral.addEventListener(mainTriggerCallback, "main loop", ð.engine);
|
||||
eth.engine.triggerCentral.addEventListener(mainTriggerCallback, "main loop", ð.engine);
|
||||
|
||||
// engine.rpmCalculator = ð.rpmState;
|
||||
prepareTimingMap(PASS_ENGINE_PARAMETER_F);
|
||||
|
@ -322,16 +322,16 @@ static void testRpmCalculator(void) {
|
|||
|
||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
||||
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
|
||||
assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle);
|
||||
assertEqualsM("fuel", 3.03, eth.engine.fuelMs);
|
||||
assertEqualsM("one degree", 111.1111, eth.engine.rpmCalculator.oneDegreeUs);
|
||||
assertEqualsM("size", 6, ilist->size);
|
||||
assertEqualsM("dwell angle", 0, ilist->elements[0].dwellPosition.eventAngle);
|
||||
assertEqualsM("dwell offset", 14.0316, ilist->elements[0].dwellPosition.angleOffset);
|
||||
assertEqualsM("dwell offset", 0, ilist->elements[0].dwellPosition.angleOffset);
|
||||
|
||||
assertEqualsM("index #2", 0, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("index #2", 0, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size/6", 6, schedulingQueue.size());
|
||||
scheduling_s *ev1 = schedulingQueue.getForUnitText(0);
|
||||
assertREquals((void*)ev1->callback, (void*)turnPinHigh);
|
||||
|
@ -341,12 +341,12 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("index #3", 3, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("index #3", 3, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 3", 6, schedulingQueue.size());
|
||||
assertEqualsM("ev 3", 258333, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("ev 4", 258333, schedulingQueue.getForUnitText(1)->momentX);
|
||||
|
@ -355,24 +355,24 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("index #4", 6, eth.triggerCentral.triggerState.getCurrentIndex());
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("index #4", 6, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 4", 6, schedulingQueue.size());
|
||||
assertEqualsM("4/0", 271666, schedulingQueue.getForUnitText(0)->momentX);
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 5", 0, schedulingQueue.size());
|
||||
// assertEqualsM("5/1", 284500, schedulingQueue.getForUnitText(0)->momentUs);
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 6", 6, schedulingQueue.size());
|
||||
assertEqualsM("6/0", 285000, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("6/1", 285000, schedulingQueue.getForUnitText(1)->momentX);
|
||||
|
@ -380,12 +380,12 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 7", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 8", 5, schedulingQueue.size());
|
||||
assertEqualsM("8/0", 298333, schedulingQueue.getForUnitText(0)->momentX);
|
||||
assertEqualsM("8/1", 298333, schedulingQueue.getForUnitText(1)->momentX);
|
||||
|
@ -394,12 +394,12 @@ static void testRpmCalculator(void) {
|
|||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000;
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 9", 1, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
|
||||
timeNow += 5000; // 5ms
|
||||
eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||
assertEqualsM("queue size 10", 0, schedulingQueue.size());
|
||||
schedulingQueue.clear();
|
||||
}
|
||||
|
@ -482,8 +482,8 @@ void testTriggerDecoder(void) {
|
|||
eth.persistentConfig.engineConfiguration.bc.sensorChartMode = SC_RPM_ACCEL;
|
||||
applyNonPersistentConfiguration(NULL PASS_ENGINE_PARAMETER);
|
||||
|
||||
// assertEqualsM("abc", 0, eth.triggerCentral.triggerState.instantRpmValue[0]);
|
||||
// assertEqualsM("abc", 0, eth.triggerCentral.triggerState.instantRpmValue[1]);
|
||||
assertEqualsM2("rpm#1", 16666.9746, eth.engine.triggerCentral.triggerState.instantRpmValue[0], 0.5);
|
||||
assertEqualsM2("rpm#2", 16666.3750, eth.engine.triggerCentral.triggerState.instantRpmValue[1], 0.5);
|
||||
|
||||
}
|
||||
// testTriggerDecoder2("miata 1990", MIATA_1990, 0, 0.6280, 0.0);
|
||||
|
|
Loading…
Reference in New Issue