Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hammacher <bmasterc@gmail.com>2022-04-24 13:27:05 +0300
committerChristian Hammacher <bmasterc@gmail.com>2022-04-24 13:27:05 +0300
commit860851e00fff7bb0024638b1c6c9283b6b7fdf2d (patch)
treed2f742b8751163b73097c63da89f4e8b4a2ef0df
parentd1bd8e369480cb2de9ca3c9d91fa8ee4bb7b6093 (diff)
Improved SBC diagnostics and fixed M563 L param
-rw-r--r--src/SBC/SbcInterface.cpp17
-rw-r--r--src/SBC/SbcInterface.h2
-rw-r--r--src/Tools/Tool.cpp2
3 files changed, 14 insertions, 7 deletions
diff --git a/src/SBC/SbcInterface.cpp b/src/SBC/SbcInterface.cpp
index 0d7a47b4..bf6696de 100644
--- a/src/SBC/SbcInterface.cpp
+++ b/src/SBC/SbcInterface.cpp
@@ -49,7 +49,7 @@ extern "C" [[noreturn]] void SBCTaskStart(void * pvParameters) noexcept
reprap.GetSbcInterface().TaskLoop();
}
-SbcInterface::SbcInterface() noexcept : isConnected(false), numDisconnects(0), numTimeouts(0), lastTransferTime(0),
+SbcInterface::SbcInterface() noexcept : isConnected(false), numDisconnects(0), numTimeouts(0), numSbcTimeouts(0), lastTransferTime(0),
maxDelayBetweenTransfers(SpiTransferDelay), maxFileOpenDelay(SpiFileOpenDelay), numMaxEvents(SpiEventsRequired),
delaying(false), numEvents(0), reportPause(false), reportPauseWritten(false), printAborted(false),
codeBuffer(nullptr), rxPointer(0), txPointer(0), txEnd(0), sendBufferUpdate(true), waitingForFileChunk(false),
@@ -107,7 +107,7 @@ void SbcInterface::Spin() noexcept
transfer.InitFromTask();
transfer.StartNextTransfer();
- bool busy = false, transferComplete = false, hadTimeout = false, hadReset = false;
+ bool busy = false, transferComplete = false, hadTimeout = false, hadSbcTimeout = false, hadReset = false;
for (;;)
{
// Try to exchange data with the SBC
@@ -116,19 +116,22 @@ void SbcInterface::Spin() noexcept
{
busy = false;
state = transfer.DoTransfer();
+ const uint32_t transferStartTime = millis();
switch (state)
{
case TransferState::doingFullTransfer:
hadTimeout = !TaskBase::Take(isConnected ? SpiConnectionTimeout : TaskBase::TimeoutUnlimited);
+ hadSbcTimeout = hadTimeout && millis() - transferStartTime < SpiConnectionTimeout + SbcYieldTimeout;
break;
case TransferState::doingPartialTransfer:
hadTimeout = !TaskBase::Take(SpiTransferTimeout);
+ hadSbcTimeout = hadTimeout && millis() - transferStartTime < SpiTransferTimeout + SbcYieldTimeout;
break;
case TransferState::finishingTransfer:
busy = true;
break;
case TransferState::connectionTimeout:
- hadTimeout = true;
+ hadTimeout = hadSbcTimeout = true;
break;
case TransferState::connectionReset:
hadReset = true;
@@ -147,8 +150,12 @@ void SbcInterface::Spin() noexcept
if (hadTimeout)
{
numTimeouts++;
+ if (hadSbcTimeout)
+ {
+ numSbcTimeouts++;
+ }
}
- reprap.GetPlatform().Message(NetworkInfoMessage, "Lost connection to SBC\n");
+ reprap.GetPlatform().MessageF(NetworkInfoMessage, "Lost connection to SBC due to %s timeout\n", hadSbcTimeout ? "remote" : "local");
// Invalidate local resources
InvalidateResources();
@@ -1185,7 +1192,7 @@ void SbcInterface::Diagnostics(MessageType mtype) noexcept
{
reprap.GetPlatform().Message(mtype, "=== SBC interface ===\n");
transfer.Diagnostics(mtype);
- reprap.GetPlatform().MessageF(mtype, "State: %d, disconnects: %" PRIu32 ", timeouts: %" PRIu32 ", IAP RAM available 0x%05" PRIx32 "\n", (int)state, numDisconnects, numTimeouts, iapRamAvailable);
+ reprap.GetPlatform().MessageF(mtype, "State: %d, disconnects: %" PRIu32 ", timeouts: %" PRIu32 " total, %" PRIu32 " by SBC, IAP RAM available 0x%05" PRIx32 "\n", (int)state, numDisconnects, numTimeouts, numSbcTimeouts, iapRamAvailable);
reprap.GetPlatform().MessageF(mtype, "Buffer RX/TX: %d/%d-%d, open files: %u\n", (int)rxPointer, (int)txPointer, (int)txEnd, numOpenFiles);
#ifdef TRACK_FILE_CODES
reprap.GetPlatform().MessageF(mtype, "File codes read/handled: %d/%d, file macros open/closing: %d %d\n", (int)fileCodesRead, (int)fileCodesHandled, (int)fileMacrosRunning, (int)fileMacrosClosing);
diff --git a/src/SBC/SbcInterface.h b/src/SBC/SbcInterface.h
index 8980c30a..d7ed42b9 100644
--- a/src/SBC/SbcInterface.h
+++ b/src/SBC/SbcInterface.h
@@ -72,7 +72,7 @@ private:
DataTransfer transfer;
volatile bool isConnected;
TransferState state;
- uint32_t numDisconnects, numTimeouts, lastTransferTime;
+ uint32_t numDisconnects, numTimeouts, numSbcTimeouts, lastTransferTime;
uint32_t maxDelayBetweenTransfers, maxFileOpenDelay, numMaxEvents;
bool skipNextDelay;
diff --git a/src/Tools/Tool.cpp b/src/Tools/Tool.cpp
index 005fefde..03f03071 100644
--- a/src/Tools/Tool.cpp
+++ b/src/Tools/Tool.cpp
@@ -189,7 +189,7 @@ DEFINE_GET_OBJECT_MODEL_TABLE(Tool)
{
// Use exactly only one Filament instance per extruder drive
Filament * const filament = Filament::GetFilamentByExtruder(filamentDrive);
- t->filament = (filament == nullptr) ? new Filament(d[0]) : filament;
+ t->filament = (filament == nullptr) ? new Filament(filamentDrive) : filament;
t->filamentExtruder = filamentDrive;
}
else