Because some moves may end before the print is actually paused, we need a method to remove all the entries that will not be executed after the print has finally paused
| 177 | // Because some moves may end before the print is actually paused, we need a method to |
| 178 | // remove all the entries that will not be executed after the print has finally paused |
| 179 | void GCodeQueue::PurgeEntries() noexcept |
| 180 | { |
| 181 | QueuedCode *_ecv_null item = queuedItems, *_ecv_null lastItem = nullptr; |
| 182 | while (item != nullptr) |
| 183 | { |
| 184 | if (item->executeAtMove > reprap.GetMove().GetScheduledMoves()) |
| 185 | { |
| 186 | // Release this item |
| 187 | QueuedCode *_ecv_null nextItem = item->Next(); |
| 188 | item->next = freeItems; |
| 189 | freeItems = item; |
| 190 | |
| 191 | // Unlink it from the list |
| 192 | if (lastItem == nullptr) |
| 193 | { |
| 194 | queuedItems = nextItem; |
| 195 | } |
| 196 | else |
| 197 | { |
| 198 | lastItem->next = nextItem; |
| 199 | } |
| 200 | item = nextItem; |
| 201 | } |
| 202 | else |
| 203 | { |
| 204 | lastItem = item; |
| 205 | item = item->Next(); |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | void GCodeQueue::Clear() noexcept |
| 211 | { |
no test coverage detected