forked from n6cta/mwtchahrd
Rearrange.
This commit is contained in:
47
src/main.rs
47
src/main.rs
@@ -409,29 +409,6 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
|||||||
basic_destination.clone()
|
basic_destination.clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extract location from APRS format
|
|
||||||
let (lat, lon) = aprs_loc(&text);
|
|
||||||
|
|
||||||
// Store the location
|
|
||||||
// Only update location store if there is a real location
|
|
||||||
if lat > -9999.0_f64 && lon > -9999.0_f64 {
|
|
||||||
let loc = vec![lat.to_string(), lon.to_string()];
|
|
||||||
loc_store.insert(source.clone(), loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look up a stored location
|
|
||||||
// If it doesn't exist, set to empty
|
|
||||||
let stored_loc = match loc_store.get(&source) {
|
|
||||||
Some(loc_value) => loc_value,
|
|
||||||
None => &vec!["".to_string(), "".to_string()],
|
|
||||||
};
|
|
||||||
|
|
||||||
// Only send good locations on
|
|
||||||
let json_lat = stored_loc[0].clone() ;
|
|
||||||
let json_lon = stored_loc[1].clone() ;
|
|
||||||
//let json_lat = if lat > -9999.0_f64 && lon > -9999.0_f64 { lat.to_string() } else { old_loc[0].clone() };
|
|
||||||
//let json_lon = if lat > -9999.0_f64 && lon > -9999.0_f64 { lon.to_string() } else { old_loc[1].clone() };
|
|
||||||
|
|
||||||
// Ignore frames where the basic destination contains "NODES" (case‑insensitive).
|
// Ignore frames where the basic destination contains "NODES" (case‑insensitive).
|
||||||
if basic_destination.to_uppercase().contains("NODES") {
|
if basic_destination.to_uppercase().contains("NODES") {
|
||||||
return;
|
return;
|
||||||
@@ -467,6 +444,29 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extract location from APRS format
|
||||||
|
let (lat, lon) = aprs_loc(&text);
|
||||||
|
|
||||||
|
// Store the location
|
||||||
|
// Only update location store if there is a real location
|
||||||
|
if lat > -9999.0_f64 && lon > -9999.0_f64 {
|
||||||
|
let loc = vec![lat.to_string(), lon.to_string()];
|
||||||
|
loc_store.insert(source.clone(), loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look up a stored location
|
||||||
|
// If it doesn't exist, set to empty
|
||||||
|
let stored_loc = match loc_store.get(&source) {
|
||||||
|
Some(loc_value) => loc_value,
|
||||||
|
None => &vec!["".to_string(), "".to_string()],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Only send good locations on
|
||||||
|
let json_lat = stored_loc[0].clone() ;
|
||||||
|
let json_lon = stored_loc[1].clone() ;
|
||||||
|
//let json_lat = if lat > -9999.0_f64 && lon > -9999.0_f64 { lat.to_string() } else { old_loc[0].clone() };
|
||||||
|
//let json_lon = if lat > -9999.0_f64 && lon > -9999.0_f64 { lon.to_string() } else { old_loc[1].clone() };
|
||||||
|
|
||||||
println!("Stored location: {} {}", stored_loc[0].clone(), stored_loc[1].clone());
|
println!("Stored location: {} {}", stored_loc[0].clone(), stored_loc[1].clone());
|
||||||
|
|
||||||
// If Spothole is enabled
|
// If Spothole is enabled
|
||||||
@@ -474,6 +474,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
|||||||
// POST JSON
|
// POST JSON
|
||||||
let packet = json!({
|
let packet = json!({
|
||||||
"dx_call": &source,
|
"dx_call": &source,
|
||||||
|
//"dx_aprs_ssid": "7",
|
||||||
"de_call": &my_call,
|
"de_call": &my_call,
|
||||||
"de_latitude": &my_lat,
|
"de_latitude": &my_lat,
|
||||||
"de_longitude": &my_lon,
|
"de_longitude": &my_lon,
|
||||||
|
|||||||
Reference in New Issue
Block a user