panda: fix len_to_dlc always return 1 if len > 24 (#22964)

old-commit-hash: 57db99700c0ec41764d8645cec34a99a5b237135
This commit is contained in:
Dean Lee
2021-11-19 05:02:36 +08:00
committed by GitHub
parent 9399b6ae61
commit 1cf28894e6
+2 -2
View File
@@ -357,9 +357,9 @@ uint8_t Panda::len_to_dlc(uint8_t len) {
return len;
}
if (len <= 24) {
return 8 + ((len - 8) / 4) + (len % 4) ? 1 : 0;
return 8 + ((len - 8) / 4) + ((len % 4) ? 1 : 0);
} else {
return 11 + (len / 16) + (len % 16) ? 1 : 0;
return 11 + (len / 16) + ((len % 16) ? 1 : 0);
}
}