rusefi/firmware/controllers/algo/trip_odometer.h

33 lines
719 B
C
Raw Normal View History

2023-09-25 13:16:17 -07:00
#pragma once
class TripOdometer : public EngineModule {
public:
void onSlowCallback() override;
void reset();
void consumeFuel(float grams, efitick_t nowNt);
uint32_t getConsumedGrams() const;
float getConsumptionGramPerSecond() const;
uint32_t getDistanceMeters() const;
2023-10-02 22:25:35 -07:00
uint32_t getIgnitionOnTime() const;
uint32_t getEngineRunTime() const;
2023-09-25 13:16:17 -07:00
private:
2023-10-02 22:14:03 -07:00
// Fuel consumed
2023-09-25 13:16:17 -07:00
uint32_t m_consumedGrams = 0;
float m_consumedRemainder = 0;
float m_rate = 0;
2023-10-02 22:14:03 -07:00
// Distance travelled
2023-09-25 13:16:17 -07:00
uint32_t m_distanceMeters = 0;
float m_distanceRemainder = 0;
2023-10-02 22:14:03 -07:00
// Engine run time and ign on time
uint32_t m_slowCallbackCounter = 0;
uint32_t m_ignitionOnSeconds = 0;
uint32_t m_engineRunningSeconds = 0;
2023-09-25 13:16:17 -07:00
Timer m_timer;
};