Repository navigation
Commit 4136f37
authored
Fix Bus.__new__ for PEAK CAN-FD interfaces (hardbyte#1460)
* Add failing unit test to verify that issue hardbyte#1485 is fixed
hardbyte#1458
* Remove unused generic BitTiming creation in Bus.__new__
The BitTiming class is an attempt at unifying the various timing
parameters of the individual interfaces. The idea is that instead of
manually supplying multiple parameters that make up the timing
definition of the interface, one can instead supply a single instance of
the BitTiming class, which will also automatically calculate derivative
values from its input.
At the moment, this class is only used by two interfaces: CANtact and
CANanalystii. Both either accept a single bitrate or a BitTiming
instance. The latter will overrule the former.
The code that is removed with this commit is part of the generic
Bus.__new__ constructor. The removed code searches the set of kwargs
parameters for timing-related values. If it finds at least one such
value, it creates a BitTiming class instance and adds it to the list of
parameters. However, it breaks compatibility with the PEAK interface,
see issue hardbyte#1458. Additionally, the code in question is generic and
applies to all interfaces. Instantiating a class here is prone to issues
since it must be generic enough to fit all use cases. A better approach
would be to simply forward the parameters as was done previously and
leave it up to the individual interfaces to handle things properly.
* Format code with black
Co-authored-by: lumagi <lumagi@users.noreply.github.com>1 parent f3136fb commit 4136f37
2 files changed
Lines changed: 20 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | 236 | | |
256 | 237 | | |
257 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
376 | 396 | | |
377 | 397 | | |
378 | 398 | | |
0 commit comments