Commit | Line | Data |
---|---|---|
f80d18b9 L |
1 | /* |
2 | This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl). | |
3 | Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
4 | Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. | |
6 | */ | |
7 | ||
8 | #ifndef CONVEYOR_H | |
9 | #define CONVEYOR_H | |
10 | ||
11 | #include "libs/Module.h" | |
12 | #include "libs/Kernel.h" | |
c501670b | 13 | #include "HeapRing.h" |
e0ee24ed | 14 | |
f80d18b9 L |
15 | using namespace std; |
16 | #include <string> | |
17 | #include <vector> | |
18 | ||
e0ee24ed MM |
19 | class Gcode; |
20 | ||
95b4885b JM |
21 | class Conveyor : public Module |
22 | { | |
23 | public: | |
24 | Conveyor(); | |
25 | ||
26 | void on_module_loaded(void); | |
2134bcf2 MM |
27 | void on_idle(void*); |
28 | void on_block_end(void*); | |
29 | ||
30 | void notify_block_finished(Block*); | |
95b4885b | 31 | |
95b4885b JM |
32 | void wait_for_queue(int free_blocks); |
33 | void wait_for_empty_queue(); | |
2134bcf2 MM |
34 | |
35 | void ensure_running(void); | |
36 | ||
37 | bool is_queue_empty(void); | |
95b4885b | 38 | |
e0ee24ed | 39 | void append_gcode(Gcode*); |
2134bcf2 | 40 | void queue_head_block(void); |
e0ee24ed | 41 | |
95b4885b | 42 | // right now block queue size can only be changed at compile time by changing the value below |
c501670b MM |
43 | typedef HeapRing<Block> Queue_t; |
44 | ||
45 | Queue_t queue; // Queue of Blocks | |
46 | ||
2134bcf2 | 47 | volatile bool running; |
95b4885b | 48 | |
c501670b | 49 | volatile unsigned int gc_pending; |
f80d18b9 L |
50 | }; |
51 | ||
52 | #endif // CONVEYOR_H |