diff --git a/dda_queue.c b/dda_queue.c index fc81c6b..c43d12c 100644 --- a/dda_queue.c +++ b/dda_queue.c @@ -49,6 +49,7 @@ void queue_step() { // serial_writechar('!'); // fall directly into dda_start instead of waiting for another step + // the dda dies not directly after its last step, but when the timer fires and there's no steps to do if (movebuffer[mb_tail].live == 0) next_move(); @@ -65,10 +66,8 @@ void enqueue(TARGET *t) { while (queue_full()) delay(WAITING_DELAY); - uint8_t h = mb_head; - h++; - if (h == MOVEBUFFER_SIZE) - h = 0; + uint8_t h = mb_head + 1; + h &= (MOVEBUFFER_SIZE - 1); dda_create(&movebuffer[h], t); diff --git a/gcode.c b/gcode.c index 53b8e89..e706675 100644 --- a/gcode.c +++ b/gcode.c @@ -520,9 +520,9 @@ void process_gcode_command(GCODE_COMMAND *gcmd) { // G92 - set home case 92: startpoint.X = startpoint.Y = startpoint.Z = startpoint.E = - current_position.X = current_position.Y = current_position.Z = current_position.E = 0; + current_position.X = current_position.Y = current_position.Z = current_position.E = 0; startpoint.F = - current_position.F = SEARCH_FEEDRATE_Z; + current_position.F = SEARCH_FEEDRATE_Z; break; // unknown gcode: spit an error @@ -537,15 +537,6 @@ void process_gcode_command(GCODE_COMMAND *gcmd) { // M101- extruder on case 101: if (temp_achieved() == 0) { -// serial_writestr_P(PSTR("Waiting for extruder to reach target temperature\n")); -// // here we wait until target temperature is reached, and emulate main loop so the temperature can actually be updated -// while (temp_achieved() == 0) { -// ifclock(CLOCK_FLAG_250MS) { -// // this is cosmetically nasty, but exactly what needs to happen -// void clock_250ms(void); -// clock_250ms(); -// } -// } enqueue_temp_wait(); } do {