working version with calibration done

Fork of Eurobot2013 by Oskar Weigl

Revision:
11:5ba926692210
Parent:
10:2bd9f4e02b74
--- a/Sonar/RFSRF05.cpp	Sun Apr 07 16:30:49 2013 +0000
+++ b/Sonar/RFSRF05.cpp	Tue Apr 09 15:32:47 2013 +0000
@@ -1,4 +1,3 @@
-
 #include "RFSRF05.h"
 #include "mbed.h"
 #include "globals.h"
@@ -141,11 +140,11 @@
         ValidPulse = false;
 
         //Calucate distance
-        //true offset is about 100, we put 300 so circles overlap
-        _dist[_beacon_counter] =  _timer.read_us()/2.9 + 300;
+        //true offset is about 100, we put 300 so circles overlap, not sure about the true speed-of-sound constant
+        _dist[_beacon_counter] =  _timer.read_us()/2.8807f + 70;  //2.8807f
 
         if (callbackfunc)
-            (*callbackfunc)(_beacon_counter, _dist[_beacon_counter]);
+            (*callbackfunc)(_beacon_counter, _dist[_beacon_counter], sonarvariance);
 
         if (callbackobj && mcallbackfunc)
             (callbackobj->*mcallbackfunc)(_beacon_counter, _dist[_beacon_counter], sonarvariance);