2022-03-28 20:31:03 -07:00
|
|
|
/*
|
|
|
|
* @file init_aux_speed_sensor.cpp
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pch.h"
|
2022-03-28 23:35:27 -07:00
|
|
|
#include "init.h"
|
|
|
|
#include "frequency_sensor.h"
|
2022-03-28 20:31:03 -07:00
|
|
|
|
2022-04-09 06:00:19 -07:00
|
|
|
static FrequencySensor auxSpeed1(SensorType::AuxSpeed1, MS2NT(500));
|
|
|
|
static FrequencySensor auxSpeed2(SensorType::AuxSpeed2, MS2NT(500));
|
2022-03-28 23:35:27 -07:00
|
|
|
|
|
|
|
static class : public SensorConverter {
|
|
|
|
public:
|
|
|
|
SensorResult convert(float frequency) const override {
|
|
|
|
auto hz = frequency;
|
|
|
|
|
|
|
|
auto rpm = hz * 60;
|
|
|
|
|
|
|
|
return rpm;
|
|
|
|
}
|
|
|
|
} converter;
|
|
|
|
|
|
|
|
|
|
|
|
void initAuxSpeedSensors() {
|
2022-09-20 20:00:42 -07:00
|
|
|
auxSpeed1.useBiQuad = engineConfiguration->useBiQuadOnAuxSpeedSensors;
|
|
|
|
auxSpeed1.initIfValid(engineConfiguration->auxSpeedSensorInputPin[0], converter, engineConfiguration->auxFrequencyFilter);
|
2022-04-09 06:00:19 -07:00
|
|
|
auxSpeed2.initIfValid(engineConfiguration->auxSpeedSensorInputPin[1], converter, 0.05f);
|
2022-03-28 23:35:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void deinitAuxSpeedSensors() {
|
|
|
|
auxSpeed1.deInit();
|
|
|
|
auxSpeed2.deInit();
|
|
|
|
}
|