Add brake balance display

This commit is contained in:
Jasper Blanckenburg 2022-03-24 17:48:03 +01:00
parent 58b0b72c6d
commit 661e1a2274
2 changed files with 13 additions and 1 deletions

View File

@ -113,6 +113,15 @@ String get_value(Value val) {
return String(Vehicle_data.speed_fr);
case VAL_SPEED:
return String(Vehicle_data.speed);
case VAL_BBAL: {
double p_total =
Vehicle_data.p_brake_front + Vehicle_data.p_brake_rear / 2.398;
double bbal = p_total == 0 ? 0 : 100 * Vehicle_data.p_brake_front / p_total;
if (bbal >= 100) {
return "100";
}
return String(bbal, 2);
}
default:
return "???";
}
@ -160,6 +169,8 @@ String get_label(Value val) {
return "SPEED FR";
case VAL_SPEED:
return "SPEED";
case VAL_BBAL:
return "BBAL";
default:
return "???";
}

View File

@ -46,8 +46,9 @@ enum Value {
VAL_SPEED_FL,
VAL_SPEED_FR,
VAL_SPEED,
VAL_BBAL,
VAL_FIRST_LEFT_BOX = VAL_LAPTIME,
VAL_LAST = VAL_SPEED
VAL_LAST = VAL_BBAL
};
String get_value(Value val);
String get_label(Value val);