Colin Stearns / Mbed 2 deprecated qcControl

Dependencies:   mbed

Fork of dgps by Colin Stearns

Revision:
27:db73f8ac6c75
Parent:
15:e3e03a9df89e
Child:
32:9cb7bc3fc9e0
--- a/handle/dataLocation.cpp	Tue Apr 22 14:21:01 2014 +0000
+++ b/handle/dataLocation.cpp	Tue Apr 22 14:56:03 2014 +0000
@@ -31,14 +31,18 @@
 }
 
 void LocHolder::inc(LHType type,int amount,bool abs){
+    // Grab current index holder
     unsigned int& index=getI(type);
-    index=getRealIndex(type,(abs?0:index),amount);//((abs?0:index)+amount)%getI(type,LHIType_size);
-    getI(type)=index;
+    // Set index and make sure the index is valid (not negative or greater than max)
+    index=getRealIndex(type,(abs?0:index)+amount);
 }
 
 void LocHolder::add(LHType type,DataLocation newLoc){
+    // Set the current index to the current size
     getI(type)=getI(type,LHIType_size);
+    // Increment size
     getI(type,LHIType_size)++;
+    // Assign current index
     getC(type)=newLoc;
 }