   int pos = storagePointer;
   for (int i=0; i<frames; i++)
   {
-    pos--;
-    if (pos == -1)
+    if (--pos == -1)
     {
       pos = timeStorage-1;
     }
-    sum = sum + (int)storage[pos];
+    sum += (int)storage[pos];
   }
   return sum;
 }


void setup() {
  Serial.begin(9600);
  pinMode(TRIGGER_PIN, INPUT);
  
  #ifdef USE_WIFI_SHIELD


void loop()
{
  // Check if time moved on to a new frame
  pointerLoop();
  
  // Check if we got a signal right now
  triggerCheck();
}

