rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
controllers
sensors
converters
vehicle_speed_converter.h
Go to the documentation of this file.
1
#include "
pch.h
"
2
#include "
sensor_converter_func.h
"
3
4
class
VehicleSpeedConverter
:
public
SensorConverter
{
5
public
:
6
SensorResult
convert
(
float
frequency
)
const override
{
7
auto
vssRevPerKm =
engineConfiguration
->
driveWheelRevPerKm
*
engineConfiguration
->
vssGearRatio
;
8
9
auto
pulsePerKm = (vssRevPerKm *
engineConfiguration
->
vssToothCount
);
10
11
if
(pulsePerKm == 0) {
12
// avoid div by 0
13
return
0;
14
}
15
16
auto
kmPerPulse = 1 / pulsePerKm;
17
18
// 1 pulse 3600 sec 1 km km
19
// --------- * ---------- * --------- = ----
20
// sec 1 hr 1 pulse hr
21
return
frequency
* 3600 * kmPerPulse;
22
}
23
};
VehicleSpeedConverter
Definition
vehicle_speed_converter.h:4
VehicleSpeedConverter::convert
SensorResult convert(float frequency) const override
Definition
vehicle_speed_converter.h:6
engineConfiguration
static constexpr engine_configuration_s * engineConfiguration
Definition
engine_configuration.h:80
frequency
static float frequency
Definition
init_flex.cpp:21
pch.h
SensorResult
expected< float > SensorResult
Definition
sensor.h:46
sensor_converter_func.h
SensorConverter
Definition
sensor_converter_func.h:5
engine_configuration_s::vssToothCount
uint8_t vssToothCount
Definition
engine_configuration_generated_structures_alphax-2chan.h:1960
engine_configuration_s::vssGearRatio
scaled_channel< uint16_t, 1000, 1 > vssGearRatio
Definition
engine_configuration_generated_structures_alphax-2chan.h:1949
engine_configuration_s::driveWheelRevPerKm
float driveWheelRevPerKm
Definition
engine_configuration_generated_structures_alphax-2chan.h:1789
Generated on Sat Sep 27 2025 00:10:06 for rusEFI by
1.9.8