Brake temps & pressures, total distance
This commit is contained in:
@ -13,7 +13,7 @@ CountedEnum(DataFieldType, size_t, DF_TSState, DF_ASState, DF_ActiveMission,
|
||||
DF_IniChkState, DF_LapCount, DF_TireTempFL, DF_TireTempFR,
|
||||
DF_TireTempRL, DF_TireTempRR, DF_MinCellVolt, DF_MaxCellTemp,
|
||||
DF_TSSoC, DF_LVSoC, DF_TSCurrent, DF_TSVoltageBat, DF_TSVoltageVeh,
|
||||
DF_Speed, DF_BBal);
|
||||
DF_Speed, DF_BBal, DF_BPF, DF_BPR, DF_DistanceTotal);
|
||||
|
||||
enum class NamedFieldKind { Float, Bool, Text, Int };
|
||||
|
||||
|
||||
@ -19,11 +19,14 @@ public:
|
||||
*/
|
||||
void setTempThresholds(int *thresholds);
|
||||
|
||||
void setSmallText(bool small);
|
||||
|
||||
protected:
|
||||
private:
|
||||
int temp;
|
||||
int tempThresholds[4];
|
||||
Unicode::UnicodeChar valueBuffer[3];
|
||||
Unicode::UnicodeChar valueBuffer[4];
|
||||
bool small;
|
||||
|
||||
void updateValueBuffer();
|
||||
};
|
||||
|
||||
@ -270,6 +270,10 @@ NamedFieldDescription dataFieldDescs[] = {
|
||||
VEH_FIELD(ts_voltage_veh)},
|
||||
[DF_Speed] = {NamedFieldKind::Float, "SPEED", 3, 0, VEH_FIELD(speed)},
|
||||
[DF_BBal] = {NamedFieldKind::Float, "BBAL", 3, 1, get_zero},
|
||||
[DF_BPF] = {NamedFieldKind::Float, "BPF", 3, 1, VEH_FIELD(brake_press_f)},
|
||||
[DF_BPR] = {NamedFieldKind::Float, "BPR", 3, 1, VEH_FIELD(brake_press_r)},
|
||||
[DF_DistanceTotal] = {NamedFieldKind::Float, "DIST", 3, 1,
|
||||
VEH_FIELD(distance_total)},
|
||||
};
|
||||
|
||||
static_assert(sizeof(dataFieldDescs) / sizeof(dataFieldDescs[0]) ==
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "texts/TextKeysAndLanguages.hpp"
|
||||
#include "touchgfx/Color.hpp"
|
||||
#include "touchgfx/Unicode.hpp"
|
||||
|
||||
@ -9,7 +10,10 @@ Temperature::Temperature() : temp{0}, tempThresholds{0, 0, 0, 0} {
|
||||
updateValueBuffer();
|
||||
}
|
||||
|
||||
void Temperature::initialize() { TemperatureBase::initialize(); }
|
||||
void Temperature::initialize() {
|
||||
TemperatureBase::initialize();
|
||||
setSmallText(false);
|
||||
}
|
||||
|
||||
void Temperature::setTemp(int temp_in_celsius) {
|
||||
if (temp_in_celsius < 0) {
|
||||
@ -42,10 +46,25 @@ void Temperature::setTempThresholds(int *thresholds) {
|
||||
memcpy(tempThresholds, thresholds, sizeof(tempThresholds));
|
||||
}
|
||||
|
||||
void Temperature::setSmallText(bool small_) {
|
||||
this->small = small_;
|
||||
if (small_) {
|
||||
value.setTypedText(T_NUMBERSMALLWILDCARD);
|
||||
value.setHeight(33);
|
||||
value.setY(14);
|
||||
} else {
|
||||
value.setTypedText(T_NUMBERWILDCARD);
|
||||
value.setHeight(50);
|
||||
value.setY(0);
|
||||
}
|
||||
updateValueBuffer();
|
||||
}
|
||||
|
||||
void Temperature::updateValueBuffer() {
|
||||
// Unicode::utoa(temp, valueBuffer, 3, 10);
|
||||
const char *format = small ? "%03d" : "%02d";
|
||||
Unicode::snprintf(valueBuffer,
|
||||
sizeof(valueBuffer) / sizeof(Unicode::UnicodeChar), "%02d",
|
||||
sizeof(valueBuffer) / sizeof(Unicode::UnicodeChar), format,
|
||||
temp);
|
||||
value.setWildcard(valueBuffer);
|
||||
}
|
||||
|
||||
@ -17,11 +17,20 @@ void DriverViewView::setupScreen() {
|
||||
getField(i).setType(fieldTypes[i]);
|
||||
}
|
||||
fieldTypeSelection.setNumberOfItems(DataFieldType_COUNT);
|
||||
int tireThresholds[4] = {35, 40, 50, 60};
|
||||
tireTempFL.setTempThresholds(tireThresholds);
|
||||
tireTempFR.setTempThresholds(tireThresholds);
|
||||
tireTempRL.setTempThresholds(tireThresholds);
|
||||
tireTempRR.setTempThresholds(tireThresholds);
|
||||
// int tireThresholds[4] = {35, 40, 50, 60};
|
||||
// tireTempFL.setTempThresholds(tireThresholds);
|
||||
// tireTempFR.setTempThresholds(tireThresholds);
|
||||
// tireTempRL.setTempThresholds(tireThresholds);
|
||||
// tireTempRR.setTempThresholds(tireThresholds);
|
||||
int brakeThresholds[4] = {100, 150, 200, 250};
|
||||
tireTempFL.setSmallText(true);
|
||||
tireTempFL.setTempThresholds(brakeThresholds);
|
||||
tireTempFR.setSmallText(true);
|
||||
tireTempFR.setTempThresholds(brakeThresholds);
|
||||
tireTempRL.setSmallText(true);
|
||||
tireTempRL.setTempThresholds(brakeThresholds);
|
||||
tireTempRR.setSmallText(true);
|
||||
tireTempRR.setTempThresholds(brakeThresholds);
|
||||
int invThresholds[4] = {30, 40, 50, 60};
|
||||
invTempL.setTempThresholds(invThresholds);
|
||||
invTempR.setTempThresholds(invThresholds);
|
||||
@ -49,10 +58,10 @@ void DriverViewView::updateFieldValues() {
|
||||
}
|
||||
|
||||
void DriverViewView::setTemps(const Temperatures &temps) {
|
||||
tireTempFL.setTemp(roundf(temps.tire_fl));
|
||||
tireTempFR.setTemp(roundf(temps.tire_fr));
|
||||
tireTempRL.setTemp(roundf(temps.tire_rl));
|
||||
tireTempRR.setTemp(roundf(temps.tire_rr));
|
||||
tireTempFL.setTemp(roundf(temps.brake_fl));
|
||||
tireTempFR.setTemp(roundf(temps.brake_fr));
|
||||
tireTempRL.setTemp(roundf(temps.brake_rl));
|
||||
tireTempRR.setTemp(roundf(temps.brake_rr));
|
||||
invTempL.setTemp(roundf(temps.inv_l));
|
||||
invTempR.setTemp(roundf(temps.inv_r));
|
||||
motorTempL.setTemp(roundf(temps.mot_l));
|
||||
|
||||
Reference in New Issue
Block a user