Skip to content

Commit 7b3bf3d

Browse files
committed
Add mbed header and fix undefined behavior in can header
1 parent 8c27a59 commit 7b3bf3d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bms/src/Can.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include <stdint.h>
66

7+
#include "mbed.h"
8+
79
// SIDs From Accumulator
810
constexpr uint32_t kFuncIdHeartBeatAcc = 0x701;
911
constexpr uint32_t kFuncIdCellStartup = 0x420;
@@ -48,7 +50,7 @@ CANMessage BMSVoltageMessage (uint8_t row, uint16_t * voltages) {
4850
uint8_t data[8];
4951
for (int i = 0; i < 8; i += 2) {
5052
data[i] = voltages[i/2] >> 8;
51-
data[++i] = voltages [i/2];
53+
data[i + 1] = voltages [i/2];
5254
}
5355
return CANMessage(kFuncIdCellVoltage[row], data);
5456
}

0 commit comments

Comments
 (0)