mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-06 21:32:08 +08:00
Merge branch 'devel-en' into devel-zht
This commit is contained in:
Binary file not shown.
@@ -125,6 +125,7 @@ keys = {
|
||||
"DragonChargingCtrl": [TxType.PERSISTENT],
|
||||
"DragonCharging": [TxType.PERSISTENT],
|
||||
"DragonDisCharging": [TxType.PERSISTENT],
|
||||
"DragonToyotaLaneDepartureWarning": [TxType.PERSISTENT],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ class CarController(object):
|
||||
self.dragon_enable_steering_on_signal = False
|
||||
self.dragon_allow_gas = False
|
||||
self.dragon_lat_ctrl = True
|
||||
self.dragon_lane_departure_warning = True
|
||||
|
||||
def update(self, enabled, CS, frame, actuators,
|
||||
pcm_cancel_cmd, hud_alert, forwarding_camera, left_line,
|
||||
@@ -131,6 +132,7 @@ class CarController(object):
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl") == "0" else True
|
||||
self.dragon_lane_departure_warning = False if params.get("DragonToyotaLaneDepartureWarning") == "0" else True
|
||||
|
||||
# *** compute control surfaces ***
|
||||
|
||||
@@ -293,8 +295,16 @@ class CarController(object):
|
||||
if pcm_cancel_cmd:
|
||||
send_ui = True
|
||||
|
||||
# dragonpilot, lane depart warning mod
|
||||
if self.dragon_lane_departure_warning:
|
||||
dragon_left_lane_depart = left_lane_depart
|
||||
dragon_right_lane_depart = right_lane_depart
|
||||
else:
|
||||
dragon_left_lane_depart = False
|
||||
dragon_right_lane_depart = False
|
||||
|
||||
if (frame % 100 == 0 or send_ui) and ECU.CAM in self.fake_ecus:
|
||||
can_sends.append(create_ui_command(self.packer, steer, pcm_cancel_cmd, left_line, right_line, left_lane_depart, right_lane_depart))
|
||||
can_sends.append(create_ui_command(self.packer, steer, pcm_cancel_cmd, left_line, right_line, dragon_left_lane_depart, dragon_right_lane_depart))
|
||||
|
||||
if frame % 100 == 0 and ECU.DSU in self.fake_ecus and self.car_fingerprint not in TSS2_CAR:
|
||||
can_sends.append(create_fcw_command(self.packer, fcw))
|
||||
|
||||
@@ -45,6 +45,7 @@ default_conf = {
|
||||
'DragonChargingCtrl': '0',
|
||||
'DragonCharging': 70,
|
||||
'DragonDisCharging': 60,
|
||||
'DragonToyotaLaneDepartureWarning': '1',
|
||||
}
|
||||
|
||||
deprecated_conf = {
|
||||
|
||||
+14
-7
@@ -287,7 +287,7 @@ def thermald_thread():
|
||||
dragon_charging_ctrl = True if params.get('DragonChargingCtrl') == "1" else False
|
||||
dragon_charging_max = int(params.get('DragonCharging'))
|
||||
dragon_discharging_min = int(params.get('DragonDisCharging'))
|
||||
ts_last_charging_ctrl = ts
|
||||
ts_last_update_vars = ts
|
||||
|
||||
# update ip every 10 seconds
|
||||
if ts - ts_last_ip > 10.:
|
||||
@@ -306,12 +306,19 @@ def thermald_thread():
|
||||
ts_last_ip = ts
|
||||
msg.thermal.ipAddr = "IP: %s" % ip_addr
|
||||
|
||||
# we only update charging status once per min
|
||||
if dragon_charging_ctrl and ts - ts_last_charging_ctrl > 60.:
|
||||
if msg.thermal.batteryPercent >= dragon_charging_max:
|
||||
os.system('echo "0" > /sys/class/power_supply/battery/charging_enabled')
|
||||
if msg.thermal.batteryPercent <= dragon_discharging_min:
|
||||
os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled')
|
||||
# we only update charging status once every min
|
||||
if ts - ts_last_charging_ctrl > 60.:
|
||||
if dragon_charging_ctrl:
|
||||
if msg.thermal.batteryPercent >= dragon_charging_max and not charging_disabled:
|
||||
os.system('echo "0" > /sys/class/power_supply/battery/charging_enabled')
|
||||
charging_disabled = True
|
||||
if msg.thermal.batteryPercent <= dragon_discharging_min and charging_disabled:
|
||||
os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled')
|
||||
charging_disabled = False
|
||||
else:
|
||||
if charging_disabled:
|
||||
os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled')
|
||||
charging_disabled = False
|
||||
ts_last_charging_ctrl = ts
|
||||
|
||||
# report to server once per minute
|
||||
|
||||
Reference in New Issue
Block a user