Tools: param_parse: fix vehicle specific parameter with multiple fields

This commit is contained in:
Pierre Kancir 2021-04-17 11:14:26 +02:00 committed by Peter Barker
parent b81930885c
commit 927a875133

View File

@ -242,7 +242,7 @@ def process_library(vehicle, library, pathprefix=None):
debug("field[0]=%s vehicle=%s truename=%s field[1]=%s only_for_vehicles=%s\n" % debug("field[0]=%s vehicle=%s truename=%s field[1]=%s only_for_vehicles=%s\n" %
(field[0], vehicle.name, vehicle.truename, field[1], str(only_for_vehicles))) (field[0], vehicle.name, vehicle.truename, field[1], str(only_for_vehicles)))
value = re.sub('@PREFIX@', library.name, field[2]) value = re.sub('@PREFIX@', library.name, field[2])
if field[0] == "Values": if field[0] in ['Values', 'Bitmask']:
if vehicle.truename in only_for_vehicles: if vehicle.truename in only_for_vehicles:
this_vehicle_values_seen = True this_vehicle_values_seen = True
this_vehicle_value = value this_vehicle_value = value
@ -255,11 +255,11 @@ def process_library(vehicle, library, pathprefix=None):
else: else:
error("tagged param<: unknown parameter metadata field '%s'" % field[0]) error("tagged param<: unknown parameter metadata field '%s'" % field[0])
if ((non_vehicle_specific_values_seen or not other_vehicle_values_seen) or this_vehicle_values_seen): if ((non_vehicle_specific_values_seen or not other_vehicle_values_seen) or this_vehicle_values_seen):
if this_vehicle_values_seen and field[0] == 'Values': if this_vehicle_values_seen and field[0] in ['Values', 'Bitmask']:
setattr(p, field[0], this_vehicle_value) setattr(p, field[0], this_vehicle_value)
# debug("Appending (non_vehicle_specific_values_seen=%u " # debug("Appending (non_vehicle_specific_values_seen=%u "
# "other_vehicle_values_seen=%u this_vehicle_values_seen=%u)" % # "other_vehicle_values_seen=%u this_vehicle_values_seen=%u)" %
# (non_vehicle_specific_values_seen, other_vehicle_values_seen, this_vehicle_values_seen)) # (non_vehicle_specific_values_seen, other_vehicle_values_seen, this_vehicle_values_seen))
p.path = path # Add path. Later deleted - only used for duplicates p.path = path # Add path. Later deleted - only used for duplicates
library.params.append(p) library.params.append(p)