odometry output channels

This commit is contained in:
Matthew Kennedy 2023-10-03 01:25:35 -04:00 committed by rusefillc
parent 2a53e80e53
commit 463b3ea70e
4 changed files with 27 additions and 1 deletions

View File

@ -367,5 +367,12 @@ float mapFast
int16_t autoscale ambientTemp;;"deg C",{1/@@PACK_MULT_TEMPERATURE@@}, 0, 0, 0, 1
int16_t autoscale compressorDischargeTemp;;"deg C",{1/@@PACK_MULT_TEMPERATURE@@}, 0, 0, 0, 1
uint8_t[132 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
uint16_t autoscale compressorDischargePressure;;"kPa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 0, 1
uint16_t autoscale throttleInletPressure;;"kPa",{1/@@PACK_MULT_PRESSURE@@}, 0, 0, 0, 1
uint16_t ignitionOnTime;;"sec",1,0,0,0,1
uint16_t engineRunTime;;"sec",1,0,0,0,1
uint16_t autoscale distanceTraveled;;"km",0.1,0,0,0,1
uint8_t[124 iterate] unusedAtTheEnd;;"",1, 0, 0, 0, 0
end_struct

View File

@ -547,6 +547,11 @@ static void updateFuelResults() {
#if EFI_VEHICLE_SPEED
engine->outputChannels.fuelFlowRate = engine->module<TripOdometer>()->getConsumptionGramPerSecond();
engine->outputChannels.totalFuelConsumption = engine->module<TripOdometer>()->getConsumedGrams();
engine->outputChannels.ignitionOnTime = engine->module<TripOdometer>()->getIgnitionOnTime();
engine->outputChannels.engineRunTime = engine->module<TripOdometer>()->getEngineRunTime();
// output channel in km
engine->outputChannels.distanceTraveled = 0.001f * engine->module<TripOdometer>()->getDistanceMeters();
#endif // EFI_VEHICLE_SPEED
}

View File

@ -6,6 +6,10 @@ void TripOdometer::reset() {
m_distanceMeters = 0;
m_distanceRemainder = 0;
m_slowCallbackCounter = 0;
m_engineRunningSeconds = 0;
m_ignitionOnSeconds = 0;
}
void TripOdometer::consumeFuel(float grams, efitick_t nowNt) {
@ -64,3 +68,11 @@ void TripOdometer::onSlowCallback() {
uint32_t TripOdometer::getDistanceMeters() const {
return m_distanceMeters;
}
uint32_t TripOdometer::getIgnitionOnTime() const {
return m_ignitionOnSeconds;
}
uint32_t TripOdometer::getEngineRunTime() const {
return m_engineRunningSeconds;
}

View File

@ -10,6 +10,8 @@ public:
uint32_t getConsumedGrams() const;
float getConsumptionGramPerSecond() const;
uint32_t getDistanceMeters() const;
uint32_t getIgnitionOnTime() const;
uint32_t getEngineRunTime() const;
private:
// Fuel consumed