mirror of https://github.com/rusefi/canable-fw.git
Fixed extended id support for transmitting CAN messages
This commit is contained in:
parent
e7118b2d5e
commit
660c4eb621
23
Src/slcan.c
23
Src/slcan.c
|
@ -121,14 +121,25 @@ int8_t slcan_parse_str(char *buf, uint8_t len) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
uint8_t id_len = frame.IDE == CAN_ID_EXT ? SLCAN_EXT_ID_LEN : SLCAN_STD_ID_LEN;
|
||||
frame.StdId = 0;
|
||||
i = 1;
|
||||
while (i <= id_len) {
|
||||
frame.StdId += buf[i++];
|
||||
frame.StdId *= 16;
|
||||
frame.ExtId = 0;
|
||||
if (frame.IDE == CAN_ID_EXT) {
|
||||
uint8_t id_len = SLCAN_EXT_ID_LEN;
|
||||
i = 1;
|
||||
while (i <= id_len) {
|
||||
frame.ExtId *= 16;
|
||||
frame.ExtId += buf[i++];
|
||||
}
|
||||
}
|
||||
frame.StdId /= 16;
|
||||
else {
|
||||
uint8_t id_len = SLCAN_STD_ID_LEN;
|
||||
i = 1;
|
||||
while (i <= id_len) {
|
||||
frame.StdId *= 16;
|
||||
frame.StdId += buf[i++];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
frame.DLC = buf[i++];
|
||||
if (frame.DLC < 0 || frame.DLC > 8) {
|
||||
|
|
Loading…
Reference in New Issue