added brake bias

This commit is contained in:
2025-04-21 22:19:54 +01:00
parent f90199f0f6
commit a45f1b29cf
4 changed files with 22 additions and 0 deletions
+7
View File
@@ -7,14 +7,20 @@ struct DataReq {
uint8_t type;
};
// Car data
const int speedLen = 5;
const int gearLen = 3;
const int rpmLen = 6;
const int brakeBiasLen = 6;
// Lap data
const int lapNumberLen = 5;
const int DeltaToBestLapLen = 6;
const int bestLapTimeLen = 10;
const int currLapTimeLen = 10;
const int lastLapTimeLen = 10;
// Fuel data
const int FuelTankLen = 15;
const int FuelEstLen = 15;
@@ -34,6 +40,7 @@ struct DataPacket {
char speed[speedLen];
char gear[gearLen];
char rpm[rpmLen];
char brakeBias[brakeBiasLen];
char LapNumber[lapNumberLen];
char DeltaToBestLap[DeltaToBestLapLen];
char bestLapTime[bestLapTimeLen];
+13
View File
@@ -56,6 +56,7 @@ UIDecorations *lastLapDecor = new UIDecorations();
UIDecorations *curLapDecor = new UIDecorations();
UIDecorations *fuelTankDecor = new UIDecorations();
UIDecorations *fuelConsumptionDecor = new UIDecorations();
UIDecorations *brakeBiasDecor = new UIDecorations();
UIDecorations *relativeDecor = new UIDecorations();
UIString rpmText(gfx, UIDimensions(0, 0, 0, 0), rpmTextDecor, (char *)"RPM");
@@ -74,6 +75,8 @@ UIString fuelTank(gfx, UIDimensions(0, 0, 0, 0), fuelTankDecor,
(char *)"Fuel Tank");
UIString fuelConsumption(gfx, UIDimensions(0, 0, 0, 0), fuelConsumptionDecor,
(char *)"Fuel Consumption");
UIString brakeBias(gfx, UIDimensions(0, 0, 0, 0), brakeBiasDecor,
(char *)"Brakes");
void setup() {
psramInit();
@@ -196,6 +199,16 @@ void setup() {
ui->fuelConsumption->drawBox();
ui->fuelConsumption->Update("--.- | --.-");
// Brake bias
brakeBiasDecor->textSize = 3;
brakeBias.dims.height =
calculateHeight(brakeBiasDecor->titleSize, brakeBiasDecor->textSize, 1);
brakeBias.dims.width = calculateWidth(brakeBiasDecor->textSize, 5);
brakeBias.placeBelow(&fuelConsumption);
ui->brakeBias = &brakeBias;
ui->brakeBias->drawBox();
ui->brakeBias->Update("--.-");
// const char *words[] = {"hel", "wor", "why", "is", "thi", "hap", "to",
// "me"};
//
+1
View File
@@ -12,6 +12,7 @@ void DashUI::Update(DataPacket *p) {
this->curLap->Update(p->currLapTime);
this->lastLap->Update(p->lastLapTime);
this->fuelConsumption->Update(p->FuelEst);
this->brakeBias->Update(p->brakeBias);
for (int row = 0; row < ROWS; row++) {
this->relative->tableData[row * COLUMNS + 0]->Update(p->standings[row].Lap);
+1
View File
@@ -16,6 +16,7 @@ struct DashUI {
UIString *curLap;
UIString *fuelTank;
UIString *fuelConsumption;
UIString *brakeBias;
UITable *relative;
DashUI();