Skip to content

Proposal for location based matching to Prefixes #255

@ericszimmermann

Description

@ericszimmermann

Hello I do not know flutter enough yet to program this,
but I wanted to make this proposal of my ideas.

I have two Issues:

  • In SNR Indicator: Wrong name for repeaters! Prioritize Repeaters (Contacts should be direct contacts only) and on multiple prefix-matches on Repeater which is nearest.
  • In Path Trace: Also on multiple matches to a prefix, take the location of the preceding and subsequent node. Take the point in between them and search from this point for the nearest prefix-match.

Here some moc-up code:

location middle_location(contact prev_repeater, contact subsequent_repeater) {
  double avg_lon = (prev_repeater.location.lon + subsequent_repeater.location.lon)/2;
  double avg_lat = (prev_repeater.location.lat + subsequent_repeater.location.lat)/2;
  if( (prev_repeater.location.lon < -150 and subsequent_repeater.location.lon > 150) or ( (prev_repeater.location.lon > 150 and subsequent_repeater.location.lon < -150) ) ) {
    avg_lon = (prev_repeater.location.lon + subsequent_repeater.location.lon)/2;
    avg_lat = (prev_repeater.location.lat + subsequent_repeater.location.lat)/2;
    if( avg_lon <= 0 ) {
      avg_lon += 180.0;
    }
    else {
      avg_lon -= 180.0;
    }
  }
  return location(avg_lon, avg_lat)
}

contact find_nearest_contact(int unkown_repeater_prefixbyte, location poi) {
  double distance = DOUBLE_MAX;
  contact found_contact = None;
  int i = 0;
  
  for( i=0; i < len( contacts ); i++) {
    if contacts[i].matches_prefix(unkown_repeater_prefixbyte):
      double d = calc_distance( poi.lon, poi.lat, contacts[i] );
      if (d < distance ) {
        distance = d;
        found_contact = contact;
      }
    }
  }
}

contact find_nearest_repeater(int epeater_prefixbyte, contact prev_repeater, contact subsequent_repeater) {
  middle = middle_location(contact prev_repeater, contact subsequent_repeater);
  most_likely_repeater = find_nearest_contact( repeater_prefixbyte, middle );
  return most_likely_repeater
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions