migrating to SensorType::Rpm API
This commit is contained in:
parent
5353d13d96
commit
5f3324cd6b
|
@ -68,7 +68,7 @@ float WallFuel::adjust(float desiredMassGrams) {
|
|||
}
|
||||
|
||||
// Ignore really slow RPM
|
||||
int rpm = GET_RPM();
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
if (rpm < 100) {
|
||||
return desiredMassGrams;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ static void handleGetDataRequest(const CANRxFrame& rx) {
|
|||
obdSendValue(_1_MODE, pid, 1, Sensor::getOrZero(SensorType::Map));
|
||||
break;
|
||||
case PID_RPM:
|
||||
obdSendValue(_1_MODE, pid, 2, GET_RPM() * ODB_RPM_MULT); // rotation/min. (A*256+B)/4
|
||||
obdSendValue(_1_MODE, pid, 2, Sensor::getOrZero(SensorType::Rpm) * ODB_RPM_MULT); // rotation/min. (A*256+B)/4
|
||||
break;
|
||||
case PID_SPEED:
|
||||
obdSendValue(_1_MODE, pid, 1, Sensor::getOrZero(SensorType::VehicleSpeed));
|
||||
|
|
|
@ -235,7 +235,7 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now
|
|||
if (printFuelDebug) {
|
||||
InjectorOutputPin *output = outputs[0];
|
||||
printf("handleFuelInjectionEvent fuelout %s injection_duration %dus engineCycleDuration=%.1fms\t\n", output->name, (int)durationUs,
|
||||
(int)MS2US(getCrankshaftRevolutionTimeMs(GET_RPM())) / 1000.0);
|
||||
(int)MS2US(getCrankshaftRevolutionTimeMs(Sensor::getOrZero(SensorType::Rpm))) / 1000.0);
|
||||
}
|
||||
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
||||
|
||||
|
@ -550,7 +550,7 @@ void updatePrimeInjectionPulseState() {
|
|||
|
||||
static void showMainInfo(Engine *engine) {
|
||||
#if EFI_PROD_CODE
|
||||
int rpm = GET_RPM();
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
float el = getFuelingLoad();
|
||||
efiPrintf("rpm %d engine_load %.2f", rpm, el);
|
||||
efiPrintf("fuel %.2fms timing %.2f", engine->injectionDuration, engine->engineState.timingAdvance[0]);
|
||||
|
|
|
@ -172,7 +172,7 @@ void postMapState(TunerStudioOutputChannels *tsOutputChannels) {
|
|||
#endif /* EFI_TUNER_STUDIO */
|
||||
|
||||
void refreshMapAveragingPreCalc() {
|
||||
int rpm = GET_RPM();
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
if (isValidRpm(rpm)) {
|
||||
MAP_sensor_config_s * c = &engineConfiguration->map;
|
||||
angle_t start = interpolate2d(rpm, c->samplingAngleBins, c->samplingAngle);
|
||||
|
@ -211,7 +211,7 @@ void mapAveragingTriggerCallback(
|
|||
if (index != (uint32_t)engineConfiguration->mapAveragingSchedulingAtIndex)
|
||||
return;
|
||||
|
||||
int rpm = GET_RPM();
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
if (!isValidRpm(rpm)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ static void onTdcCallback(void *) {
|
|||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
itoa10(rpmBuffer, GET_RPM());
|
||||
itoa10(rpmBuffer, Sensor::getOrZero(SensorType::Rpm));
|
||||
#if EFI_ENGINE_SNIFFER
|
||||
waveChart.startDataCollection();
|
||||
#endif
|
||||
|
|
|
@ -230,7 +230,7 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
|
|||
// todo: no reason for this to be disabled in unit_test mode?!
|
||||
#if ! EFI_UNIT_TEST
|
||||
|
||||
if (GET_RPM() > 2 * engineConfiguration->cranking.rpm) {
|
||||
if (Sensor::getOrZero(SensorType::Rpm) > 2 * engineConfiguration->cranking.rpm) {
|
||||
const char *outputName = output->getName();
|
||||
if (prevSparkName == outputName && getCurrentIgnitionMode() != IM_ONE_COIL) {
|
||||
warning(CUSTOM_OBD_SKIPPED_SPARK, "looks like skipped spark event %d %s", getRevolutionCounter(), outputName);
|
||||
|
|
|
@ -606,7 +606,7 @@ void TriggerState::decodeTriggerEvent(
|
|||
} else {
|
||||
efiPrintf("%srpm=%d time=%d eventIndex=%d gapIndex=%d: gap=%.3f expected from %.3f to %.3f error=%s",
|
||||
triggerConfiguration.PrintPrefix,
|
||||
GET_RPM(),
|
||||
(int)Sensor::getOrZero(SensorType::Rpm),
|
||||
/* cast is needed to make sure we do not put 64 bit value to stack*/ (int)getTimeNowSeconds(),
|
||||
currentCycle.current_index,
|
||||
i,
|
||||
|
|
|
@ -344,7 +344,7 @@ void EngineTestHelper::applyTriggerWaveform() {
|
|||
void EngineTestHelper::assertRpm(int expectedRpm, const char *msg) {
|
||||
Engine *engine = &this->engine;
|
||||
|
||||
EXPECT_EQ(expectedRpm, GET_RPM()) << msg;
|
||||
EXPECT_EQ(expectedRpm, Sensor::getOrZero(SensorType::Rpm)) << msg;
|
||||
}
|
||||
|
||||
void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e injectionMode,
|
||||
|
|
Loading…
Reference in New Issue