|
@@ -72,12 +72,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
72
|
72
|
void plan_set_position(const float &x, const float &y, const float &z, const float &e);
|
73
|
73
|
void plan_set_e_position(const float &e);
|
74
|
74
|
|
75
|
|
-// Called when the current block is no longer needed. Discards the block and makes the memory
|
76
|
|
-// availible for new blocks.
|
77
|
|
-void plan_discard_current_block();
|
78
|
75
|
|
79
|
|
-// Gets the current block. Returns NULL if buffer empty
|
80
|
|
-block_t *plan_get_current_block();
|
81
|
76
|
|
82
|
77
|
void check_axes_activity();
|
83
|
78
|
uint8_t movesplanned(); //return the nr of buffered moves
|
|
@@ -102,4 +97,28 @@ extern unsigned long axis_steps_per_sqr_second[NUM_AXIS];
|
102
|
97
|
extern float autotemp_factor;
|
103
|
98
|
#endif
|
104
|
99
|
|
|
100
|
+
|
|
101
|
+/////semi-private stuff
|
|
102
|
+#include <WProgram.h>
|
|
103
|
+
|
|
104
|
+extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
|
|
105
|
+extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed
|
|
106
|
+extern volatile unsigned char block_buffer_tail;
|
|
107
|
+// Called when the current block is no longer needed. Discards the block and makes the memory
|
|
108
|
+// availible for new blocks.
|
|
109
|
+inline void plan_discard_current_block() {
|
|
110
|
+ if (block_buffer_head != block_buffer_tail) {
|
|
111
|
+ block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);
|
|
112
|
+ }
|
|
113
|
+}
|
|
114
|
+
|
|
115
|
+// Gets the current block. Returns NULL if buffer empty
|
|
116
|
+inline block_t *plan_get_current_block() {
|
|
117
|
+ if (block_buffer_head == block_buffer_tail) {
|
|
118
|
+ return(NULL);
|
|
119
|
+ }
|
|
120
|
+ block_t *block = &block_buffer[block_buffer_tail];
|
|
121
|
+ block->busy = true;
|
|
122
|
+ return(block);
|
|
123
|
+}
|
105
|
124
|
#endif
|