Closed egribnau closed 2 years ago
The CANID
class has the following methods:
get_arbitration_id
is_extended
get_id_filter
The arbitration ID is a 29-bit integer, and should be interpreted depending on whether it is an extended or standard ID.
The error message quoted is odd: all Python objects get an attribute of id
(which makes it awkward in the context of naming an API for CAN).
The documentation is in error: it should be get_arbitration_id
rather than get_id
: there was a late change to the code to name this arbitration ID
to try and prevent confusion between a CANID
instance, an integer part of a CAN ID, and a Python ID. The change didn't make it into the documentation, leading to confusion about IDs..
I'll get the documentation fixed.
The PDF documentation 'CANPico MicroPython SDK reference manual.pdf' leads me to believe that the CANID object should have a get_id() method.
Hower, calling get_id() on a CANID gives a runtime error.
Error: "
AttributeError: 'CANID' object has no attribute 'id'
"Code: "
canid = frame.get_canid().get_id()
"I have run the following code on a CANID object to find about the supported methods:
Result:
['__class__', 'get_arbitration_id', 'get_id_filter', 'is_extended']