preparing for #974

code comments & refactoring
This commit is contained in:
rusefi 2019-10-14 16:04:28 -04:00
parent 1f4a06e993
commit 5a4c7b38cd
3 changed files with 5 additions and 8 deletions

View File

@ -53,10 +53,8 @@ FsioState::FsioState() {
void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) { void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT #if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
#if !EFI_UNIT_TEST
// we have a confusing threading model so some synchronization would not hurt // we have a confusing threading model so some synchronization would not hurt
bool alreadyLocked = lockAnyContext(); bool alreadyLocked = lockAnyContext();
#endif /* EFI_UNIT_TEST */
TRIGGER_SHAPE(initializeTriggerShape(logger, TRIGGER_SHAPE(initializeTriggerShape(logger,
engineConfiguration->ambiguousOperationMode, engineConfiguration->ambiguousOperationMode,
@ -86,11 +84,9 @@ void Engine::eInitializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SU
engine->engineCycleEventCount = TRIGGER_SHAPE(getLength()); engine->engineCycleEventCount = TRIGGER_SHAPE(getLength());
} }
#if !EFI_UNIT_TEST
if (!alreadyLocked) { if (!alreadyLocked) {
unlockAnyContext(); unlockAnyContext();
} }
#endif /* EFI_UNIT_TEST */
if (!TRIGGER_SHAPE(shapeDefinitionError)) { if (!TRIGGER_SHAPE(shapeDefinitionError)) {
prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE); prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -110,18 +110,15 @@ static bool isAveraging = false;
static void startAveraging(void *arg) { static void startAveraging(void *arg) {
(void) arg; (void) arg;
efiAssertVoid(CUSTOM_ERR_6649, getCurrentRemainingStack() > 128, "lowstck#9"); efiAssertVoid(CUSTOM_ERR_6649, getCurrentRemainingStack() > 128, "lowstck#9");
#if !EFI_UNIT_TEST
bool wasLocked = lockAnyContext(); bool wasLocked = lockAnyContext();
#endif
// with locking we would have a consistent state // with locking we would have a consistent state
mapAdcAccumulator = 0; mapAdcAccumulator = 0;
mapMeasurementsCounter = 0; mapMeasurementsCounter = 0;
isAveraging = true; isAveraging = true;
#if !EFI_UNIT_TEST
if (!wasLocked) { if (!wasLocked) {
unlockAnyContext(); unlockAnyContext();
} }
#endif /* !EFI_UNIT_TEST */
mapAveragingPin.setHigh(); mapAveragingPin.setHigh();
} }

View File

@ -100,4 +100,8 @@ void print(const char *fmt, ...);
#define CONFIG_PARAM(x) (x) #define CONFIG_PARAM(x) (x)
#define lockAnyContext() false
#define unlockAnyContext() {}
#endif /* GLOBAL_H_ */ #endif /* GLOBAL_H_ */