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
730
730
// Check if we need to send diagnostics
731
731
if (diagnosticsDestination != MessageType::NoDestinationMessage)
732
732
{
733
- String<GCodeReplyLength> buf;
734
- Diagnostics (diagnosticsDestination, buf.GetRef ());
733
+ GenerateDeferredDiagnostics (diagnosticsDestination); // call out to separate function to keep stack usage under control
735
734
diagnosticsDestination = MessageType::NoDestinationMessage;
736
735
}
737
736
@@ -808,6 +807,13 @@ void RepRap::Spin() noexcept
808
807
RTOSIface::Yield ();
809
808
}
810
809
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
+
811
817
void RepRap::Timing (const StringRef& reply) noexcept
812
818
{
813
819
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
178
178
ReadWriteLock *_ecv_null GetObjectLock (unsigned int tableNumber) const noexcept override ;
179
179
180
180
private:
181
+ __attribute__ ((noinline)) void GenerateDeferredDiagnostics (MessageType destination) noexcept ;
181
182
182
183
#ifndef DUET_NG // Duet 2 doesn't currently need this feature, so omit it to save memory
183
184
struct DebugLogRecord
You can’t perform that action at this time.
0 commit comments