@@ -395,14 +395,14 @@ def recreate_with_f_clock(self, f_clock: int) -> "BitTiming":
395395
396396 def __str__ (self ) -> str :
397397 segments = [
398- f"BR { self .bitrate } bit/s" ,
398+ f"BR: { self .bitrate :_ } bit/s" ,
399399 f"SP: { self .sample_point :.2f} %" ,
400400 f"BRP: { self .brp } " ,
401401 f"TSEG1: { self .tseg1 } " ,
402402 f"TSEG2: { self .tseg2 } " ,
403403 f"SJW: { self .sjw } " ,
404404 f"BTR: { self .btr0 :02X} { self .btr1 :02X} h" ,
405- f"f_clock : { self .f_clock / 1e6 :.0f} MHz" ,
405+ f"CLK : { self .f_clock / 1e6 :.0f} MHz" ,
406406 ]
407407 return ", " .join (segments )
408408
@@ -425,6 +425,9 @@ def __eq__(self, other: object) -> bool:
425425
426426 return self ._data == other ._data
427427
428+ def __hash__ (self ) -> int :
429+ return tuple (self ._data .values ()).__hash__ ()
430+
428431
429432class BitTimingFd (Mapping ):
430433 """Representation of a bit timing configuration for a CAN FD bus.
@@ -999,19 +1002,19 @@ def recreate_with_f_clock(self, f_clock: int) -> "BitTimingFd":
9991002
10001003 def __str__ (self ) -> str :
10011004 segments = [
1002- f"NBR: { self .nom_bitrate } bit/s" ,
1005+ f"NBR: { self .nom_bitrate :_ } bit/s" ,
10031006 f"NSP: { self .nom_sample_point :.2f} %" ,
10041007 f"NBRP: { self .nom_brp } " ,
10051008 f"NTSEG1: { self .nom_tseg1 } " ,
10061009 f"NTSEG2: { self .nom_tseg2 } " ,
10071010 f"NSJW: { self .nom_sjw } " ,
1008- f"DBR: { self .data_bitrate } bit/s" ,
1011+ f"DBR: { self .data_bitrate :_ } bit/s" ,
10091012 f"DSP: { self .data_sample_point :.2f} %" ,
10101013 f"DBRP: { self .data_brp } " ,
10111014 f"DTSEG1: { self .data_tseg1 } " ,
10121015 f"DTSEG2: { self .data_tseg2 } " ,
10131016 f"DSJW: { self .data_sjw } " ,
1014- f"f_clock : { self .f_clock / 1e6 :.0f} MHz" ,
1017+ f"CLK : { self .f_clock / 1e6 :.0f} MHz" ,
10151018 ]
10161019 return ", " .join (segments )
10171020
@@ -1034,6 +1037,9 @@ def __eq__(self, other: object) -> bool:
10341037
10351038 return self ._data == other ._data
10361039
1040+ def __hash__ (self ) -> int :
1041+ return tuple (self ._data .values ()).__hash__ ()
1042+
10371043
10381044def _oscillator_tolerance_condition_1 (nom_sjw : int , nbt : int ) -> float :
10391045 """Arbitration phase - resynchronization"""
0 commit comments