[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.
This commit is contained in:
Matteo Cypriani 2013-07-08 18:58:19 -04:00
parent 652ed7b706
commit e7e4991000
2 changed files with 6 additions and 6 deletions

View File

@ -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<CalibrationRequest*> &ref1_cr =
ref1_rp.get_requests() ;
const vector<CalibrationRequest*> &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 */

View File

@ -60,7 +60,7 @@ protected:
std::map<double, std::pair<double, std::unordered_map<
std::string, CapturePoint>::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) ;