Merge branch 'smallopt' into Marlin_v1

Conflicts:
	Marlin/temperature.h
This commit is contained in:
Bernhard
2011-11-28 21:36:01 +01:00
11 changed files with 246 additions and 74 deletions

View File

@ -25,6 +25,7 @@
#define planner_h
#include "Configuration.h"
#include "Marlin.h"
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
// the source g-code and may never actually be reached if acceleration management is active.
@ -72,12 +73,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
void plan_set_position(const float &x, const float &y, const float &z, const float &e);
void plan_set_e_position(const float &e);
// Called when the current block is no longer needed. Discards the block and makes the memory
// availible for new blocks.
void plan_discard_current_block();
// Gets the current block. Returns NULL if buffer empty
block_t *plan_get_current_block();
void check_axes_activity();
uint8_t movesplanned(); //return the nr of buffered moves
@ -103,4 +99,30 @@ extern uint8_t active_extruder;
extern float autotemp_factor;
#endif
/////semi-private stuff
#include <WProgram.h>
extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed
extern volatile unsigned char block_buffer_tail;
// Called when the current block is no longer needed. Discards the block and makes the memory
// availible for new blocks.
FORCE_INLINE void plan_discard_current_block()
{
if (block_buffer_head != block_buffer_tail) {
block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);
}
}
// Gets the current block. Returns NULL if buffer empty
FORCE_INLINE block_t *plan_get_current_block()
{
if (block_buffer_head == block_buffer_tail) {
return(NULL);
}
block_t *block = &block_buffer[block_buffer_tail];
block->busy = true;
return(block);
}
#endif