mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Add filtering out invalid cellvoltages
This commit is contained in:
parent
650ba6bcbe
commit
22d6ba3dc3
1 changed files with 7 additions and 2 deletions
|
@ -177,8 +177,13 @@ void receive_can_battery(CAN_frame_t rx_frame) {
|
|||
voltage_index -= 4;
|
||||
temp_index -= 3;
|
||||
}
|
||||
cell_voltages[voltage_index] = voltage1;
|
||||
cell_voltages[voltage_index + 1] = voltage2;
|
||||
|
||||
if (voltage1 > 2.2) { // Only update cellvoltages incase we have a value
|
||||
cell_voltages[voltage_index] = voltage1;
|
||||
}
|
||||
if (voltage2 > 2.2) {
|
||||
cell_voltages[voltage_index + 1] = voltage2;
|
||||
}
|
||||
|
||||
if (pid_index == 0) {
|
||||
cell_temperatures[temp_index] = temp2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue