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" | |
c501670b | 12 | #include "HeapRing.h" |
e0ee24ed | 13 | |
f80d18b9 L |
14 | using namespace std; |
15 | #include <string> | |
16 | #include <vector> | |
17 | ||
e0ee24ed | 18 | class Gcode; |
61134a65 | 19 | class Block; |
e0ee24ed | 20 | |
95b4885b JM |
21 | class Conveyor : public Module |
22 | { | |
23 | public: | |
24 | Conveyor(); | |
25 | ||
26 | void on_module_loaded(void); | |
38bf9a1c JM |
27 | void on_idle(void *); |
28 | void on_main_loop(void *); | |
29 | void on_block_end(void *); | |
b375ba1d | 30 | void on_halt(void *); |
38bf9a1c | 31 | void on_config_reload(void *); |
2134bcf2 | 32 | |
38bf9a1c | 33 | void notify_block_finished(Block *); |
95b4885b | 34 | |
95b4885b | 35 | void wait_for_empty_queue(); |
38bf9a1c | 36 | bool is_queue_empty() { return queue.is_empty(); }; |
728477c4 | 37 | bool is_queue_full() { return queue.is_full(); }; |
2134bcf2 MM |
38 | |
39 | void ensure_running(void); | |
40 | ||
38bf9a1c | 41 | void append_gcode(Gcode *); |
2134bcf2 | 42 | void queue_head_block(void); |
e0ee24ed | 43 | |
a617ac35 | 44 | void dump_queue(void); |
b375ba1d JM |
45 | void flush_queue(void); |
46 | bool is_flushing() const { return flush; } | |
c7f4902c | 47 | float get_current_feedrate() const { return current_feedrate; } |
38bf9a1c JM |
48 | friend class Planner; // for queue |
49 | ||
50 | private: | |
c501670b MM |
51 | typedef HeapRing<Block> Queue_t; |
52 | ||
53 | Queue_t queue; // Queue of Blocks | |
728477c4 | 54 | volatile unsigned int gc_pending; |
788e5809 | 55 | float current_feedrate{0}; // actual nominal feedrate that current block is running at in mm/sec |
c501670b | 56 | |
b375ba1d JM |
57 | struct { |
58 | volatile bool running:1; | |
59 | volatile bool flush:1; | |
728477c4 | 60 | volatile bool halted:1; |
b375ba1d | 61 | }; |
95b4885b | 62 | |
f80d18b9 L |
63 | }; |
64 | ||
65 | #endif // CONVEYOR_H |