diff --git a/apk/ai.comma.plus.offroad.apk b/apk/ai.comma.plus.offroad.apk index eca50d1f7..df66f0b1f 100644 Binary files a/apk/ai.comma.plus.offroad.apk and b/apk/ai.comma.plus.offroad.apk differ diff --git a/common/params.py b/common/params.py index 754efff3a..3777a2756 100755 --- a/common/params.py +++ b/common/params.py @@ -125,6 +125,7 @@ keys = { "DragonChargingCtrl": [TxType.PERSISTENT], "DragonCharging": [TxType.PERSISTENT], "DragonDisCharging": [TxType.PERSISTENT], + "DragonToyotaLaneDepartureWarning": [TxType.PERSISTENT], } diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index b03dc42a1..3c57c0b43 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -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)) diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py index e09f7ea5a..cf7d9886c 100644 --- a/selfdrive/dragonpilot/dragonconf/__init__.py +++ b/selfdrive/dragonpilot/dragonconf/__init__.py @@ -45,6 +45,7 @@ default_conf = { 'DragonChargingCtrl': '0', 'DragonCharging': 70, 'DragonDisCharging': 60, + 'DragonToyotaLaneDepartureWarning': '1', } deprecated_conf = { diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index 1e795b93a..94e64c70c 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -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