blob: b6c50165cec1e661b51e68ea4aab2dddc6293590 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* GCodeQueue.h
*
* Created on: 22 Jun 2016
* Author: Christian
*/
#ifndef GCODEQUEUE_H
#define GCODEQUEUE_H
#include "RepRapFirmware.h"
#include "GCodeInput.h"
class QueuedCode;
const size_t BufferSizePerQueueItem = SHORT_GCODE_LENGTH;
class GCodeQueue : public GCodeInput
{
public:
GCodeQueue() noexcept;
void Reset() noexcept override; // Clean all the cached data from this input
bool FillBuffer(GCodeBuffer *gb) noexcept override; // If there is another move to execute at this time, fill a buffer
size_t BytesCached() const noexcept override; // How many bytes have been cached?
bool QueueCode(GCodeBuffer &gb) noexcept; // Queue a G-code
void PurgeEntries() noexcept; // Remove stored codes when a print is being paused
void Clear() noexcept; // Clean up all the stored codes
bool IsIdle() const noexcept; // Return true if there is nothing to do
void Diagnostics(MessageType mtype) noexcept;
static bool ShouldQueueCode(GCodeBuffer &gb) THROWS_GCODE_EXCEPTION; // Return true if this code should be queued
private:
QueuedCode *freeItems;
QueuedCode *queuedItems;
};
class QueuedCode
{
public:
friend class GCodeQueue;
QueuedCode(QueuedCode *n) noexcept : next(n), dataLength(0) { }
QueuedCode *Next() const noexcept { return next; }
private:
QueuedCode *next;
bool isBinary;
char data[BufferSizePerQueueItem];
size_t dataLength;
uint32_t executeAtMove;
int toolNumberAdjust;
void AssignFrom(GCodeBuffer &gb) noexcept;
void AssignTo(GCodeBuffer *gb) noexcept;
};
#endif
|