Bug in CAN output corrected.

This commit is contained in:
Martin Jäger
2018-03-13 20:06:57 +01:00
parent c26ca16bc7
commit 978cfd34aa
4 changed files with 15 additions and 12 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ void can_pub_msg(DataObject_t data_obj)
msg.type = CANData;
msg.id = msg_priority << 26
| (1U << 24) | (1U << 24) // identify as publication message
| (1U << 24) | (1U << 25) // identify as publication message
| data_obj.id << 8
| can_node_id;
@@ -102,7 +102,7 @@ void can_pub_msg(DataObject_t data_obj)
msg.data[2] = exponent_abs;
}
else if (data_obj.exponent < 0 && data_obj.exponent > -24) {
msg.data[2] = (exponent_abs - 1) & 0x20; // negative uint8
msg.data[2] = (exponent_abs - 1) | 0x20; // negative uint8
}
// value as positive or negative uint32