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