Extruder: use block returned from append_empty_block() instead of munging the queue
authorMichael Moon <triffid.hunter@gmail.com>
Mon, 11 Mar 2013 10:30:37 +0000 (21:30 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Mon, 11 Mar 2013 10:30:37 +0000 (21:30 +1100)
src/modules/tools/extruder/Extruder.cpp

index f013662..9ad3bb9 100644 (file)
@@ -122,11 +122,10 @@ void Extruder::on_gcode_received(void *argument)
             // This is a solo move, we add an empty block to the queue
             //If the queue is empty, execute immediatly, otherwise attach to the last added block
             if( this->kernel->conveyor->queue.size() == 0 ){
-                this->kernel->call_event(ON_GCODE_EXECUTE, gcode );
                 this->append_empty_block();
+                this->kernel->call_event(ON_GCODE_EXECUTE, gcode );
             }else{
-                this->append_empty_block();
-                Block* block = this->kernel->conveyor->queue.get_ref( this->kernel->conveyor->queue.size() - 1 );
+                Block* block = this->append_empty_block();
                 block->append_gcode(gcode);
             }
         }