From bc8a15dfc69c631a4567ad66e9ae835c0ca844fd Mon Sep 17 00:00:00 2001 From: "Chen Wenwen (CR/AME5)" Date: Wed, 14 Apr 2021 15:13:54 +0200 Subject: [PATCH] fix some issues Signed-off-by: Chen Wenwen (CR/AME5) --- mapping.yml | 78 ---------------------------------------------------- obdfeeder.py | 8 +++--- 2 files changed, 4 insertions(+), 82 deletions(-) diff --git a/mapping.yml b/mapping.yml index b5756a3..97ec496 100644 --- a/mapping.yml +++ b/mapping.yml @@ -44,84 +44,6 @@ THROTTLE_POS: unit: - percent -THROTTLE_POS_B: - targets: - - Vehicle.OBD.ThrottlePositionB - unit: - - percent - -THROTTLE_POS_C: - targets: - - Vehicle.OBD.ThrottlePositionC - unit: - - percent - -ACCELERATOR_POS_D: - targets: - - Vehicle.OBD.AcceleratorPositionD - unit: - - percent - -ACCELERATOR_POS_E: - targets: - - Vehicle.OBD.AcceleratorPositionE - unit: - - percent - -ACCELERATOR_POS_F: - targets: - - Vehicle.OBD.AcceleratorPositionF - unit: - - percent - -O2_B1S1: - targets: - - Vehicle.OBD.O2.Bank1.Sensor1.Voltage - unit: - - volt - -O2_B1S2: - targets: - - Vehicle.OBD.O2.Bank1.Sensor2.Voltage - unit: - - volt - -O2_B1S3: - targets: - - Vehicle.OBD.O2.Bank1.Sensor3.Voltage - unit: - - volt - -O2_B1S4: - targets: - - Vehicle.OBD.O2.Bank1.Sensor4.Voltage - unit: - - volt - -O2_B2S1: - targets: - - Vehicle.OBD.O2.Bank1.Sensor1.Voltage - unit: - - volt - -O2_B2S2: - targets: - - Vehicle.OBD.O2.Bank1.Sensor2.Voltage - unit: - - volt - -O2_B2S3: - targets: - - Vehicle.OBD.O2.Bank1.Sensor3.Voltage - unit: - - volt - -O2_B2S4: - targets: - - Vehicle.OBD.O2.Bank1.Sensor4.Voltage - unit: - - volt - DISTANCE_W_MIL: targets: - Vehicle.OBD.DistanceWithMIL diff --git a/obdfeeder.py b/obdfeeder.py index 9eae57d..f619316 100755 --- a/obdfeeder.py +++ b/obdfeeder.py @@ -48,22 +48,22 @@ def __init__(self, config): self.connection = obdC.openOBD(self.cfg['device'], self.cfg['baudrate']) self.thread.start() - def publishData(): + def publishData(self): print("Publish data") - for obdval,config in mapping.map(): + for obdval,config in self.mapping.map(): if config['value'] is None: continue print("Publish {}: to ".format(obdval), end='') for path in config['targets']: - self.vssclient.setValue(path, config['value'].magnitude) + self.vssClient.setValue(path, config['value'].magnitude) print(path, end=' ') print("") def loop(self): print("obd loop started") while True: - obdC.collectData(mapping, self.connection) + obdC.collectData(self.mapping, self.connection) self.publishData() # response=connection.query(cmd) # if not response.is_null():