MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / QueueCode

Method QueueCode

src/GCodes/GCodeQueue.cpp:107–138  ·  view source on GitHub ↗

Try to queue the command in the passed GCodeBuffer. If successful, return true to indicate it has been queued. If the queue is full, return false. Caller will wait for space to become available.

Source from the content-addressed store, hash-verified

105// If successful, return true to indicate it has been queued.
106// If the queue is full, return false. Caller will wait for space to become available.
107bool GCodeQueue::QueueCode(const GCodeBuffer &gb) noexcept
108{
109 // Can we queue this code somewhere?
110 if (freeItems == nullptr)
111 {
112 return false;
113 }
114
115 // Unlink a free element and assign gb's code to it
116 QueuedCode * const code = _ecv_not_null(freeItems);
117 freeItems = code->next;
118 code->AssignFrom(gb);
119 code->executeAtMove = reprap.GetMove().GetScheduledMoves();
120 code->next = nullptr;
121
122 // Append it to the list of queued codes
123 if (queuedItems == nullptr)
124 {
125 queuedItems = code;
126 }
127 else
128 {
129 QueuedCode * last = _ecv_not_null(queuedItems);
130 while (last->Next() != nullptr)
131 {
132 last = _ecv_not_null(last->Next());
133 }
134 last->next = code;
135 }
136
137 return true;
138}
139
140bool GCodeQueue::FillBuffer(GCodeBuffer *gb) noexcept
141{

Callers 2

THROWSFunction · 0.80
GCodes2.cppFile · 0.80

Calls 3

AssignFromMethod · 0.45
GetScheduledMovesMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected