From 57db99700c0ec41764d8645cec34a99a5b237135 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Fri, 19 Nov 2021 05:02:36 +0800 Subject: [PATCH] panda: fix len_to_dlc always return 1 if len > 24 (#22964) --- selfdrive/boardd/panda.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/boardd/panda.cc b/selfdrive/boardd/panda.cc index 01c9f9fa8f..c72854a8d4 100644 --- a/selfdrive/boardd/panda.cc +++ b/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); } }