get_tail_ref was also mis-named, should be get_head_ref
authorMichael Moon <triffid.hunter@gmail.com>
Thu, 26 Dec 2013 00:59:05 +0000 (11:59 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Thu, 26 Dec 2013 00:59:05 +0000 (11:59 +1100)
src/libs/RingBuffer.h
src/modules/robot/Conveyor.cpp

index 6d58090..ab9c432 100644 (file)
@@ -20,7 +20,7 @@ template<class kind, int length> class RingBuffer {
         int          prev_block_index(int index);
         void         push_back(kind object);
         void         pop_front(kind &object);
-        kind*        get_tail_ref();
+        kind*        get_head_ref();
         void         get( int index, kind &object);
         kind*        get_ref( int index);
         void         delete_first();
@@ -65,7 +65,7 @@ template<class kind, int length> void RingBuffer<kind, length>::push_back(kind o
     this->head = (head+1)&(length-1);
 }
 
-template<class kind, int length> kind* RingBuffer<kind, length>::get_tail_ref(){
+template<class kind, int length> kind* RingBuffer<kind, length>::get_head_ref(){
     return &(buffer[head]);
 }
 
index cbbf7b7..ada91f2 100644 (file)
@@ -34,7 +34,7 @@ void Conveyor::on_module_loaded(){
 void Conveyor::on_idle(void* argument){
     if (flush_blocks){
         // Cleanly delete block 
-        Block* block = queue.get_tail_ref();
+        Block* block = queue.get_head_ref();
         block->gcodes.clear(); 
         queue.delete_first();
         __disable_irq();
@@ -47,7 +47,7 @@ void Conveyor::on_idle(void* argument){
 Block* Conveyor::new_block(){
 
     // Take the next untaken block on the queue ( the one after the last one )
-    Block* block = this->queue.get_tail_ref();
+    Block* block = this->queue.get_head_ref();
     // Then clean it up
     if( block->conveyor == this ){
         block->gcodes.clear();