diff --git a/README.md b/README.md index 7db3d306c..16562ca0f 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Supported Cars | Toyota | Highlander Hybrid 2017-19 | All | Yes | Yes2| 0mph | 0mph | Toyota | | Toyota | Prius 2016 | TSS-P | Yes | Yes2| 0mph | 0mph | Toyota | | Toyota | Prius 2017-19 | All | Yes | Yes2| 0mph | 0mph | Toyota | -| Toyota | Prius Prime 2017-19 | All | Yes | Yes2| 0mph | 0mph | Toyota | +| Toyota | Prius Prime 2017-20 | All | Yes | Yes2| 0mph | 0mph | Toyota | | Toyota | Rav4 2016 | TSS-P | Yes | Yes2| 20mph1| 0mph | Toyota | | Toyota | Rav4 2017-18 | All | Yes | Yes2| 20mph1| 0mph | Toyota | | Toyota | Rav4 2019 | All | Yes | Yes | 0mph | 0mph | Toyota | diff --git a/common/params.py b/common/params.py index 3c8933b0a..754efff3a 100755 --- a/common/params.py +++ b/common/params.py @@ -122,6 +122,9 @@ keys = { "DragonGreyPandaMode": [TxType.PERSISTENT], "DragonDrivingUI": [TxType.PERSISTENT], "DragonDisplaySteeringLimitAlert": [TxType.PERSISTENT], + "DragonChargingCtrl": [TxType.PERSISTENT], + "DragonCharging": [TxType.PERSISTENT], + "DragonDisCharging": [TxType.PERSISTENT], } diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index d8825c6da..723be4230 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -104,6 +104,10 @@ FINGERPRINTS = { #2019 LE { 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1002: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1595: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 + }, + #2020 Prius Prime Limited + { + 36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 8, 614: 8, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 814: 8, 824: 2, 829: 2, 830: 7, 835: 8, 836: 8, 863: 8, 865: 8, 869: 7, 870: 7, 871: 2, 896: 8, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 974: 8, 975: 5, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1057: 8, 1059: 1, 1071: 8, 1076: 8, 1077: 8, 1082: 8, 1083: 8, 1084: 8, 1085: 8, 1086: 8, 1114: 8, 1132: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1175: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1279: 8, 1541: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1592: 8, 1595: 8, 1649: 8, 1777: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8, 2015: 8, 2024: 8, 2026: 8, 2027: 8, 2029: 8, 2030: 8, 2031: 8 }], #Corolla w/ added Pedal Support (512L and 513L) CAR.COROLLA: [{ diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py index 7e442a7bc..e09f7ea5a 100644 --- a/selfdrive/dragonpilot/dragonconf/__init__.py +++ b/selfdrive/dragonpilot/dragonconf/__init__.py @@ -42,6 +42,9 @@ default_conf = { 'DragonGreyPandaMode': '0', 'DragonDrivingUI': '1', 'DragonDisplaySteeringLimitAlert': '1', + 'DragonChargingCtrl': '0', + 'DragonCharging': 70, + 'DragonDisCharging': 60, } deprecated_conf = { diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index 27e708e2c..6ec659529 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -152,8 +152,13 @@ def thermald_thread(): # Make sure charging is enabled charging_disabled = False os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled') + + # dragonpilot ts_last_ip = 0. ip_addr = '255.255.255.255' + dragon_charging_ctrl = True if params.get('DragonChargingCtrl') == "1" else False + dragon_charging_max = params.get('DragonCharging') + dragon_discharging_min = params.get('DragonDisCharging') while 1: health = messaging.recv_sock(health_sock, wait=True) @@ -297,6 +302,13 @@ def thermald_thread(): location=(location.to_dict() if location else None), thermal=msg.to_dict()) + # we only update charging status once per min + if dragon_charging_ctrl: + 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') + count += 1