From: Uwe Hermann Date: Sat, 30 Nov 2019 14:17:50 +0000 (+0100) Subject: flexray: Use bit/s instead of Mbit/s for bitrate. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=88b84b3ce771a49680644c4a30819ccd90030018;p=libsigrokdecode.git flexray: Use bit/s instead of Mbit/s for bitrate. This avoids floating point number option values, which makes things a bit easier/clearer on the command-line and also matches what other decoders do. Also, use numbers instead of strings for the option values. --- diff --git a/decoders/flexray/pd.py b/decoders/flexray/pd.py index 0c52041..e13f2d4 100644 --- a/decoders/flexray/pd.py +++ b/decoders/flexray/pd.py @@ -58,8 +58,8 @@ class Decoder(srd.Decoder): options = ( {'id': 'channel_type', 'desc': 'Channel type', 'default': 'A', 'values': ('A', 'B')}, - {'id': 'bitrate', 'desc': 'Bitrate (Mbit/s)', 'default': '10.0', - 'values': ('10.0', '5.0', '2.5')}, + {'id': 'bitrate', 'desc': 'Bitrate (bit/s)', 'default': 10000000, + 'values': (10000000, 5000000, 2500000)}, ) annotations = ( ('data', 'FlexRay payload data'), @@ -102,7 +102,7 @@ class Decoder(srd.Decoder): def metadata(self, key, value): if key == srd.SRD_CONF_SAMPLERATE: - bitrate = 1000000 * float(self.options['bitrate']) + bitrate = float(self.options['bitrate']) self.samplerate = value self.bit_width = float(self.samplerate) / bitrate self.sample_point = (self.bit_width / 100.0) * self.sample_point_percent