From 062c4ad86a428993f89215742782d1d7c96ab1b8 Mon Sep 17 00:00:00 2001 From: Cole Scott Date: Sun, 2 Aug 2020 13:40:20 -0700 Subject: [PATCH] Add mbed header and fix undefined behavior in can header --- bms/src/Can.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bms/src/Can.h b/bms/src/Can.h index e1c4a28..1bc332f 100644 --- a/bms/src/Can.h +++ b/bms/src/Can.h @@ -4,6 +4,8 @@ #include +#include "mbed.h" + // SIDs From Accumulator constexpr uint32_t kFuncIdHeartBeatAcc = 0x701; constexpr uint32_t kFuncIdCellStartup = 0x420; @@ -48,7 +50,7 @@ CANMessage BMSVoltageMessage (uint8_t row, uint16_t * voltages) { uint8_t data[8]; for (int i = 0; i < 8; i += 2) { data[i] = voltages[i/2] >> 8; - data[++i] = voltages [i/2]; + data[i + 1] = voltages [i/2]; } return CANMessage(kFuncIdCellVoltage[row], data); }