mirror of https://github.com/rusefi/rusefi.git
parent
4e7e25585e
commit
831e016bc4
|
@ -7,6 +7,11 @@ static constexpr float geometricMean(float x, float y) {
|
||||||
GearDetector::GearDetector()
|
GearDetector::GearDetector()
|
||||||
: StoredValueSensor(SensorType::DetectedGear, MS2NT(100))
|
: StoredValueSensor(SensorType::DetectedGear, MS2NT(100))
|
||||||
{
|
{
|
||||||
|
Register();
|
||||||
|
}
|
||||||
|
|
||||||
|
GearDetector::~GearDetector() {
|
||||||
|
unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GearDetector::onConfigurationChange(engine_configuration_s const * /*previousConfig*/) {
|
void GearDetector::onConfigurationChange(engine_configuration_s const * /*previousConfig*/) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
class GearDetector : public EngineModule, public StoredValueSensor {
|
class GearDetector : public EngineModule, public StoredValueSensor {
|
||||||
public:
|
public:
|
||||||
GearDetector();
|
GearDetector();
|
||||||
|
~GearDetector();
|
||||||
|
|
||||||
void onSlowCallback() override;
|
void onSlowCallback() override;
|
||||||
void onConfigurationChange(engine_configuration_s const * /*previousConfig*/) override;
|
void onConfigurationChange(engine_configuration_s const * /*previousConfig*/) override;
|
||||||
|
|
|
@ -12,7 +12,7 @@ float GetGearRatioFor(float revPerKm, float axle, float kph, float rpm) {
|
||||||
GearDetector dut;
|
GearDetector dut;
|
||||||
dut.onSlowCallback();
|
dut.onSlowCallback();
|
||||||
|
|
||||||
return dut.get().value_or(0);
|
return Sensor::getOrZero(SensorType::DetectedGear);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GearDetector, ComputeGearRatio) {
|
TEST(GearDetector, ComputeGearRatio) {
|
||||||
|
|
Loading…
Reference in New Issue