From 49d0fa4791cb0de471329870b6dd0eb3c43d7dd2 Mon Sep 17 00:00:00 2001 From: GPlay97 Date: Sun, 27 Oct 2019 18:11:23 +0100 Subject: [PATCH 1/2] add ODO to Kona --- cars/KONA_EV.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cars/KONA_EV.py b/cars/KONA_EV.py index bc494ad..37d7e6e 100644 --- a/cars/KONA_EV.py +++ b/cars/KONA_EV.py @@ -12,6 +12,9 @@ def getData(self): for cmd in [220101,220105]: raw[cmd] = self.dongle.sendCommand(str(cmd)) + self.dongle.setCANRxFilter('7CE') + raw['22b002'] = self.dongle.sendCommand(str('22b002')) + chargingBits = raw[220101][0x7EC27][5] \ if 0x7EC27 in raw[220101] else None @@ -45,6 +48,8 @@ def getData(self): 'dcBatteryPower': dcBatteryCurrent * dcBatteryVoltage / 1000.0 \ if dcBatteryCurrent!= None and dcBatteryVoltage != None else None, 'dcBatteryVoltage': dcBatteryVoltage, + 'odo': float(int.from_bytes(raw['22b002'][0x7CE21][5:7] + raw['22b002'][0x7CE22][0:2], byteorder='big', signed=False)) \ + if 0x7CE21 in raw['22b002'] and 0x7EC22 in raw['22b002'] else None, 'soh': int.from_bytes(raw[220105][0x7EC24][1:3], byteorder='big', signed=False) / 10.0 \ if 0x7EC24 in raw[220105] else None, } From 06f4e6beba51f3cf79581eb2763ff426ef635387 Mon Sep 17 00:00:00 2001 From: GPlay97 Date: Sun, 27 Oct 2019 19:35:49 +0100 Subject: [PATCH 2/2] fix check --- cars/KONA_EV.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cars/KONA_EV.py b/cars/KONA_EV.py index 37d7e6e..07e0344 100644 --- a/cars/KONA_EV.py +++ b/cars/KONA_EV.py @@ -49,7 +49,7 @@ def getData(self): if dcBatteryCurrent!= None and dcBatteryVoltage != None else None, 'dcBatteryVoltage': dcBatteryVoltage, 'odo': float(int.from_bytes(raw['22b002'][0x7CE21][5:7] + raw['22b002'][0x7CE22][0:2], byteorder='big', signed=False)) \ - if 0x7CE21 in raw['22b002'] and 0x7EC22 in raw['22b002'] else None, + if 0x7CE21 in raw['22b002'] and 0x7CE22 in raw['22b002'] else None, 'soh': int.from_bytes(raw[220105][0x7EC24][1:3], byteorder='big', signed=False) / 10.0 \ if 0x7EC24 in raw[220105] else None, }