Skip to content

Commit f4f6b92

Browse files
committed
CAN Analog cast to int16 for correct sign
1 parent 61b89b3 commit f4f6b92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Firmware/FFBoard/UserExtensions/Src/CanAnalog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void CanAnalogBase::canRxPendCallback(CANPort* port,CAN_rx_msg& msg){
117117
continue;
118118
}
119119
for(uint8_t i = 0; i < 4 && (i + packet*4) < axes && (i*2+1) < msg.header.length; i++) {
120-
this->buf[i + packet*4] = msg.data[i*2] | (msg.data[i*2+1] << 8);
120+
this->buf[i + packet*4] = (int16_t)(msg.data[i*2] | (msg.data[i*2+1] << 8));
121121
}
122122
}
123123
}

0 commit comments

Comments
 (0)