From e7e49910006edd90a89e7224049ca4173855c6a8 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Mon, 8 Jul 2013 18:58:19 -0400 Subject: [PATCH] [Positioner] AutocalibrationMesh: use 128 as error Use 128 instead of 1 as error code in AutocalibrationMesh::compute_multi_packet_ss(), since small positive values can sometimes occur. Some minor other cosmetics changes. --- owlps-positioner/autocalibrationmesh.cc | 10 +++++----- owlps-positioner/autocalibrationmesh.hh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/owlps-positioner/autocalibrationmesh.cc b/owlps-positioner/autocalibrationmesh.cc index a3f2c47..b9f0dfe 100644 --- a/owlps-positioner/autocalibrationmesh.cc +++ b/owlps-positioner/autocalibrationmesh.cc @@ -185,8 +185,7 @@ void AutocalibrationMesh::compute_multi_packet_ss() const cp &ref1 = ref_cps[0] ; const ReferencePoint &ref1_rp = Stock::get_reference_point(ref1.cp->get_coordinates()) ; - const vector &ref1_cr = - ref1_rp.get_requests() ; + const vector &ref1_cr = ref1_rp.get_requests() ; /* Search for the first measurement made by RX in ref1_rp */ const Measurement *rx_measurement = NULL ; @@ -233,10 +232,11 @@ bool AutocalibrationMesh::compute_single_packet_ss(pkt_id_t pkt_id) /* Compute the consolidated SS */ double rx_ss = 0 ; + // Reminder: ref_cps.size() can be 1 or 2 for (unsigned int i = 0 ; i < ref_cps.size() ; ++i) { double tmp_ss = compute_weighted_ss(i, pkt_id, point_dst) ; - if (tmp_ss > 0) // error + if (tmp_ss > 127) // error return false ; rx_ss += tmp_ss ; } @@ -263,7 +263,7 @@ bool AutocalibrationMesh::compute_single_packet_ss(pkt_id_t pkt_id) * generate only one packet per reference point. * @param point_dst The distance RX-P. * - * @returns The weighted SS value in dBm, or 1 in case of error. + * @returns The weighted SS value in dBm, or 128 in case of error. */ double AutocalibrationMesh::compute_weighted_ss( unsigned int cp_idx, pkt_id_t pkt_id, float point_dst) @@ -281,7 +281,7 @@ double AutocalibrationMesh::compute_weighted_ss( { friis_idx = rp.friis_index_for_cp(rx_mac, pkt_id) ; if (friis_idx == 0) - return 1 ; // The packet pkt_id does not exist in rp + return 128 ; // The packet pkt_id does not exist in rp } /* SS */ diff --git a/owlps-positioner/autocalibrationmesh.hh b/owlps-positioner/autocalibrationmesh.hh index a5608aa..70bae40 100644 --- a/owlps-positioner/autocalibrationmesh.hh +++ b/owlps-positioner/autocalibrationmesh.hh @@ -60,7 +60,7 @@ protected: std::map::const_iterator> >::const_iterator s) ; - /// Generates the SSs for all the CPs + /// Generates the SSs for the current CP void generate_ss(void) ; /// Sorts the reference CPs for a receiver CP void sort_reference_cps(void) ;