Skip to content

Commit 4c8d749

Browse files
committed
Fixes to M122
1 parent 76dd00d commit 4c8d749

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/CAN/CanInterface.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,12 +1261,13 @@ GCodeResult CanInterface::RemoteDiagnostics(MessageType mt, uint32_t boardAddres
12611261
do
12621262
{
12631263
// We can use 'reply' to buffer the returned data
1264+
reply.Clear();
12641265
res = GetRemoteInfo(CanMessageReturnInfo::typeDiagnosticsPart0 + currentPart, boardAddress, type, gb, reply, &lastPart);
12651266
if (res != GCodeResult::ok)
12661267
{
12671268
return res;
12681269
}
1269-
if (type == 0 && currentPart == 0)
1270+
if (currentPart == 0)
12701271
{
12711272
p.MessageF(mt, "Diagnostics for board %u:\n", (unsigned int)boardAddress);
12721273
}
@@ -1277,6 +1278,7 @@ GCodeResult CanInterface::RemoteDiagnostics(MessageType mt, uint32_t boardAddres
12771278
}
12781279
++currentPart;
12791280
} while (currentPart <= lastPart);
1281+
reply.Clear();
12801282
return res;
12811283
}
12821284

src/CAN/CommandProcessor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ static GCodeResult EutGetInfo(const CanMessageReturnInfo& msg, const StringRef&
239239
default:
240240
if (msg.type >= CanMessageReturnInfo::typeDiagnosticsPart0 && msg.type < CanMessageReturnInfo::typeDiagnosticsPart0 + reprap.GetNumberOfDiagnosticParts())
241241
{
242+
reply.Clear();
242243
reprap.GetDiagnosticsPart(msg.type - CanMessageReturnInfo::typeDiagnosticsPart0, reply);
243-
extra = reprap.GetNumberOfDiagnosticParts();
244+
extra = reprap.GetNumberOfDiagnosticParts() - 1;
244245
}
245246
else
246247
{

0 commit comments

Comments
 (0)