File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -227,12 +227,22 @@ def _create_bus_config(config: Dict[str, Any]) -> typechecking.BusConfig:
227
227
raise ValueError ("Port config must be inside 0-65535 range!" )
228
228
229
229
try :
230
- config ["timing" ] = can .BitTimingFd (** config )
230
+ if set (typechecking .BitTimingFdDict .__annotations__ ).issubset (set (config )):
231
+ config ["timing" ] = can .BitTimingFd (
232
+ ** {
233
+ key : int (config [key ])
234
+ for key in typechecking .BitTimingFdDict .__annotations__
235
+ }
236
+ )
237
+ elif set (typechecking .BitTimingDict .__annotations__ ).issubset (set (config )):
238
+ config ["timing" ] = can .BitTiming (
239
+ ** {
240
+ key : int (config [key ])
241
+ for key in typechecking .BitTimingDict .__annotations__
242
+ }
243
+ )
231
244
except (ValueError , TypeError ):
232
- try :
233
- config ["timing" ] = can .BitTiming (** config )
234
- except (ValueError , TypeError ):
235
- pass
245
+ pass
236
246
237
247
if "bitrate" in config :
238
248
config ["bitrate" ] = int (config ["bitrate" ])
You can’t perform that action at this time.
0 commit comments