This commit is contained in:
rusefillc 2022-12-17 15:23:32 -05:00
parent f0f8f022e2
commit 85976ed63d
4 changed files with 32 additions and 27 deletions

View File

@ -765,15 +765,15 @@ void updateTunerStudioState() {
tsOutputChannels->revolutionCounterSinceStart = engine->rpmCalculator.getRevolutionCounterSinceStart();
#if EFI_CAN_SUPPORT
postCanState();
postCanState();
#endif /* EFI_CAN_SUPPORT */
#if EFI_CLOCK_LOCKS
tsOutputChannels->maxLockedDuration = NT2US(maxLockedDuration);
tsOutputChannels->maxTriggerReentrant = maxTriggerReentrant;
tsOutputChannels->maxLockedDuration = NT2US(maxLockedDuration);
#endif /* EFI_CLOCK_LOCKS */
#if EFI_SHAFT_POSITION_INPUT
tsOutputChannels->maxTriggerReentrant = maxTriggerReentrant;
tsOutputChannels->triggerPrimaryFall = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_FALLING);
tsOutputChannels->triggerPrimaryRise = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_RISING);

View File

@ -19,12 +19,9 @@
#include "trigger_central.h"
#include "tooth_logger.h"
#if EFI_PROD_CODE
#endif /* EFI_PROD_CODE */
#if EFI_SENSOR_CHART
#include "sensor_chart.h"
#endif
#endif // EFI_SENSOR_CHART
#include "engine_sniffer.h"
@ -63,6 +60,30 @@ float RpmCalculator::getCachedRpm() const {
return cachedRpmValue;
}
operation_mode_e lookupOperationMode() {
if (engineConfiguration->twoStroke) {
return TWO_STROKE;
} else {
return engineConfiguration->skippedWheelOnCam ? FOUR_STROKE_CAM_SENSOR : FOUR_STROKE_CRANK_SENSOR;
}
}
// todo: move to triggerCentral/triggerShape since has nothing to do with rotation state!
operation_mode_e RpmCalculator::getOperationMode() const {
#if EFI_SHAFT_POSITION_INPUT
// Ignore user-provided setting for well known triggers.
if (doesTriggerImplyOperationMode(engineConfiguration->trigger.type)) {
// For example for Miata NA, there is no reason to allow user to set FOUR_STROKE_CRANK_SENSOR
return engine->triggerCentral.triggerShape.getWheelOperationMode();
} else
#endif // EFI_SHAFT_POSITION_INPUT
{
// For example 36-1, could be on either cam or crank, so we have to ask the user
return lookupOperationMode();
}
}
#if EFI_SHAFT_POSITION_INPUT
RpmCalculator::RpmCalculator() :
@ -118,26 +139,6 @@ static bool doesTriggerImplyOperationMode(trigger_type_e type) {
}
}
operation_mode_e lookupOperationMode() {
if (engineConfiguration->twoStroke) {
return TWO_STROKE;
} else {
return engineConfiguration->skippedWheelOnCam ? FOUR_STROKE_CAM_SENSOR : FOUR_STROKE_CRANK_SENSOR;
}
}
// todo: move to triggerCentral/triggerShape since has nothing to do with rotation state!
operation_mode_e RpmCalculator::getOperationMode() const {
// Ignore user-provided setting for well known triggers.
if (doesTriggerImplyOperationMode(engineConfiguration->trigger.type)) {
// For example for Miata NA, there is no reason to allow user to set FOUR_STROKE_CRANK_SENSOR
return engine->triggerCentral.triggerShape.getWheelOperationMode();
} else {
// For example 36-1, could be on either cam or crank, so we have to ask the user
return lookupOperationMode();
}
}
void RpmCalculator::assignRpmValue(float floatRpmValue) {
previousRpmValue = cachedRpmValue;

View File

@ -22,5 +22,7 @@ void initEngineEmulator() {
initPotentiometers();
#endif /* EFI_POTENTIOMETER && HAL_USE_SPI*/
#if EFI_EMULATE_POSITION_SENSORS
initTriggerEmulator();
#endif // EFI_EMULATE_POSITION_SENSORS
}

View File

@ -575,6 +575,7 @@ void mlgLogger() {
}
static void sdTriggerLogger() {
#if EFI_TOOTH_LOGGER
EnableToothLogger();
while (true) {
@ -584,6 +585,7 @@ static void sdTriggerLogger() {
ReturnToothLoggerBuffer(buffer);
}
#endif /* EFI_TOOTH_LOGGER */
}
bool isSdCardAlive(void) {