diff --git a/Software/src/devboard/webserver/webserver.cpp b/Software/src/devboard/webserver/webserver.cpp index b3c6d359..cd731c7f 100644 --- a/Software/src/devboard/webserver/webserver.cpp +++ b/Software/src/devboard/webserver/webserver.cpp @@ -93,7 +93,7 @@ void init_WiFi_STA(const char* ssid, const char* password) { } if (WiFi.status() == WL_CONNECTED) { // WL_CONNECTED is assigned when connected to a WiFi network wifi_connected = true; - wifi_state = "connected"; + wifi_state = "Connected"; // Print local IP address and start web server Serial.println(""); Serial.print("Connected to WiFi network: "); @@ -102,7 +102,7 @@ void init_WiFi_STA(const char* ssid, const char* password) { Serial.println(WiFi.localIP()); } else { wifi_connected = false; - wifi_state = "not connected"; + wifi_state = "Not connected"; Serial.print("Not connected to WiFi network: "); Serial.println(ssid); Serial.println("Please check WiFi network name and password, and if WiFi network is available."); @@ -125,6 +125,9 @@ String processor(const String& var) { content += "body { background-color: black; color: white; }"; content += ""; + // Start a new block with a specific background color + content += "
"; + // Display LED color content += "

LED color: "; switch (LEDcolor) { @@ -141,23 +144,86 @@ String processor(const String& var) { content += "RED

"; break; case TEST_ALL_COLORS: - content += "RAINBOW"; + content += "RGB Testing loop"; break; default: break; } // Display ssid of network connected to and, if connected to the WiFi, its own IP content += "

SSID: " + String(ssid) + "

"; - content += "

status: " + wifi_state + "

"; + content += "

Wifi status: " + wifi_state + "

"; if (wifi_connected == true) { content += "

IP: " + WiFi.localIP().toString() + "

"; } - // Assuming SOC is an integer - float socFloat = static_cast(SOC) / 100.0; // Convert to float and divide by 100 - float sohFloat = static_cast(StateOfHealth) / 100.0; // Convert to float and divide by 100 - float voltageFloat = static_cast(battery_voltage) / 10.0; // Convert to float and divide by 10 - float tempMaxFloat = static_cast(temperature_max) / 10.0; // Convert to float and divide by 10 - float tempMinFloat = static_cast(temperature_min) / 10.0; // Convert to float and divide by 10 + // Close the block + content += "
"; + + // Start a new block with a specific background color + content += "
"; + + // Display which components are used + content += "

Inverter protocol: "; +#ifdef BYD_CAN + content += "BYD Battery-Box Premium HVS over CAN Bus"; +#endif +#ifdef BYD_MODBUS + content += "BYD 11kWh HVM battery over Modbus RTU"; +#endif +#ifdef LUNA2000_MODBUS + content += "Luna2000 battery over Modbus RTU"; +#endif +#ifdef PYLON_CAN + content += "Pylontech battery over CAN bus"; +#endif +#ifdef SMA_CAN + content += "BYD Battery-Box H 8.9kWh, 7 mod over CAN bus"; +#endif +#ifdef SOFAR_CAN + content += "Sofar Energy Storage Inverter High Voltage BMS General Protocol (Extended Frame) over CAN bus"; +#endif +#ifdef SOLAX_CAN + content += "SolaX Triple Power LFP over CAN bus"; +#endif + content += "

"; + + content += "

Battery protocol: "; +#ifdef BMW_I3_BATTERY + content += "BMW i3"; +#endif +#ifdef CHADEMO_BATTERY + content += "Chademo V2X mode"; +#endif +#ifdef IMIEV_CZERO_ION_BATTERY + content += "I-Miev / C-Zero / Ion Triplet"; +#endif +#ifdef KIA_HYUNDAI_64_BATTERY + content += "Kia/Hyundai 64kWh"; +#endif +#ifdef NISSAN_LEAF_BATTERY + content += "Nissan LEAF"; +#endif +#ifdef RENAULT_ZOE_BATTERY + content += "Renault Zoe / Kangoo"; +#endif +#ifdef TESLA_MODEL_3_BATTERY + content += "Tesla Model S/3/X/Y"; +#endif +#ifdef TEST_FAKE_BATTERY + content += "Fake battery for testing purposes"; +#endif + content += "

"; + // Close the block + content += "
"; + + // Start a new block with a specific background color + content += "
"; + + // Display battery statistics within this block + float socFloat = static_cast(SOC) / 100.0; // Convert to float and divide by 100 + float sohFloat = static_cast(StateOfHealth) / 100.0; // Convert to float and divide by 100 + float voltageFloat = static_cast(battery_voltage) / 10.0; // Convert to float and divide by 10 + float tempMaxFloat = static_cast(temperature_max) / 10.0; // Convert to float and divide by 10 + float tempMinFloat = static_cast(temperature_min) / 10.0; // Convert to float and divide by 10 char socString[10]; char sohString[10]; char voltageString[10]; @@ -171,12 +237,11 @@ String processor(const String& var) { dtostrf(tempMaxFloat, 6, 1, tempMaxString); dtostrf(tempMinFloat, 6, 1, tempMinString); - //Display battery statistics - content += "

SOC: " + String(socString) +"

"; - content += "

SOH: " + String(sohString) +"

"; - content += "

Voltage: " + String(voltageString) + " V

"; - content += "

Current: " + String(battery_current) + " A

"; - content += "

Power: " + String(stat_batt_power) + " W

"; + content += "

SOC: " + String(socString) + "

"; + content += "

SOH: " + String(sohString) + "

"; + content += "

Voltage: " + String(voltageString) + " V

"; + content += "

Current: " + String(battery_current) + " A

"; + content += "

Power: " + String(stat_batt_power) + " W

"; content += "

Total capacity: " + String(capacity_Wh) + " Wh

"; content += "

Remaining capacity: " + String(remaining_capacity_Wh) + " Wh

"; content += "

Max discharge power: " + String(max_target_discharge_power) + " W

"; @@ -185,32 +250,29 @@ String processor(const String& var) { content += "

Cell min: " + String(cell_min_voltage) + " mV

"; content += "

Temperature max: " + String(tempMaxString) + " C

"; content += "

Temperature min: " + String(tempMinString) + " C

"; - content += "

BMS Status: " + String(bms_status) + " -

"; - if(bms_status == 3){ + if (bms_status == 3) { content += "

BMS Status: OK

"; - } - else{ + } else { content += "

BMS Status: FAULT

"; } - if(bms_char_dis_status == 2){ + if (bms_char_dis_status == 2) { content += "

Battery charging!

"; - } - else if (bms_char_dis_status == 1){ - content += "

Battery discharging!

"; - } - else{ //0 idle + } else if (bms_char_dis_status == 1) { + content += "

Battery discharging!

"; + } else { //0 idle content += "

Battery idle

"; } + // Close the block + content += "
"; content += ""; content += ""; - //Script for refreshing page content += ""; return content;