diff --git a/firmware/console/binary/tunerstudio_outputs.h b/firmware/console/binary/tunerstudio_outputs.h index 20d8157fcc..3335f9dbe4 100644 --- a/firmware/console/binary/tunerstudio_outputs.h +++ b/firmware/console/binary/tunerstudio_outputs.h @@ -83,7 +83,7 @@ typedef struct { // RPM, vss scaled_channel rpm; // 4 - int16_t rpmAcceleration; // 6 + scaled_percent rpmAcceleration; // 6 scaled_percent speedToRpmRatio; // 8 scaled_channel vehicleSpeedKph; // 10 diff --git a/firmware/controllers/engine_cycle/rpm_calculator.cpp b/firmware/controllers/engine_cycle/rpm_calculator.cpp index dd91898133..ce618846b2 100644 --- a/firmware/controllers/engine_cycle/rpm_calculator.cpp +++ b/firmware/controllers/engine_cycle/rpm_calculator.cpp @@ -45,7 +45,7 @@ extern WaveChart waveChart; #endif /* NO_RPM_EVENTS_TIMEOUT_SECS */ float RpmCalculator::getRpmAcceleration() const { - return rpmRate; + return 1.0 * previousRpmValue / rpmValue; } bool RpmCalculator::isStopped() const { @@ -201,9 +201,6 @@ uint32_t RpmCalculator::getRevolutionCounterM(void) const { void RpmCalculator::setStopped() { revolutionCounterSinceStart = 0; - - rpmRate = 0; - if (rpmValue != 0) { assignRpmValue(0); // needed by 'useNoiselessTriggerDecoder' @@ -253,7 +250,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, bool hadRpmRecently = rpmState->checkIfSpinning(nowNt); if (hadRpmRecently) { - int32_t diffNt = (int32_t)(nowNt - rpmState->lastRpmEventTimeNt); + efitick_t diffNt = nowNt - rpmState->lastRpmEventTimeNt; /** * Four stroke cycle is two crankshaft revolutions * @@ -263,16 +260,10 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, */ if (diffNt == 0) { rpmState->setRpmValue(NOISY_RPM); - rpmState->rpmRate = 0; } else { int mult = (int)getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) / 360; float rpm = 60.0 * NT_PER_SECOND * mult / diffNt; - - auto rpmDelta = rpm - rpmState->previousRpmValue; - rpmState->rpmRate = rpmDelta / (mult * 1e-6 * NT2US(diffNt)); - rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm); - } } rpmState->onNewEngineCycle(); diff --git a/firmware/controllers/engine_cycle/rpm_calculator.h b/firmware/controllers/engine_cycle/rpm_calculator.h index 3efa4715a5..2552788357 100644 --- a/firmware/controllers/engine_cycle/rpm_calculator.h +++ b/firmware/controllers/engine_cycle/rpm_calculator.h @@ -115,9 +115,6 @@ public: volatile floatus_t oneDegreeUs = NAN; volatile efitick_t lastRpmEventTimeNt = 0; - // RPM rate of change, in RPM per second - float rpmRate = 0; - protected: // Print sensor info - current RPM state void showInfo(Logging* logger, const char* sensorName) const override; @@ -128,7 +125,6 @@ private: * Zero if engine is not running */ int rpmValue = 0; - /** * Should be called once we've realized engine is not spinning any more. */ diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index ca8c67889e..0ba05f084c 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -209,7 +209,7 @@ enable2ndByteCanID = false ; RPM, vss RPMValue = scalar, U16, 4, "RPM", 1, 0.00000 - rpmAcceleration = scalar, S16, 6, "RPM/s", 1, 0 + rpmAcceleration = scalar, S16, 6, "dRpm",{1/@@PACK_MULT_PERCENT@@}, 0 speedToRpmRatio = scalar, S16, 8, "value",{1/@@PACK_MULT_PERCENT@@}, 0 vehicleSpeedKph = scalar, U08, 10, "kph", 1, 0.0 @@ -939,7 +939,7 @@ gaugeCategory = Sensors - Extra 2 egt6Gauge = egt6, "EGT#6", "C", 0, 2000 egt7Gauge = egt7, "EGT#7", "C", 0, 2000 egt8Gauge = egt8, "EGT#8", "C", 0, 2000 - rpmAccelerationGa = rpmAcceleration, "rpm delta", "RPM/s", -2000, 2000, -2000, 2000, -2000, 2000, 0, 0 + rpmAccelerationGa = rpmAcceleration, "rpm delta", "dRpm", 0, 3, 0, 1, 3, 4, 1, 1 knockLevelGauge = knockLevel,"Knock level", "volts", 0, 7, 10, 10, 100, 100, 1, 2 fuelTankLevelGauge = fuelTankLevel,"Fuel level", "x", 0, 7, 10, 10, 100, 100, 1, 2 speedToRpmRatioGauge = speedToRpmRatio, "speed2rpm", "", 0, 100, 0, 0, 100, 100, 4, 4 @@ -1206,7 +1206,7 @@ gaugeCategory = DynoView entry = knockLevel, @@GAUGE_NAME_KNOCK_LEVEL@@, float, "%.2f" entry = vehicleSpeedKph, @@GAUGE_NAME_VVS@@, float, "%.2f" entry = speedToRpmRatio, "s2rpm", float, "%.3f" - entry = rpmAcceleration, "dRPM", int, "%d" + entry = rpmAcceleration, "dRPM", float, "%.3f" entry = massAirFlowValue,@@GAUGE_NAME_AIR_FLOW@@, float, "%.3f" entry = chargeAirMass, @@GAUGE_NAME_AIR_MASS@@, float, "%.3f" entry = throttlePedalPosition, @@GAUGE_NAME_THROTTLE_PEDAL@@, float, "%.3f"