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

old-commit-hash: 57db99700c
commatwo_master
Dean Lee 3 years ago committed by GitHub
parent 9399b6ae61
commit 1cf28894e6
  1. 4
      selfdrive/boardd/panda.cc

@ -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);
}
}

Loading…
Cancel
Save