diff options
author | Manuel Coenen <manuel@duet3d.com> | 2021-02-23 18:04:30 +0300 |
---|---|---|
committer | Manuel Coenen <manuel@duet3d.com> | 2021-03-09 15:48:49 +0300 |
commit | bb201b96deaf1226d4ec3a0eb2c72f9dc2d7229c (patch) | |
tree | a074188870b984d2e19850c0aa46fd279a1740b2 /src/Platform | |
parent | 4481135c99124a38eee3fcbb6955e6846df6bd42 (diff) |
Extend M111 to take a Bitmap parameter to enable more detailed
filtering
Currently only enabled for modeGcodes
Diffstat (limited to 'src/Platform')
-rw-r--r-- | src/Platform/RepRap.cpp | 25 | ||||
-rw-r--r-- | src/Platform/RepRap.h | 10 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/Platform/RepRap.cpp b/src/Platform/RepRap.cpp index 007b2c3c..23a630ff 100644 --- a/src/Platform/RepRap.cpp +++ b/src/Platform/RepRap.cpp @@ -410,7 +410,7 @@ RepRap::RepRap() noexcept networkSeq(0), scannerSeq(0), sensorsSeq(0), spindlesSeq(0), stateSeq(0), toolsSeq(0), volumesSeq(0), toolList(nullptr), currentTool(nullptr), lastWarningMillis(0), activeExtruders(0), activeToolHeaters(0), numToolsToReport(0), - ticksInSpinState(0), heatTaskIdleTicks(0), debug(0), + ticksInSpinState(0), heatTaskIdleTicks(0), beepFrequency(0), beepDuration(0), beepTimer(0), previousToolNumber(-1), diagnosticsDestination(MessageType::NoDestinationMessage), justSentDiagnostics(false), @@ -420,6 +420,7 @@ RepRap::RepRap() noexcept // because a disconnected SBC interface can generate noise which may trigger interrupts and DMA #endif { + ClearDebug(); // Don't call constructors for other objects here } @@ -927,24 +928,20 @@ void RepRap::EmergencyStop() noexcept platform->StopLogging(); } -void RepRap::SetDebug(Module m, bool enable) noexcept +void RepRap::SetDebug(Module m, uint32_t flags) noexcept { if (m < numModules) { - if (enable) - { - debug |= (1u << m); - } - else - { - debug &= ~(1u << m); - } + debugMaps[m].SetFromRaw(flags); } } void RepRap::ClearDebug() noexcept { - debug = 0; + for (DebugFlags& dm : debugMaps) + { + dm.Clear(); + } } void RepRap::PrintDebug(MessageType mt) noexcept @@ -952,16 +949,16 @@ void RepRap::PrintDebug(MessageType mt) noexcept platform->Message((MessageType)(mt | PushFlag), "Debugging enabled for modules:"); for (size_t i = 0; i < numModules; i++) { - if ((debug & (1u << i)) != 0) + if (debugMaps[i].IsNonEmpty()) { - platform->MessageF((MessageType)(mt | PushFlag), " %s(%u)", GetModuleName(i), i); + platform->MessageF((MessageType)(mt | PushFlag), " %s(%u - %#" PRIx32 ")", GetModuleName(i), i, debugMaps[i].GetRaw()); } } platform->Message((MessageType)(mt | PushFlag), "\nDebugging disabled for modules:"); for (size_t i = 0; i < numModules; i++) { - if ((debug & (1u << i)) == 0) + if (debugMaps[i].IsEmpty()) { platform->MessageF((MessageType)(mt | PushFlag), " %s(%u)", GetModuleName(i), i); } diff --git a/src/Platform/RepRap.h b/src/Platform/RepRap.h index b3227255..ab8a70cd 100644 --- a/src/Platform/RepRap.h +++ b/src/Platform/RepRap.h @@ -53,6 +53,8 @@ struct MessageBox MessageBox() noexcept : active(false), seq(0) { } }; +typedef Bitmap<uint32_t> DebugFlags; + class RepRap INHERIT_OBJECT_MODEL { public: @@ -67,8 +69,9 @@ public: void DeferredDiagnostics(MessageType mtype) noexcept { diagnosticsDestination = mtype; } void Timing(MessageType mtype) noexcept; - bool Debug(Module module) const noexcept; - void SetDebug(Module m, bool enable) noexcept; + bool Debug(Module module) const noexcept { return debugMaps[module].IsNonEmpty(); } + DebugFlags GetDebugFlags(Module m) const noexcept { return debugMaps[m]; } + void SetDebug(Module m, uint32_t flags) noexcept; void ClearDebug() noexcept; void PrintDebug(MessageType mt) noexcept; Module GetSpinningModule() const noexcept; @@ -270,7 +273,7 @@ private: uint16_t heatTaskIdleTicks; uint32_t fastLoop, slowLoop; - uint32_t debug; + DebugFlags debugMaps[Module::numModules]; String<RepRapPasswordLength> password; String<MachineNameLength> myName; @@ -303,7 +306,6 @@ private: // A single instance of the RepRap class contains all the others extern RepRap reprap; -inline bool RepRap::Debug(Module m) const noexcept { return debug & (1u << m); } inline Module RepRap::GetSpinningModule() const noexcept { return spinningModule; } inline Tool* RepRap::GetCurrentTool() const noexcept { return currentTool; } |