|
|
@ -84,14 +84,21 @@ def create_friction_brake_command(packer, bus, apply_brake, idx, near_stop, at_f |
|
|
|
|
|
|
|
|
|
|
|
return packer.make_can_msg("EBCMFrictionBrakeCmd", bus, values) |
|
|
|
return packer.make_can_msg("EBCMFrictionBrakeCmd", bus, values) |
|
|
|
|
|
|
|
|
|
|
|
def create_acc_dashboard_command(bus, acc_engaged, target_speed_ms, lead_car_in_sight): |
|
|
|
def create_acc_dashboard_command(packer, bus, acc_engaged, target_speed_kph, lead_car_in_sight): |
|
|
|
engaged = 0x90 if acc_engaged else 0 |
|
|
|
# Not a bit shift, dash can round up based on low 4 bits. |
|
|
|
lead_car = 0x10 if lead_car_in_sight else 0 |
|
|
|
target_speed = int(target_speed_kph * 16) & 0xfff |
|
|
|
target_speed = int(target_speed_ms * 208) & 0xfff |
|
|
|
|
|
|
|
speed_high = target_speed >> 8 |
|
|
|
values = { |
|
|
|
speed_low = target_speed & 0xff |
|
|
|
"ACCAlwaysOne" : 1, |
|
|
|
dat = [0x01, 0x00, engaged | speed_high, speed_low, 0x01, lead_car] |
|
|
|
"ACCResumeButton" : 0, |
|
|
|
return [0x370, 0, "".join(map(chr, dat)), bus] |
|
|
|
"ACCSpeedSetpoint" : target_speed, |
|
|
|
|
|
|
|
"ACCGapLevel" : 3 * acc_engaged, # 3 "far", 0 "inactive" |
|
|
|
|
|
|
|
"ACCCmdActive" : acc_engaged, |
|
|
|
|
|
|
|
"ACCAlwaysOne2" : 1, |
|
|
|
|
|
|
|
"ACCLeadCar" : lead_car_in_sight |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return packer.make_can_msg("ASCMActiveCruiseControlStatus", bus, values) |
|
|
|
|
|
|
|
|
|
|
|
def create_adas_time_status(bus, tt, idx): |
|
|
|
def create_adas_time_status(bus, tt, idx): |
|
|
|
dat = [(tt >> 20) & 0xff, (tt >> 12) & 0xff, (tt >> 4) & 0xff, |
|
|
|
dat = [(tt >> 20) & 0xff, (tt >> 12) & 0xff, (tt >> 4) & 0xff, |
|
|
|