Bug: Graph window does not apply CAN ID mask to CAN ID
Observed If I try to plot J1939 data, it is often necessary to match CAN messages based on the 18 bit PGN instead of the full 29 bit CAN ID. This is particularly so if one wants to load the signal details from a J1939 DBC file when plotting a J1939 signal in the graph viewer.
Loading a J1939 DBC file signal works OK, but the 29-bit CAN ID from the DBC does not necessarily match the 29-bit CAN ID on the CAN bus, despite the PGN matching. This can currently be solved by updating the loaded information to match 1:1 the 29-bit bus CAN ID, but this is a bit inconvenient/confusing for users.
As an alternative, I tried using a J1939 PGN mask to "match" the CAN ID based on just the 18-bit PGN. You can see this illustrated in below picture:
However, this does not work as the CAN ID is still only correctly matched if it exactly matches the CAN ID on the bus at the 29 bit level.
Expected
Ideally, SavvyCAN should correctly apply the filter mask to the CAN ID, allowing for matching CAN messages at the PGN level instead of the CAN ID level when creating a signal. Further, assuming this is possible, it would be ideal that when the DBC manager has loaded a DBC file with the J1939 type matching, the signal plot view would automatically update the CAN ID mask to be 0x3FFFF00 so as to match based on the 18 bit PGN instead of the full 29 bit CAN ID.
See also below video for context and attached data.
https://user-images.githubusercontent.com/26184427/227224000-c1fa42da-fa6c-4328-94d5-74e5362dd496.mp4
Yes, this a bug. I'm sure it isn't respecting the interpretation mode set for the DBC file. For what it's worth, the mask on that window is a mask applied to the output data of the graph. This lets you mask away bits of the output. Almost never would you actually want to do that but it's there for the very few times this might be useful.
Hi Collin,
Ok thanks for clarifying the role of that mask entry - I would perhaps suggest making the default value of that mask have 8 bytes, i.e. 0xFFFFFFFFFFFFFFFF to make it more clearly linked to the payload rather than the ID. But that's a detail.
I think it would be great to have the Graph settings perform the matching of the CAN ID at the PGN level when the user has selected that the loaded DBC is to be interpreted as a J1939 DBC. I expect you already implement such decoding logic in the 'interpret frames' section of your trace windows, so it would basically be to also apply that when loading signals from said DBC in the graph settings. We've had some users be a bit confused about their plots not showing up for J1939 cases and I think this would be a neat way to make it more intuitive.