HKG Resume Bug

When using stock HKG SCC there is a 1 in 20 chance the ECU will fault and cancel SCC when OP sends resume command. It has come to my attention that this usually happens after OP sends a resume command multiple times but the lead vehicle creeps within 3.7 meters and the SCC logic does not resume because of this. I would try modifying the code so that it remains as is, but does not attempt to resume unless the lead vehicle distance is reported as more than 3.7 meters and increasing. This may help remedy the issue although it may not be the root cause. Sending resume at and below 3.7 Meters is pointless as SCC will not resume anyway.
Example logic:
ACC_ObjDist
Stationary at X.X climbs to 3.7 <--- DO NOT RESUME
Stationary at X.X climbs to 3.8 <--- SEND RESUME PAST 3.7 (3.8)
Stationary at 4.8 <--- DO NOT RESUME
Stationary at 4.8 then climbs <--- SEND RESUME ON INCREASE (Greater than 3.7)
I am not sure that I get everything but this change to selfdrive/car/hyundai/carcontroller.py#L86 should help:
elif self.last_lead_distance < CS.lead_distance > 4.8 and (frame - self.last_resume_frame) > 5:
Wouldn’t it be:
S.lead_distance > 3.7
@xx979xx
a res hit is valid for 2 seconds, if the lead starts to move, hit res(spam), then we hope the lead moves > 3.7m with in 2 sec.
but right now we keep spamming as the lead distance keep changing.
@TK211X what about this:
Stationary at 4.8 <--- DO NOT RESUME
I don't get it
@xx979xx
The SCC has stopped and the lead vehicle is at 4.8 in the example and not moving forward so we would not hit resume.
The resume bug appears to be due to the parity bit.
SCC appears to fault due to an improper parity bit and command being received in the message order.

the difference between official and community branch, just adding to the discussion
@xps-genesis is this not an issue on the community fork?
i haven't seen this issue on the community branch. that said, this is a very random issue. so no idea if that change shown in the screenshot above really helps.