From af2518ad8dca7d6d6818e40695e1cdf55472b1ef Mon Sep 17 00:00:00 2001 From: mawei Date: Thu, 8 Oct 2026 20:42:36 +0800 Subject: [PATCH] volkswagen: cast the MEB flag check to bool --- opendbc_repo/opendbc/car/volkswagen/carstate.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/opendbc_repo/opendbc/car/volkswagen/carstate.py b/opendbc_repo/opendbc/car/volkswagen/carstate.py index 983d81273..278302c25 100644 --- a/opendbc_repo/opendbc/car/volkswagen/carstate.py +++ b/opendbc_repo/opendbc/car/volkswagen/carstate.py @@ -298,9 +298,11 @@ class CarState(CarStateBase): tsk_faulted = pt_cp.vl["Motor_51"]["TSK_Status"] in (6, 7) engine_off = pt_cp.vl["Motor_54"]["Engine_On"] == 0 - # Long_Control_Inhibit is currently identified only in the MEB DBC, not in the MQB EVO one - long_control_inhibit = (self.CP.flags & VolkswagenFlags.MEB and - pt_cp.vl["VMM_02"]["Long_Control_Inhibit"] == 2) + # Long_Control_Inhibit is currently identified only in the MEB DBC, not in the MQB EVO one. + # bool() is required: CP.flags is an int, so "& IntFlag" returns an IntFlag instance and the + # False case (MQB EVO) would leak that object into the capnp bool field carNotReady. + long_control_inhibit = (bool(self.CP.flags & VolkswagenFlags.MEB) + and pt_cp.vl.get("VMM_02", {}).get("Long_Control_Inhibit", 0) == 2) ret.accFaulted = (self.update_acc_fault(tsk_faulted, engine_off, long_control_inhibit) or ext_cp.vl["AWV_03"]["AWV_Unavailable"] == 1) # AEB unavailable (i.e. radar covered)