Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
5.11, 5.12, 5.13
-
None
-
-
4fb3e302a30c675b3d515d6eb5dd08301727d4c1 (qt/qtserialbus/5.12)
Description
In the description of
QCanBusFrame::setFrameId()
is stated, that the CAN extended frame format setting is automatically adapted to match newFrameId.
Actually, that sentence suggests, that one frame that had an extended id before, but is now adjusted to have a base format id, will automatically get isExtendedFormat removed, which is not the case due to
void setFrameId(quint32 newFrameId) { if (Q_LIKELY(newFrameId < 0x20000000U)) { isValidFrameId = true; canId = newFrameId; setExtendedFrameFormat(isExtendedFrame || (newFrameId & 0x1FFFF800U)); } else { isValidFrameId = false; canId = 0; } }
I suggest the following change in qcanbusframe.cpp;
/*! \fn QCanBusFrame::setFrameId(quint32 newFrameId) Sets the identifier of the CAN frame to \a newFrameId. The maximum size of a CAN frame identifier is 11 bits, which can be extended up to 29 bits by supporting the \e {CAN extended frame format}. The \e {CAN extended frame format} setting is automatically adapted to match \a newFrameId with more than 11 bits in size. When the format is extended and \a newFrameId with up to 11 bits or less is passed, the \e {CAN extended frame format} setting is \a not changed. You have to manually adjust the setting back to base format. \sa frameId(), hasExtendedFrameFormat() */