auto-sync
This commit is contained in:
parent
80db0ae56d
commit
f50b86e2df
|
@ -29,6 +29,8 @@ static void setDefaultCrankingFuel(engine_configuration_s *engineConfiguration)
|
|||
|
||||
static void common079721_2351(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
|
||||
|
||||
engineConfiguration->digitalChartSize = 150;
|
||||
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
|
||||
|
@ -57,7 +59,7 @@ static void common079721_2351(engine_configuration_s *engineConfiguration, board
|
|||
}
|
||||
|
||||
void setMiata1990(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
|
||||
engineConfiguration->triggerConfig.triggerType = TT_FORD_ESCORT_GT;
|
||||
engineConfiguration->triggerConfig.triggerType = TT_MAZDA_MIATA_NA;
|
||||
|
||||
common079721_2351(engineConfiguration, boardConfiguration);
|
||||
|
||||
|
|
|
@ -23,13 +23,10 @@
|
|||
#include "algo.h"
|
||||
#include "advance_map.h"
|
||||
#include "fuel_math.h"
|
||||
#include "wave_chart.h"
|
||||
#include "settings.h"
|
||||
#include "signal_executor.h"
|
||||
#include "speed_density.h"
|
||||
|
||||
WaveChart waveChart;
|
||||
|
||||
void initDataStructures(engine_configuration_s *engineConfiguration) {
|
||||
prepareFuelMap();
|
||||
prepareTimingMap();
|
||||
|
@ -41,8 +38,4 @@ void initAlgo(engine_configuration_s *engineConfiguration) {
|
|||
initSettings();
|
||||
initSignalExecutor();
|
||||
#endif
|
||||
|
||||
#if EFI_WAVE_CHART
|
||||
initWaveChart(&waveChart);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -166,12 +166,13 @@ void printConfiguration(engine_configuration_s *engineConfiguration, engine_conf
|
|||
|
||||
scheduleMsg(&logger, "crankingRpm: %d", engineConfiguration->crankingSettings.crankingRpm);
|
||||
|
||||
scheduleMsg(&logger, "analogInputDividerCoefficient: %f", engineConfiguration->analogInputDividerCoefficient);
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
scheduleMsg(&logger, "idlePinMode: %s", pinModeToString(boardConfiguration->idleValvePinMode));
|
||||
scheduleMsg(&logger, "malfunctionIndicatorPinMode: %s",
|
||||
pinModeToString(boardConfiguration->malfunctionIndicatorPinMode));
|
||||
scheduleMsg(&logger, "analogInputDividerCoefficient: %f", engineConfiguration->analogInputDividerCoefficient);
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
scheduleMsg(&logger, "idleValvePin: %s", hwPortname(boardConfiguration->idleValvePin));
|
||||
scheduleMsg(&logger, "fuelPumpPin: mode %s @ %s", pinModeToString(boardConfiguration->fuelPumpPinMode),
|
||||
hwPortname(boardConfiguration->fuelPumpPin));
|
||||
|
|
|
@ -102,8 +102,6 @@ static int isNoisySignal(RpmCalculator * rpmState, uint64_t nowUs) {
|
|||
return diff < 40; // that's 40us
|
||||
}
|
||||
|
||||
static char shaft_signal_msg_index[15];
|
||||
|
||||
/**
|
||||
* @brief Shaft position callback used by RPM calculation logic.
|
||||
*
|
||||
|
@ -112,20 +110,6 @@ static char shaft_signal_msg_index[15];
|
|||
* This callback is invoked on interrupt thread.
|
||||
*/
|
||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, int index, RpmCalculator *rpmState) {
|
||||
itoa10(&shaft_signal_msg_index[1], index);
|
||||
if (ckpSignalType == SHAFT_PRIMARY_UP) {
|
||||
addWaveChartEvent(WC_CRANK1, WC_UP, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_PRIMARY_DOWN) {
|
||||
addWaveChartEvent(WC_CRANK1, WC_DOWN, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_SECONDARY_UP) {
|
||||
addWaveChartEvent(WC_CRANK2, WC_UP, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_SECONDARY_DOWN) {
|
||||
addWaveChartEvent(WC_CRANK2, WC_DOWN, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_3RD_UP) {
|
||||
addWaveChartEvent(WC_CRANK3, WC_UP, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_3RD_DOWN) {
|
||||
addWaveChartEvent(WC_CRANK3, WC_DOWN, (char*) shaft_signal_msg_index);
|
||||
}
|
||||
|
||||
if (index != 0) {
|
||||
#if EFI_ANALOG_CHART || defined(__DOXYGEN__)
|
||||
|
@ -222,8 +206,6 @@ void initRpmCalculator(void) {
|
|||
addTriggerEventListener(&tdcMarkCallback, "chart TDC mark", NULL);
|
||||
#endif
|
||||
|
||||
strcpy((char*) shaft_signal_msg_index, "_");
|
||||
|
||||
addTriggerEventListener((ShaftPositionListener)&rpmShaftPositionCallback, "rpm reporter", &rpmState);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,17 @@
|
|||
#include "engine_configuration.h"
|
||||
#include "listener_array.h"
|
||||
#include "data_buffer.h"
|
||||
#include "pin_repository.h"
|
||||
#include "histogram.h"
|
||||
#include "wave_chart.h"
|
||||
|
||||
#include "rpm_calculator.h"
|
||||
#if EFI_PROD_CODE
|
||||
#include "rfiutil.h"
|
||||
#include "pin_repository.h"
|
||||
#endif
|
||||
|
||||
WaveChart waveChart;
|
||||
|
||||
static histogram_s triggerCallback;
|
||||
|
||||
// we need this initial to have not_running at first invocation
|
||||
|
@ -67,6 +72,26 @@ int TriggerCentral::getHwEventCounter(int index) {
|
|||
return hwEventCounters[index];
|
||||
}
|
||||
|
||||
static char shaft_signal_msg_index[15];
|
||||
|
||||
static void reportEventToWaveChart(trigger_event_e ckpSignalType, int index) {
|
||||
itoa10(&shaft_signal_msg_index[1], index);
|
||||
if (ckpSignalType == SHAFT_PRIMARY_UP) {
|
||||
addWaveChartEvent(WC_CRANK1, WC_UP, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_PRIMARY_DOWN) {
|
||||
addWaveChartEvent(WC_CRANK1, WC_DOWN, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_SECONDARY_UP) {
|
||||
addWaveChartEvent(WC_CRANK2, WC_UP, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_SECONDARY_DOWN) {
|
||||
addWaveChartEvent(WC_CRANK2, WC_DOWN, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_3RD_UP) {
|
||||
addWaveChartEvent(WC_CRANK3, WC_UP, (char*) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_3RD_DOWN) {
|
||||
addWaveChartEvent(WC_CRANK3, WC_DOWN, (char*) shaft_signal_msg_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TriggerCentral::handleShaftSignal(configuration_s *configuration, trigger_event_e signal, uint64_t nowUs) {
|
||||
efiAssertVoid(configuration!=NULL, "configuration");
|
||||
|
||||
|
@ -101,30 +126,24 @@ void TriggerCentral::handleShaftSignal(configuration_s *configuration, trigger_e
|
|||
return;
|
||||
}
|
||||
|
||||
if (triggerState.getCurrentIndex() >= configuration->engineConfiguration2->triggerShape.shaftPositionEventCount) {
|
||||
int f = warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d", triggerState.getCurrentIndex());
|
||||
if (!f) {
|
||||
#if EFI_PROD_CODE
|
||||
// this temporary code is about trigger noise debugging
|
||||
for (int i = 0; i < HW_EVENT_TYPES; i++) {
|
||||
scheduleMsg(&logger, "event type: %d count=%d", i, hwEventCounters[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* If we only have a crank position sensor, here we are extending crank revolutions with a 360 degree
|
||||
* cycle into a four stroke, 720 degrees cycle. TODO
|
||||
*/
|
||||
int triggerIndexForListeners;
|
||||
if (getOperationMode(configuration->engineConfiguration) == FOUR_STROKE_CAM_SENSOR) {
|
||||
// That's easy - trigger cycle matches engine cycle
|
||||
triggerIndexForListeners = triggerState.getCurrentIndex();
|
||||
} else {
|
||||
/**
|
||||
* If we only have a crank position sensor, here we are extending crank revolutions with a 360 degree
|
||||
* cycle into a four stroke, 720 degrees cycle. TODO
|
||||
*/
|
||||
int triggerIndexForListeners;
|
||||
if (getOperationMode(configuration->engineConfiguration) == FOUR_STROKE_CAM_SENSOR) {
|
||||
// That's easy - trigger cycle matches engine cycle
|
||||
triggerIndexForListeners = triggerState.getCurrentIndex();
|
||||
} else {
|
||||
bool isEven = (triggerState.getTotalRevolutionCounter() & 1) == 0;
|
||||
bool isEven = (triggerState.getTotalRevolutionCounter() & 1) == 0;
|
||||
|
||||
triggerIndexForListeners = triggerState.getCurrentIndex() + (isEven ? 0 : triggerShape->getSize());
|
||||
}
|
||||
triggerIndexForListeners = triggerState.getCurrentIndex() + (isEven ? 0 : triggerShape->getSize());
|
||||
}
|
||||
reportEventToWaveChart(signal, triggerIndexForListeners);
|
||||
|
||||
if (triggerState.getCurrentIndex() >= configuration->engineConfiguration2->triggerShape.shaftPositionEventCount) {
|
||||
warning(OBD_PCM_Processor_Fault, "unexpected eventIndex=%d", triggerState.getCurrentIndex());
|
||||
} else {
|
||||
|
||||
/**
|
||||
* Here we invoke all the listeners - the main engine control logic is inside these listeners
|
||||
|
@ -135,8 +154,9 @@ void TriggerCentral::handleShaftSignal(configuration_s *configuration, trigger_e
|
|||
int afterCallback = hal_lld_get_counter_value();
|
||||
int diff = afterCallback - beforeCallback;
|
||||
// this counter is only 32 bits so it overflows every minute, let's ignore the value in case of the overflow for simplicity
|
||||
if (diff > 0)
|
||||
if (diff > 0) {
|
||||
hsAdd(&triggerCallback, diff);
|
||||
}
|
||||
#endif /* EFI_HISTOGRAMS */
|
||||
}
|
||||
|
||||
|
@ -158,22 +178,20 @@ static void triggerInfo() {
|
|||
scheduleMsg(&logger, "Template %s/%d trigger %d", getConfigurationName(engineConfiguration),
|
||||
engineConfiguration->engineType, engineConfiguration->triggerConfig.triggerType);
|
||||
|
||||
|
||||
|
||||
scheduleMsg(&logger, "trigger event counters %d/%d/%d/%d", triggerCentral.getHwEventCounter(0),
|
||||
triggerCentral.getHwEventCounter(1), triggerCentral.getHwEventCounter(2),
|
||||
triggerCentral.getHwEventCounter(3));
|
||||
scheduleMsg(&logger, "expected cycle events %d/%d/%d",
|
||||
engineConfiguration2->triggerShape.expectedEventCount[0],
|
||||
engineConfiguration2->triggerShape.expectedEventCount[1],
|
||||
engineConfiguration2->triggerShape.expectedEventCount[2]);
|
||||
scheduleMsg(&logger, "expected cycle events %d/%d/%d", engineConfiguration2->triggerShape.expectedEventCount[0],
|
||||
engineConfiguration2->triggerShape.expectedEventCount[1],
|
||||
engineConfiguration2->triggerShape.expectedEventCount[2]);
|
||||
|
||||
scheduleMsg(&logger, "trigger type=%d/need2ndChannel=%s",
|
||||
engineConfiguration->triggerConfig.triggerType,
|
||||
scheduleMsg(&logger, "trigger type=%d/need2ndChannel=%s", engineConfiguration->triggerConfig.triggerType,
|
||||
boolToString(engineConfiguration->needSecondTriggerInput));
|
||||
scheduleMsg(&logger, "expected duty #0=%f/#1=%f", engineConfiguration2->triggerShape.dutyCycle[0],
|
||||
engineConfiguration2->triggerShape.dutyCycle[1]);
|
||||
#endif
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
scheduleMsg(&logger, "primary trigger simulator: %s %s", hwPortname(boardConfiguration->triggerSimulatorPins[0]),
|
||||
pinModeToString(boardConfiguration->triggerSimulatorPinModes[0]));
|
||||
scheduleMsg(&logger, "secondary trigger simulator: %s %s", hwPortname(boardConfiguration->triggerSimulatorPins[1]),
|
||||
|
@ -185,7 +203,8 @@ static void triggerInfo() {
|
|||
scheduleMsg(&logger, "secondary trigger input: %s", hwPortname(boardConfiguration->triggerInputPins[1]));
|
||||
scheduleMsg(&logger, "primary logic input: %s", hwPortname(boardConfiguration->logicAnalyzerPins[0]));
|
||||
scheduleMsg(&logger, "secondary logic input: %s", hwPortname(boardConfiguration->logicAnalyzerPins[1]));
|
||||
#endif
|
||||
|
||||
#endif /* EFI_PROD_CODE */
|
||||
}
|
||||
|
||||
float getTriggerDutyCycle(int index) {
|
||||
|
@ -193,6 +212,12 @@ float getTriggerDutyCycle(int index) {
|
|||
}
|
||||
|
||||
void initTriggerCentral(void) {
|
||||
strcpy((char*) shaft_signal_msg_index, "_");
|
||||
|
||||
#if EFI_WAVE_CHART
|
||||
initWaveChart(&waveChart);
|
||||
#endif
|
||||
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
initLogging(&logger, "ShaftPosition");
|
||||
addConsoleAction("triggerinfo", triggerInfo);
|
||||
|
|
|
@ -39,6 +39,7 @@ public class RecentCommands {
|
|||
add("help");
|
||||
add("showconfig");
|
||||
add("writeconfig");
|
||||
add("triggerinfo");
|
||||
add("enable_injection");
|
||||
add("disable_injection");
|
||||
add("enable_ignition");
|
||||
|
|
Loading…
Reference in New Issue