dda_queue.c/.h: merge enqueue() and enqueue_temp_wait(). This
saves almost 200 bytes.
This commit is contained in:
parent
94e0cce89b
commit
90fca50535
28
dda_queue.c
28
dda_queue.c
|
|
@ -69,30 +69,11 @@ void enqueue(TARGET *t) {
|
|||
uint8_t h = mb_head + 1;
|
||||
h &= (MOVEBUFFER_SIZE - 1);
|
||||
|
||||
if (t != NULL) {
|
||||
dda_create(&movebuffer[h], t);
|
||||
|
||||
mb_head = h;
|
||||
|
||||
#ifdef XONXOFF
|
||||
// If the queue has only two slots remaining, stop transmission. More
|
||||
// characters might come in until the stop takes effect.
|
||||
if (((mb_tail - mb_head - 1) & (MOVEBUFFER_SIZE - 1)) < (MOVEBUFFER_SIZE - 2))
|
||||
xoff();
|
||||
#endif
|
||||
|
||||
// fire up in case we're not running yet
|
||||
enableTimerInterrupt();
|
||||
}
|
||||
|
||||
void enqueue_temp_wait() {
|
||||
// don't call this function when the queue is full, but just in case, wait for a move to complete and free up the space for the passed target
|
||||
while (queue_full())
|
||||
delay(WAITING_DELAY);
|
||||
|
||||
uint8_t h = mb_head + 1;
|
||||
h &= (MOVEBUFFER_SIZE - 1);
|
||||
|
||||
// wait for temp flag
|
||||
else {
|
||||
// it's a wait for temp
|
||||
movebuffer[h].waitfor_temp = 1;
|
||||
movebuffer[h].nullmove = 0;
|
||||
#if (F_CPU & 0xFF000000) == 0
|
||||
|
|
@ -102,10 +83,13 @@ void enqueue_temp_wait() {
|
|||
// set "step" timeout to maximum
|
||||
movebuffer[h].c = 0xFFFFFF00;
|
||||
#endif
|
||||
}
|
||||
|
||||
mb_head = h;
|
||||
|
||||
#ifdef XONXOFF
|
||||
// If the queue has only two slots remaining, stop transmission. More
|
||||
// characters might come in until the stop takes effect.
|
||||
if (((mb_tail - mb_head - 1) & (MOVEBUFFER_SIZE - 1)) < (MOVEBUFFER_SIZE - 2))
|
||||
xoff();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,11 +24,9 @@ uint8_t queue_empty(void);
|
|||
void queue_step(void);
|
||||
|
||||
// add a new target to the queue
|
||||
// t == NULL means add a wait for target temp to the queue
|
||||
void enqueue(TARGET *t);
|
||||
|
||||
// add a wait for target temp to the queue
|
||||
void enqueue_temp_wait(void);
|
||||
|
||||
// called from step timer when current move is complete
|
||||
void next_move(void) __attribute__ ((hot));
|
||||
|
||||
|
|
|
|||
4
gcode.c
4
gcode.c
|
|
@ -533,7 +533,7 @@ void process_gcode_command(GCODE_COMMAND *gcmd) {
|
|||
// M101- extruder on
|
||||
case 101:
|
||||
if (temp_achieved() == 0) {
|
||||
enqueue_temp_wait();
|
||||
enqueue(NULL);
|
||||
}
|
||||
do {
|
||||
// backup feedrate, move E very quickly then restore feedrate
|
||||
|
|
@ -595,7 +595,7 @@ void process_gcode_command(GCODE_COMMAND *gcmd) {
|
|||
else {
|
||||
disable_heater();
|
||||
}
|
||||
enqueue_temp_wait();
|
||||
enqueue(NULL);
|
||||
break;
|
||||
|
||||
// M110- set line number
|
||||
|
|
|
|||
Loading…
Reference in New Issue