Implemented remaining estimate km left
This commit is contained in:
@@ -132,6 +132,12 @@ class AverageSpeedKmhOverTime : public virtual espgui::TextInterface {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class EstimatedKmLeft : public virtual espgui::TextInterface {
|
||||||
|
public: std::string text() const override {
|
||||||
|
return fmt::format("est km:{}", getRemainingEstimateRangeString());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class EfficiencyTextColor : public virtual espgui::ColorInterface {
|
class EfficiencyTextColor : public virtual espgui::ColorInterface {
|
||||||
public:
|
public:
|
||||||
int color() const override
|
int color() const override
|
||||||
|
@@ -24,6 +24,11 @@ float getAvgKmh()
|
|||||||
return (drivingStatistics.meters_driven / 1000.) / (drivingStatistics.currentDrivingTime.count() / 1000 / 60 / 60); // (meter / 1000) / (ms / 1000 / 60 / 60)
|
return (drivingStatistics.meters_driven / 1000.) / (drivingStatistics.currentDrivingTime.count() / 1000 / 60 / 60); // (meter / 1000) / (ms / 1000 / 60 / 60)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float getEstimatedKmLeft()
|
||||||
|
{
|
||||||
|
return (getRemainingWattHours() / getAvgWhPerKm());
|
||||||
|
}
|
||||||
|
|
||||||
std::string getEfficiencyClassString()
|
std::string getEfficiencyClassString()
|
||||||
{
|
{
|
||||||
const float avgWhPerKm = getAvgWhPerKm();
|
const float avgWhPerKm = getAvgWhPerKm();
|
||||||
@@ -54,6 +59,12 @@ uint16_t getEfficiencyClassColor()
|
|||||||
else return 0xF800;
|
else return 0xF800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getRemainingEstimateRangeString()
|
||||||
|
{
|
||||||
|
return fmt::format("{:.1f} km", getEstimatedKmLeft());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void initStatistics()
|
void initStatistics()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -20,5 +20,7 @@ void initStatistics();
|
|||||||
void calculateStatistics();
|
void calculateStatistics();
|
||||||
float getAvgWhPerKm();
|
float getAvgWhPerKm();
|
||||||
float getAvgKmh();
|
float getAvgKmh();
|
||||||
|
float getEstimatedKmLeft();
|
||||||
std::string getEfficiencyClassString();
|
std::string getEfficiencyClassString();
|
||||||
|
std::string getRemainingEstimateRangeString();
|
||||||
uint16_t getEfficiencyClassColor();
|
uint16_t getEfficiencyClassColor();
|
||||||
|
Reference in New Issue
Block a user