diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2016-07-07 08:43:01 +0200 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2016-07-08 07:41:58 +0000 |
commit | 4cd1146041e788ceb1d8fb283f5257e743579843 (patch) | |
tree | 3e2ff184f529c042bf068dfb8802c331689fe197 /src | |
parent | 0317755dc0bc3d8bebe838f0715c14ed63173f38 (diff) |
CAN: Fix displaying extended identifiers below 0x800
While a standard identifier has a range from 0 to 2^11,
extended identifiers have a range from 0 to 2^29.
As they are distinct by the IDE (identifier extension) bit,
the same numeric value is still different in the overlapping
range from 0...0x7FF.
E.g. 0x123 (IDE = 0) is different from 0x00000123 (IDE = 1).
With this change, the received messages are displayed
correctly according to the IDE bit.
The proper solution is already done in dev branch as
55ad040de1ac6a33b4f2efe29038e97e8d43dbc2
Task-number: QTBUG-53171
Change-Id: I7383b0f9c5e05746f442998cddfafe32f0932120
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/canbusutil/readtask.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/canbusutil/readtask.cpp b/src/tools/canbusutil/readtask.cpp index 14e59b7..a83586e 100644 --- a/src/tools/canbusutil/readtask.cpp +++ b/src/tools/canbusutil/readtask.cpp @@ -58,8 +58,9 @@ void ReadTask::checkMessages() { if (frame.frameType() == QCanBusFrame::ErrorFrame) { view = canDevice->interpretErrorFrame(frame); } else { - view += QLatin1String("Id: "); - view += QString::number(id, 16); + const char *format = + frame.hasExtendedFrameFormat() ? "Id: %08X" : "Id: %03X"; + view += QString::asprintf(format, static_cast<uint>(id)); view += QLatin1String(" bytes: "); view += QString::number(dataLength, 10); if (frame.frameType() != QCanBusFrame::RemoteRequestFrame) { |