From 661e1a227447df5cb79633a5491dbc9be6d8cf3f Mon Sep 17 00:00:00 2001 From: Jasper Date: Thu, 24 Mar 2022 17:48:03 +0100 Subject: [PATCH] Add brake balance display --- lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.cpp | 11 +++++++++++ lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.cpp b/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.cpp index 675508e..8a26035 100644 --- a/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.cpp +++ b/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.cpp @@ -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 "???"; } diff --git a/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h b/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h index b7188fc..d669d73 100644 --- a/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h +++ b/lib/FT18_STW_DISPLAY/FT18_STW_DISPLAY.h @@ -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);