Ensure Conveyor::on_block_end gets called last
authorMichael Moon <triffid.hunter@gmail.com>
Fri, 17 Jan 2014 00:55:36 +0000 (11:55 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Fri, 17 Jan 2014 00:55:36 +0000 (11:55 +1100)
src/modules/robot/Block.cpp
src/modules/robot/Conveyor.cpp

index aa4fa51..03f00ec 100644 (file)
@@ -236,4 +236,7 @@ void Block::release()
 {
     if (--this->times_taken <= 0)
         THEKERNEL->call_event(ON_BLOCK_END, this);
+
+    // ensure conveyor gets called last
+    THEKERNEL->conveyor->on_block_end(this);
 }
index 8d3be00..2373f60 100644 (file)
@@ -28,7 +28,6 @@ Conveyor::Conveyor(){
 
 void Conveyor::on_module_loaded(){
     register_for_event(ON_IDLE);
-    register_for_event(ON_BLOCK_END);
 }
 
 // Delete blocks here, because they can't be deleted in interrupt context ( see Block.cpp:release )