mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
e0fb25e958
commit
c9852aa7b5
|
@ -29,7 +29,7 @@
|
|||
#include "engine_math.h"
|
||||
#include "speed_density.h"
|
||||
#include "advance_map.h"
|
||||
#if EFI_PROD_CODE
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
#include "electronic_throttle.h"
|
||||
#include "alternatorController.h"
|
||||
#endif
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
#if EFI_TUNER_STUDIO
|
||||
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
||||
#include "tunerstudio.h"
|
||||
#endif
|
||||
|
||||
|
@ -177,7 +177,7 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) {
|
|||
boardConfiguration->acRelayPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->acRelayPinMode = OM_DEFAULT;
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
setDefaultAlternatorParameters();
|
||||
setDefaultEtbParameters();
|
||||
#endif
|
||||
|
@ -228,7 +228,7 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) {
|
|||
* and the settings saves in flash memory.
|
||||
*/
|
||||
void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||
#if ! EFI_UNIT_TEST
|
||||
#if (! EFI_UNIT_TEST) || defined(__DOXYGEN__)
|
||||
memset(&persistentState.persistentConfiguration, 0, sizeof(persistentState.persistentConfiguration));
|
||||
#endif
|
||||
prepareVoidConfiguration(engineConfiguration);
|
||||
|
@ -472,7 +472,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
engineConfiguration->idleStepperReactionTime = 10;
|
||||
engineConfiguration->idleStepperTotalSteps = 150;
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
engineConfiguration->engineChartSize = 300;
|
||||
#else
|
||||
// need more events for automated test
|
||||
|
@ -618,7 +618,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN
|
|||
* Let's apply global defaults first
|
||||
*/
|
||||
setDefaultConfiguration(PASS_ENGINE_PARAMETER_F);
|
||||
#if EFI_SIMULATOR
|
||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
||||
engineConfiguration->directSelfStimulation = true;
|
||||
#endif /* */
|
||||
engineConfiguration->engineType = engineType;
|
||||
|
@ -758,13 +758,14 @@ engine_configuration2_s::engine_configuration2_s() {
|
|||
}
|
||||
|
||||
void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_S) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "apply c");
|
||||
scheduleMsg(logger, "applyNonPersistentConfiguration()");
|
||||
#endif
|
||||
|
||||
// todo: this would require 'initThermistors() to re-establish a reference, todo: fix
|
||||
// memset(engineConfiguration2, 0, sizeof(engine_configuration2_s));
|
||||
#if EFI_PROD_CODE
|
||||
scheduleMsg(logger, "applyNonPersistentConfiguration()");
|
||||
#endif
|
||||
#if EFI_ENGINE_CONTROL
|
||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||
engine->triggerShape.initializeTriggerShape(logger PASS_ENGINE_PARAMETER);
|
||||
#endif
|
||||
if (engine->triggerShape.getSize() == 0) {
|
||||
|
|
|
@ -106,6 +106,7 @@ static bool hasValidEngineType(engine_configuration_s *engineConfiguration) {
|
|||
}
|
||||
|
||||
void readFromFlash(void) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "read f");
|
||||
printMsg(logger, "readFromFlash()");
|
||||
flashRead(FLASH_ADDR, (char *) &persistentState, PERSISTENT_SIZE);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ SimplePwm::SimplePwm() {
|
|||
sr[0] = waveInstance;
|
||||
init(_switchTimes, sr);
|
||||
}
|
||||
|
||||
void PwmConfig::baseConstructor() {
|
||||
memset(&scheduling, 0, sizeof(scheduling));
|
||||
memset(&safe, 0, sizeof(safe));
|
||||
|
|
|
@ -164,7 +164,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
bool_t isPrimary = triggerWheel == T_PRIMARY;
|
||||
|
||||
if (isLessImportant(signal)) {
|
||||
#if EFI_UNIT_TEST
|
||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||
if (printTriggerDebug) {
|
||||
printf("%s isLessImportant %s\r\n",
|
||||
getTrigger_type_e(engineConfiguration->trigger.type),
|
||||
|
@ -189,7 +189,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
isFirstEvent = false;
|
||||
// todo: skip a number of signal from the beginning
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
// scheduleMsg(&logger, "from %f to %f %d %d", triggerConfig->syncRatioFrom, triggerConfig->syncRatioTo, currentDuration, shaftPositionState->toothed_previous_duration);
|
||||
// scheduleMsg(&logger, "ratio %f", 1.0 * currentDuration/ shaftPositionState->toothed_previous_duration);
|
||||
#else
|
||||
|
@ -235,7 +235,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
|
||||
}
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||
if (printTriggerDebug) {
|
||||
printf("%s isSynchronizationPoint=%d index=%d %s\r\n",
|
||||
getTrigger_type_e(engineConfiguration->trigger.type),
|
||||
|
@ -258,7 +258,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
|||
lastDecodingErrorTime = getTimeNowNt();
|
||||
totalTriggerErrorCounter++;
|
||||
if (engineConfiguration->isPrintTriggerSynchDetails) {
|
||||
#if EFI_PROD_CODE
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d", currentCycle.current_index,
|
||||
TRIGGER_SHAPE(expectedEventCount[0]), TRIGGER_SHAPE(expectedEventCount[1]),
|
||||
TRIGGER_SHAPE(expectedEventCount[2]), currentCycle.eventCount[0], currentCycle.eventCount[1], currentCycle.eventCount[2]);
|
||||
|
@ -365,11 +365,12 @@ static void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode
|
|||
* External logger is needed because at this point our logger is not yet initialized
|
||||
*/
|
||||
void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_S) {
|
||||
TriggerShape *triggerShape = this;
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "init t");
|
||||
scheduleMsg(logger, "initializeTriggerShape()");
|
||||
#endif
|
||||
TriggerShape *triggerShape = this;
|
||||
|
||||
const trigger_config_s *triggerConfig = &engineConfiguration->trigger;
|
||||
|
||||
clear();
|
||||
|
@ -543,6 +544,9 @@ static uint32_t doFindTrigger(TriggerStimulatorHelper *helper, TriggerShape * sh
|
|||
return EFI_ERROR_CODE;
|
||||
}
|
||||
|
||||
// todo: reuse trigger central state here to reduce RAM usage?
|
||||
static TriggerState state;
|
||||
|
||||
/**
|
||||
* Trigger shape is defined in a way which is convenient for trigger shape definition
|
||||
* On the other hand, trigger decoder indexing begins from synchronization event.
|
||||
|
@ -551,11 +555,13 @@ static uint32_t doFindTrigger(TriggerStimulatorHelper *helper, TriggerShape * sh
|
|||
*/
|
||||
uint32_t findTriggerZeroEventIndex(TriggerShape * shape, trigger_config_s const*triggerConfig
|
||||
DECLARE_ENGINE_PARAMETER_S) {
|
||||
|
||||
// todo: should this variable be declared 'static' to reduce stack usage?
|
||||
TriggerState state;
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
efiAssert(getRemainingStack(chThdSelf()) > 128, "findPos", -1);
|
||||
#endif
|
||||
errorDetection.clear();
|
||||
|
||||
state.reset();
|
||||
|
||||
// todo: should this variable be declared 'static' to reduce stack usage?
|
||||
TriggerStimulatorHelper helper;
|
||||
|
||||
|
@ -594,7 +600,7 @@ void initTriggerDecoderLogger(Logging *sharedLogger) {
|
|||
}
|
||||
|
||||
void initTriggerDecoder(void) {
|
||||
#if (EFI_PROD_CODE || EFI_SIMULATOR)
|
||||
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
|
||||
outputPinRegisterExt2("trg_err", &triggerDecoderErrorPin, boardConfiguration->triggerErrorPin, &boardConfiguration->triggerErrorPinMode);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
uint32_t orderingErrorCounter;
|
||||
uint32_t runningOrderingErrorCounter;
|
||||
|
||||
void reset();
|
||||
void resetRunningCounters();
|
||||
|
||||
uint32_t runningRevolutionCounter;
|
||||
|
|
|
@ -67,6 +67,9 @@ int TriggerShape::getTriggerShapeSynchPointIndex() {
|
|||
}
|
||||
|
||||
void TriggerShape::calculateTriggerSynchPoint(DECLARE_ENGINE_PARAMETER_F) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "calc s");
|
||||
#endif
|
||||
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
||||
|
||||
triggerShapeSynchPointIndex = findTriggerZeroEventIndex(this, triggerConfig PASS_ENGINE_PARAMETER);
|
||||
|
@ -151,6 +154,10 @@ void multi_wave_s::setSwitchTime(int index, float value) {
|
|||
}
|
||||
|
||||
TriggerState::TriggerState() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void TriggerState::reset() {
|
||||
cycleCallback = NULL;
|
||||
shaft_is_synchronized = false;
|
||||
toothed_previous_time = 0;
|
||||
|
|
|
@ -212,6 +212,7 @@ void applyNewHardwareSettings(void) {
|
|||
}
|
||||
|
||||
void initHardware(Logging *l) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "init h");
|
||||
sharedLogger = l;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
efiAssertVoid(engineConfiguration!=NULL, "engineConfiguration");
|
||||
|
|
|
@ -164,6 +164,8 @@ void applyNewConfiguration(void) {
|
|||
}
|
||||
|
||||
void runRusEfi(void) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 512, "init s");
|
||||
|
||||
msObjectInit(&firmwareErrorMessageStream, errorMessageBuffer, sizeof(errorMessageBuffer), 0);
|
||||
|
||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||
|
@ -203,7 +205,7 @@ void runRusEfi(void) {
|
|||
#if EFI_PERF_METRICS || defined(__DOXYGEN__)
|
||||
initTimePerfActions(&sharedLogger);
|
||||
#endif
|
||||
|
||||
|
||||
#if EFI_ENGINE_EMULATOR || defined(__DOXYGEN__)
|
||||
initEngineEmulator(&sharedLogger, engine);
|
||||
#endif
|
||||
|
@ -273,5 +275,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
return 3211; // this is here to make the compiler happy about the unused array
|
||||
return 20150912;
|
||||
return 20150913;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue