diff --git a/Software/Software.ino b/Software/Software.ino index 7bea8eb6..008ffea8 100644 --- a/Software/Software.ino +++ b/Software/Software.ino @@ -586,7 +586,7 @@ void receive_can2() { // This function is similar to receive_can, but just take #endif #ifdef DOUBLE_BATTERY receive_can_battery2(rx_frame_can2); -#endif +#endif //DOUBLE_BATTERY } } @@ -614,7 +614,7 @@ void handle_CAN_contactors() { (uint8_t)(abs(datalayer.battery.status.voltage_dV - datalayer.battery2.status.voltage_dV) / 10)); } } -#endif +#endif //DOUBLE_BATTERY #ifdef CONTACTOR_CONTROL void handle_contactors() { @@ -739,7 +739,7 @@ void update_SOC() { #ifdef DOUBLE_BATTERY datalayer.battery.status.reported_soc = (datalayer.battery.status.real_soc + datalayer.battery2.status.real_soc) / 2; -#endif +#endif //DOUBLE_BATTERY } #ifdef DOUBLE_BATTERY datalayer.battery.status.reported_soc = (datalayer.battery.status.real_soc + datalayer.battery2.status.real_soc) / 2; @@ -758,7 +758,7 @@ void update_SOC() { datalayer.battery.status.reported_soc = datalayer.battery2.status.real_soc; } -#endif //TODO: Constrain according to the user settings. Help wanted on algoritm to use. +#endif //DOUBLE_BATTERY } void update_values_inverter() { diff --git a/Software/src/battery/NISSAN-LEAF-BATTERY.cpp b/Software/src/battery/NISSAN-LEAF-BATTERY.cpp index 99c13777..48e527cb 100644 --- a/Software/src/battery/NISSAN-LEAF-BATTERY.cpp +++ b/Software/src/battery/NISSAN-LEAF-BATTERY.cpp @@ -1249,6 +1249,12 @@ void setup_battery(void) { // Performs one time setup at startup datalayer.battery.info.max_design_voltage_dV = 4040; // 404.4V, over this, charging is not possible (goes into forced discharge) datalayer.battery.info.min_design_voltage_dV = 2600; // 260.0V under this, discharging further is disabled + +#ifdef DOUBLE_BATTERY + datalayer.battery2.info.number_of_cells = datalayer.battery.info.number_of_cells; + datalayer.battery2.info.max_design_voltage_dV = datalayer.battery.info.max_design_voltage_dV; + datalayer.battery2.info.min_design_voltage_dV = datalayer.battery.info.min_design_voltage_dV; +#endif //DOUBLE_BATTERY } #endif diff --git a/Software/src/devboard/webserver/cellmonitor_html.cpp b/Software/src/devboard/webserver/cellmonitor_html.cpp index cb514bb0..21a5c1df 100644 --- a/Software/src/devboard/webserver/cellmonitor_html.cpp +++ b/Software/src/devboard/webserver/cellmonitor_html.cpp @@ -12,13 +12,25 @@ String cellmonitor_processor(const String& var) { content += ".cell { width: 48%; margin: 1%; padding: 10px; border: 1px solid white; text-align: center; }"; content += ".low-voltage { color: red; }"; // Style for low voltage text content += ".voltage-values { margin-bottom: 10px; }"; // Style for voltage values section +#ifdef DOUBLE_BATTERY + content += + "#graph, #graph2 {display: flex;align-items: flex-end;height: 200px;border: 1px solid #ccc;position: " + "relative;}"; +#else content += "#graph {display: flex;align-items: flex-end;height: 200px;border: 1px solid #ccc;position: relative;}"; +#endif content += ".bar {margin: 0 0px;background-color: blue;display: inline-block;position: relative;cursor: pointer;border: " "1px solid white; /* Add this line */}"; +#ifdef DOUBLE_BATTERY + content += "#valueDisplay, #valueDisplay2 {text-align: left;font-weight: bold;margin-top: 10px;}"; +#else content += "#valueDisplay {text-align: left;font-weight: bold;margin-top: 10px;}"; +#endif content += ""; + content += ""; + // Start a new block with a specific background color content += "
"; @@ -33,7 +45,26 @@ String cellmonitor_processor(const String& var) { // Close the block content += "
"; + +#ifdef DOUBLE_BATTERY + // Start a new block with a specific background color + content += "
"; + + // Display max, min, and deviation voltage values + content += "
"; + // Display cells + content += "
"; + // Display bars + content += "
"; + // Display single hovered value + content += "
Value: ...
"; + + // Close the block + content += "
"; + content += ""; +#endif // DOUBLE_BATTERY + content += ""; return content;