File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -730,8 +730,7 @@ void RepRap::Spin() noexcept
730730 // Check if we need to send diagnostics
731731 if (diagnosticsDestination != MessageType::NoDestinationMessage)
732732 {
733- String<GCodeReplyLength> buf;
734- Diagnostics (diagnosticsDestination, buf.GetRef ());
733+ GenerateDeferredDiagnostics (diagnosticsDestination); // call out to separate function to keep stack usage under control
735734 diagnosticsDestination = MessageType::NoDestinationMessage;
736735 }
737736
@@ -808,6 +807,13 @@ void RepRap::Spin() noexcept
808807 RTOSIface::Yield ();
809808}
810809
810+ // Send diagnostics to the specified destination. This is in a separate function so that the large string doesn't take up main task stack space all the time.
811+ __attribute__ ((noinline)) void RepRap::GenerateDeferredDiagnostics (MessageType destination) noexcept
812+ {
813+ String<GCodeReplyLength> buf;
814+ Diagnostics (destination, buf.GetRef ());
815+ }
816+
811817void RepRap::Timing (const StringRef& reply) noexcept
812818{
813819 reply.lcatf (" Slowest loop: %.2fms; fastest: %.2fms" , (double )(slowLoop * StepClocksToMillis), (double )(fastLoop * StepClocksToMillis));
Original file line number Diff line number Diff line change @@ -178,6 +178,7 @@ class RepRap final INHERIT_OBJECT_MODEL
178178 ReadWriteLock *_ecv_null GetObjectLock (unsigned int tableNumber) const noexcept override ;
179179
180180private:
181+ __attribute__ ((noinline)) void GenerateDeferredDiagnostics (MessageType destination) noexcept ;
181182
182183#ifndef DUET_NG // Duet 2 doesn't currently need this feature, so omit it to save memory
183184 struct DebugLogRecord
You can’t perform that action at this time.
0 commit comments