diff --git a/src/data.h b/src/data.h index a24c8b2..e89cdcb 100644 --- a/src/data.h +++ b/src/data.h @@ -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]; diff --git a/src/main.cpp b/src/main.cpp index 2ea2433..c9ff651 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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"}; // diff --git a/src/ui.cpp b/src/ui.cpp index 2278180..810a9a4 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -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); diff --git a/src/ui.h b/src/ui.h index 56b00e2..5985e27 100644 --- a/src/ui.h +++ b/src/ui.h @@ -16,6 +16,7 @@ struct DashUI { UIString *curLap; UIString *fuelTank; UIString *fuelConsumption; + UIString *brakeBias; UITable *relative; DashUI();