rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions
VehicleSpeedConverter Class Reference

#include <vehicle_speed_converter.h>

Inheritance diagram for VehicleSpeedConverter:
Inheritance graph
[legend]
Collaboration diagram for VehicleSpeedConverter:
Collaboration graph
[legend]

Public Member Functions

SensorResult convert (float frequency) const override
 
- Public Member Functions inherited from SensorConverter
 SensorConverter (const SensorConverter &)=delete
 
 SensorConverter ()=default
 
virtual void showInfo (float testRawValue) const
 

Detailed Description

Definition at line 4 of file vehicle_speed_converter.h.

Member Function Documentation

◆ convert()

SensorResult VehicleSpeedConverter::convert ( float  frequency) const
inlineoverridevirtual

Implements SensorConverter.

Definition at line 6 of file vehicle_speed_converter.h.

6 {
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 }
static constexpr engine_configuration_s * engineConfiguration
static float frequency
Definition init_flex.cpp:21

The documentation for this class was generated from the following file: