mirror of
https://gitea.farpn.net/w1cdn/mwtchahrd.git
synced 2025-11-03 13:36:36 -06:00
Rearrange.
This commit is contained in:
47
src/main.rs
47
src/main.rs
@@ -408,29 +408,6 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
||||
} else {
|
||||
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).
|
||||
if basic_destination.to_uppercase().contains("NODES") {
|
||||
@@ -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());
|
||||
|
||||
// If Spothole is enabled
|
||||
@@ -474,6 +474,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager, loc_st
|
||||
// POST JSON
|
||||
let packet = json!({
|
||||
"dx_call": &source,
|
||||
//"dx_aprs_ssid": "7",
|
||||
"de_call": &my_call,
|
||||
"de_latitude": &my_lat,
|
||||
"de_longitude": &my_lon,
|
||||
|
||||
Reference in New Issue
Block a user