mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Simplify color changing switchcase
This commit is contained in:
parent
da9d45cd69
commit
d27a660c20
1 changed files with 11 additions and 9 deletions
|
@ -465,27 +465,29 @@ String processor(const String& var) {
|
||||||
content += "</div>";
|
content += "</div>";
|
||||||
|
|
||||||
// Start a new block with a specific background color. Color changes depending on BMS status
|
// Start a new block with a specific background color. Color changes depending on BMS status
|
||||||
|
content += "<div style='background-color: ";
|
||||||
switch (LEDcolor) {
|
switch (LEDcolor) {
|
||||||
case GREEN:
|
case GREEN:
|
||||||
content += "<div style='background-color: #2D3F2F; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
|
content += "#2D3F2F;";
|
||||||
break;
|
break;
|
||||||
case YELLOW:
|
case YELLOW:
|
||||||
content += "<div style='background-color: #F5CC00; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
|
content += "#F5CC00;";
|
||||||
break;
|
break;
|
||||||
case BLUE:
|
case BLUE:
|
||||||
content += "<div style='background-color: #2B35AF; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
|
case TEST_ALL_COLORS:
|
||||||
|
content += "#2B35AF;"; // Blue in test mode
|
||||||
break;
|
break;
|
||||||
case RED:
|
case RED:
|
||||||
content += "<div style='background-color: #A70107; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
|
content += "#A70107;";
|
||||||
break;
|
break;
|
||||||
case TEST_ALL_COLORS: //Blue in test mode
|
default: // Some new color, make background green
|
||||||
content += "<div style='background-color: #2B35AF; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
|
content += "#2D3F2F;";
|
||||||
break;
|
|
||||||
default: //Some new color, make background green
|
|
||||||
content += "<div style='background-color: #2D3F2F; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the common style properties
|
||||||
|
content += "padding: 10px; margin-bottom: 10px; border-radius: 50px;'>";
|
||||||
|
|
||||||
// Display battery statistics within this block
|
// Display battery statistics within this block
|
||||||
float socRealFloat = static_cast<float>(system_real_SOC_pptt) / 100.0; // Convert to float and divide by 100
|
float socRealFloat = static_cast<float>(system_real_SOC_pptt) / 100.0; // Convert to float and divide by 100
|
||||||
float socScaledFloat = static_cast<float>(system_scaled_SOC_pptt) / 100.0; // Convert to float and divide by 100
|
float socScaledFloat = static_cast<float>(system_scaled_SOC_pptt) / 100.0; // Convert to float and divide by 100
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue