only:int rpm -> float rpm
This commit is contained in:
parent
93bb3df05d
commit
4ba6cf4185
|
@ -32,11 +32,11 @@ bool AntilagSystemBase::isInsideALSSwitchCondition() {
|
|||
}
|
||||
}
|
||||
|
||||
bool AntilagSystemBase::isALSMinRPMCondition(int rpm) const {
|
||||
bool AntilagSystemBase::isALSMinRPMCondition(float rpm) const {
|
||||
return engineConfiguration->ALSMinRPM < rpm;
|
||||
}
|
||||
|
||||
bool AntilagSystemBase::isALSMaxRPMCondition(int rpm) const {
|
||||
bool AntilagSystemBase::isALSMaxRPMCondition(float rpm) const {
|
||||
return engineConfiguration->ALSMaxRPM > rpm;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool AntilagSystemBase::isInsideALSTimerCondition() {
|
|||
return ALStime < engineConfiguration->ALSMaxDuration;
|
||||
}
|
||||
|
||||
bool AntilagSystemBase::isAntilagConditionMet(int rpm) {
|
||||
bool AntilagSystemBase::isAntilagConditionMet(float rpm) {
|
||||
|
||||
|
||||
ALSMinRPMCondition = isALSMinRPMCondition(rpm);
|
||||
|
@ -89,7 +89,7 @@ todo: looking for a hero to figure out unit test part of this
|
|||
}
|
||||
|
||||
void AntilagSystemBase::update() {
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
float rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
isAntilagCondition = engineConfiguration->antiLagEnabled && isAntilagConditionMet(rpm);
|
||||
|
||||
if (!ALSMaxRPMCondition) {
|
||||
|
|
|
@ -16,15 +16,15 @@ class AntilagSystemBase : public antilag_system_state_s {
|
|||
public:
|
||||
void update();
|
||||
|
||||
bool isALSMinRPMCondition(int rpm) const;
|
||||
bool isALSMaxRPMCondition(int rpm) const;
|
||||
bool isALSMinRPMCondition(float rpm) const;
|
||||
bool isALSMaxRPMCondition(float rpm) const;
|
||||
bool isALSMinCLTCondition() const;
|
||||
bool isALSMaxCLTCondition() const;
|
||||
bool isALSMaxThrottleIntentCondition() const;
|
||||
bool isInsideALSSwitchCondition();
|
||||
bool isInsideALSTimerCondition();
|
||||
/* enabled and all conditions above */
|
||||
bool isAntilagConditionMet(int rpm);
|
||||
bool isAntilagConditionMet(float rpm);
|
||||
|
||||
private:
|
||||
Timer ALStimer;
|
||||
|
|
|
@ -222,7 +222,7 @@ void Engine::updateSlowSensors() {
|
|||
updateSwitchInputs();
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
float rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
triggerCentral.isEngineSnifferEnabled = rpm < engineConfiguration->engineSnifferRpmThreshold;
|
||||
getEngineState()->sensorChartMode = rpm < engineConfiguration->sensorSnifferRpmThreshold ? engineConfiguration->sensorChartMode : SC_OFF;
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp, angle_
|
|||
}
|
||||
#endif // HW_CHECK_MODE
|
||||
|
||||
int rpm = engine->rpmCalculator.getCachedRpm();
|
||||
float rpm = engine->rpmCalculator.getCachedRpm();
|
||||
if (rpm == 0) {
|
||||
// this happens while we just start cranking
|
||||
|
||||
|
|
|
@ -374,7 +374,7 @@ void tdcMarkCallback(
|
|||
|
||||
// two instances of scheduling_s are needed to properly handle event overlap
|
||||
int revIndex2 = getRevolutionCounter() % 2;
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
float rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
// todo: use tooth event-based scheduling, not just time-based scheduling
|
||||
if (isValidRpm(rpm)) {
|
||||
angle_t tdcPosition = tdcPosition();
|
||||
|
|
|
@ -380,7 +380,7 @@ void turnSparkPinHighStartCharging(IgnitionEvent *event) {
|
|||
#endif
|
||||
|
||||
static void scheduleSparkEvent(bool limitedSpark, IgnitionEvent *event,
|
||||
int rpm, float dwellMs, float dwellAngle, float sparkAngle, efitick_t edgeTimestamp, float currentPhase, float nextPhase) {
|
||||
float rpm, float dwellMs, float dwellAngle, float sparkAngle, efitick_t edgeTimestamp, float currentPhase, float nextPhase) {
|
||||
|
||||
float angleOffset = dwellAngle - currentPhase;
|
||||
if (angleOffset < 0) {
|
||||
|
@ -529,11 +529,10 @@ static void prepareIgnitionSchedule() {
|
|||
initializeIgnitionActions();
|
||||
}
|
||||
|
||||
void onTriggerEventSparkLogic(int rpm, efitick_t edgeTimestamp, float currentPhase, float nextPhase) {
|
||||
void onTriggerEventSparkLogic(float rpm, efitick_t edgeTimestamp, float currentPhase, float nextPhase) {
|
||||
ScopePerf perf(PE::OnTriggerEventSparkLogic);
|
||||
|
||||
if (!isValidRpm(rpm) || !engineConfiguration->isIgnitionEnabled) {
|
||||
// this might happen for instance in case of a single trigger event after a pause
|
||||
if (!engineConfiguration->isIgnitionEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -545,7 +544,7 @@ void onTriggerEventSparkLogic(int rpm, efitick_t edgeTimestamp, float currentPha
|
|||
|
||||
const floatms_t dwellMs = engine->ignitionState.sparkDwell;
|
||||
if (std::isnan(dwellMs) || dwellMs <= 0) {
|
||||
warning(ObdCode::CUSTOM_DWELL, "invalid dwell to handle: %.2f at %d", dwellMs, rpm);
|
||||
warning(ObdCode::CUSTOM_DWELL, "invalid dwell to handle: %.2f", dwellMs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -666,7 +665,7 @@ int getNumberOfSparks(ignition_mode_e mode) {
|
|||
/**
|
||||
* @see getInjectorDutyCycle
|
||||
*/
|
||||
percent_t getCoilDutyCycle(int rpm) {
|
||||
percent_t getCoilDutyCycle(float rpm) {
|
||||
floatms_t totalPerCycle = engine->ignitionState.sparkDwell * getNumberOfSparks(getCurrentIgnitionMode());
|
||||
floatms_t engineCycleDuration = getCrankshaftRevolutionTimeMs(rpm) * (getEngineRotationState()->getOperationMode() == TWO_STROKE ? 1 : 2);
|
||||
return 100 * totalPerCycle / engineCycleDuration;
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
void onTriggerEventSparkLogic(int rpm, efitick_t edgeTimestamp, float currentPhase, float nextPhase);
|
||||
void onTriggerEventSparkLogic(float rpm, efitick_t edgeTimestamp, float currentPhase, float nextPhase);
|
||||
void turnSparkPinHighStartCharging(IgnitionEvent *event);
|
||||
void fireSparkAndPrepareNextSchedule(IgnitionEvent *event);
|
||||
int getNumberOfSparks(ignition_mode_e mode);
|
||||
// fact: getInjectorDutyCycle is used by limpManager as cut reason but coil duty cycle is only logged not considered for control strategy
|
||||
// see also maxAllowedDwellAngle which only produces a warning without cutting spark
|
||||
percent_t getCoilDutyCycle(int rpm);
|
||||
percent_t getCoilDutyCycle(float rpm);
|
||||
void initializeIgnitionActions();
|
||||
|
|
|
@ -10,7 +10,7 @@ static SimplePwm pwms[VR_THRESHOLD_COUNT];
|
|||
#define VR_SUPPLY_VOLTAGE 3.3f
|
||||
#endif
|
||||
|
||||
static void updateVrThresholdPwm(int rpm, size_t index) {
|
||||
static void updateVrThresholdPwm(float rpm, size_t index) {
|
||||
auto& cfg = engineConfiguration->vrThreshold[index];
|
||||
|
||||
if (!isBrainPinValid(cfg.pin)) {
|
||||
|
|
|
@ -212,7 +212,7 @@ static void reportWave(Logging *logging, int index) {
|
|||
logging->appendPrintf("%s", LOG_DELIMITER);
|
||||
|
||||
efitimeus_t offsetUs = getWaveOffset(index);
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
float rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
if (rpm != 0) {
|
||||
float oneDegreeUs = getOneDegreeTimeUs(rpm);
|
||||
|
||||
|
|
Loading…
Reference in New Issue