 #define CALIBRATE_OFFSET false
 #define CALIBRATE_MULTIPLIER false
 #define CALIBRATION_DISTANCE 1.0
+
+#define USE_MEDIAN_FILT true
 
 #define BEACON_1_ADDRESS 0x1A1A
 #define BEACON_2_ADDRESS 0x2A1A

    range *= CALIBRATE_MULTIPLIER?1.0f:BEACON_1_MULTIPLIER;
    range += CALIBRATE_OFFSET?0.0f:BEACON_1_OFFSET;
    cir_enqueue(cir1,range);
    //dist[0] = cir_median(cir1);
    dist[0] = range;
    
    if(CALIBRATE_OFFSET){
      if(dist[0] < shortestDistanceBeacon1 && dist[0] > 0){

    range *= CALIBRATE_MULTIPLIER?1.0f:BEACON_2_MULTIPLIER;
    range += CALIBRATE_OFFSET?0.0f:BEACON_2_OFFSET;
    cir_enqueue(cir2,range);
    dist[1] = (USE_MEDIAN_FILT)?cir_median(cir2):range;
    
    if(CALIBRATE_OFFSET){
      if(dist[1] < shortestDistanceBeacon2 && dist[1] > 0){
