-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DFReader: fixed handling of multlipiers from FMTU and MULT #965
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -166,7 +166,7 @@ def set_mult_ids(self, mult_ids, mult_lookup): | |||||||||||||||||||
for i in range(len(self.units)): | ||||||||||||||||||||
# If the format has its own multiplier, do not adjust the unit, | ||||||||||||||||||||
# and if no unit is specified there is nothing to adjust | ||||||||||||||||||||
if self.msg_mults[i] is not None or self.units[i] == "": | ||||||||||||||||||||
if self.msg_mults[i] is not None or self.units[i] != "": | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need just:
Suggested change
Otherwise, things like *.TimeUS will say its in 's' instead of 'μs' and PM.Load will say its in '%' instead of 'd%', when running 'dump PM --verbose'. |
||||||||||||||||||||
continue | ||||||||||||||||||||
# Get the unit multiplier from the lookup table | ||||||||||||||||||||
if mult_ids[i] in mult_lookup: | ||||||||||||||||||||
|
@@ -176,6 +176,9 @@ def set_mult_ids(self, mult_ids, mult_lookup): | |||||||||||||||||||
self.units[i] = MULT_TO_PREFIX[unitmult]+self.units[i] | ||||||||||||||||||||
else: | ||||||||||||||||||||
self.units[i] = "%.4g %s" % (unitmult, self.units[i]) | ||||||||||||||||||||
if self.units[i] in FORMAT_TO_STRUCT: | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that the "if self.units[i] in FORMAT_TO_STRUCT" bit is working because the prefix for "centi" and the code for "int16_t * 100" are both 'c' - but in my mind they aren't really the same 'c'! Assuming your aim is that any parameter which has no-unit but does have a multiplier specified, has that multiplier applied to the value, instead of becoming a unit prefix, then maybe something like this is cleaner:
Suggested change
(to replace all lines 175 -181) Not checked in detail, but I think this should then work for any multiplier which is set on a unitless parameter, even if that multiplier is not 100. |
||||||||||||||||||||
(label, mul, t) = FORMAT_TO_STRUCT[self.units[i]] | ||||||||||||||||||||
self.msg_mults[i] = mul | ||||||||||||||||||||
|
||||||||||||||||||||
def get_unit(self, col): | ||||||||||||||||||||
'''Return the unit for the specified field''' | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to update this comment based on the final test logic.