diff --git a/main.cpp b/main.cpp index 915c327..c229ac9 100644 --- a/main.cpp +++ b/main.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "stm32f1xx_hal.h" @@ -1650,8 +1651,8 @@ void applyIncomingCanMessage() case MotorController ::Command::NMotMax: right.rtP.n_max = *((uint16_t*)buf) << 4; break; case MotorController::Command::FieldWeakMax: left .rtP.id_fieldWeakMax = (int16_t(*((uint8_t*)buf)) * AMPERE2BIT_CONV) << 4; break; case MotorController ::Command::FieldWeakMax: right.rtP.id_fieldWeakMax = (int16_t(*((uint8_t*)buf)) * AMPERE2BIT_CONV) << 4; break; - case MotorController::Command::PhaseAdvMax: left .rtP.a_phaAdvMax = *((uint16_t*)buf) << 4; break; - case MotorController ::Command::PhaseAdvMax: right.rtP.a_phaAdvMax = *((uint16_t*)buf) << 4; break; + case MotorController::Command::PhaseAdvMax: left .rtP.a_phaAdvMax = ((uint16_t)*((uint8_t*)buf)) << 4; break; + case MotorController ::Command::PhaseAdvMax: right.rtP.a_phaAdvMax = ((uint16_t)*((uint8_t*)buf)) << 4; break; case MotorController::Command::CruiseCtrlEna: left .rtP.b_cruiseCtrlEna = *((bool*)buf); break; case MotorController ::Command::CruiseCtrlEna: right.rtP.b_cruiseCtrlEna = *((bool*)buf); break; case MotorController::Command::CruiseMotTgt: left .rtP.n_cruiseMotTgt = *((int16_T*)buf); break;