From b6b627ef656981effbb3462380c905a728c03f42 Mon Sep 17 00:00:00 2001 From: mattbk Date: Tue, 28 Oct 2025 12:42:33 -0500 Subject: [PATCH] Rearrange. --- src/main.rs | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/main.rs b/src/main.rs index 507eaeb..596fc8c 100644 --- a/src/main.rs +++ b/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,