heliwatch: ignore big planes by emitter_category, lift MAX_ALTITUDE to 10_000 ft
This commit is contained in:
parent
3fbb5febfb
commit
71b534fe6e
|
@ -6,10 +6,21 @@ use tokio::sync::mpsc::{channel, Receiver};
|
|||
use super::location::Locations;
|
||||
|
||||
/// ft
|
||||
const MAX_ALTITUDE: u16 = 5000;
|
||||
const MAX_ALTITUDE: u16 = 10_000;
|
||||
/// s
|
||||
const STATE_TIMEOUT: u64 = 180;
|
||||
|
||||
const IGNORED_CATEGORIES: &[u8] = &[
|
||||
// Small (15,500..75,000) lbs
|
||||
2,
|
||||
// Large (75,000..300,000 lbs)
|
||||
3,
|
||||
// High Vortex Large
|
||||
4,
|
||||
// Heavy (> 300,000 lbs)
|
||||
5,
|
||||
];
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Event {
|
||||
pub action: Action,
|
||||
|
@ -122,8 +133,8 @@ pub fn run(host: &'static str, port: u16, locations: Locations) -> Receiver<Even
|
|||
let hex = format!("{}", icao_address);
|
||||
let entry = entry.read().unwrap();
|
||||
|
||||
if entry.altitude.map(|altitude| altitude > MAX_ALTITUDE)
|
||||
.unwrap_or(false)
|
||||
if entry.altitude.map(|altitude| altitude > MAX_ALTITUDE).unwrap_or(false) ||
|
||||
entry.emitter_category.as_ref().map(|category| IGNORED_CATEGORIES.contains(category)).unwrap_or(false)
|
||||
{
|
||||
if !ignored.contains(&hex) {
|
||||
ignored.insert(hex.clone());
|
||||
|
|
Loading…
Reference in New Issue