X-Git-Url: https://git.hcoop.net/clinton/Smoothieware.git/blobdiff_plain/01b693531c2a89f68ab2277f73d2925f3c7c5034..b259f517a93c120a836de3c0826ffbe01117fa3e:/src/modules/robot/Conveyor.h diff --git a/src/modules/robot/Conveyor.h b/src/modules/robot/Conveyor.h index 508b7ad6..936a7501 100644 --- a/src/modules/robot/Conveyor.h +++ b/src/modules/robot/Conveyor.h @@ -9,7 +9,6 @@ #define CONVEYOR_H #include "libs/Module.h" -#include "libs/Kernel.h" #include "HeapRing.h" using namespace std; @@ -17,6 +16,7 @@ using namespace std; #include class Gcode; +class Block; class Conveyor : public Module { @@ -24,33 +24,42 @@ public: Conveyor(); void on_module_loaded(void); - void on_idle(void*); - void on_main_loop(void*); - void on_block_end(void*); - void on_config_reload(void*); + void on_idle(void *); + void on_main_loop(void *); + void on_block_end(void *); + void on_halt(void *); + void on_config_reload(void *); - void notify_block_finished(Block*); + void notify_block_finished(Block *); - void wait_for_queue(int free_blocks); void wait_for_empty_queue(); + bool is_queue_empty() { return queue.is_empty(); }; + bool is_queue_full() { return queue.is_full(); }; void ensure_running(void); - bool is_queue_empty(void); - - void append_gcode(Gcode*); + void append_gcode(Gcode *); void queue_head_block(void); void dump_queue(void); + void flush_queue(void); + bool is_flushing() const { return flush; } + float get_current_feedrate() const { return current_feedrate; } + friend class Planner; // for queue - // right now block queue size can only be changed at compile time by changing the value below +private: typedef HeapRing Queue_t; Queue_t queue; // Queue of Blocks + volatile unsigned int gc_pending; + float current_feedrate{0}; // actual nominal feedrate that current block is running at in mm/sec - volatile bool running; + struct { + volatile bool running:1; + volatile bool flush:1; + volatile bool halted:1; + }; - volatile unsigned int gc_pending; }; #endif // CONVEYOR_H