From a167ff274dedfc082408196323a3bc8dd2c2f10a Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sun, 29 Dec 2024 15:02:25 +1030 Subject: [PATCH 01/20] Round frequency data to 1 kHz on display --- js/sondehub.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/sondehub.js b/js/sondehub.js index 15920e6..d0fd503 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -1369,6 +1369,11 @@ function habitat_data(jsondata, data_ages, current_timestamp, alternative) { } } + // Round frequency data + if(k === "frequency"){ + v = v.toFixed(3); + } + // Check if data is considered to be 'old' // Need to think about how to style old data. // Maybe make the text grey? @@ -2865,7 +2870,7 @@ function mapInfoBox_handle_path_new(data, vehicle, date) { if (data.hasOwnProperty("tx_frequency")) { html += "
TX Frequency: " + data.tx_frequency + " MHz
"; } else if (data.hasOwnProperty("frequency")) { - html += "
Frequency: " + data.frequency + " MHz
"; + html += "
Frequency: " + data.frequency.toFixed(3) + " MHz
"; }; if (data.hasOwnProperty("humidity")) { html += "
Relative Humidity: " + data.humidity + " %
"; From 7c11aa7aca42f452dd2147933d4bb9747bbac761 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Sun, 26 Jan 2025 15:38:58 +1030 Subject: [PATCH 02/20] Move recovery reporting to ballon tab. Add planned recovery option, and handling of planned tag --- index.template.html | 107 ++++++++++++++++++++++++-------------------- js/app.js | 27 +++++++++++ js/chasecar.lib.js | 20 ++++++--- js/sondehub.js | 23 +++++++++- js/station.js | 11 ++++- 5 files changed, 129 insertions(+), 59 deletions(-) diff --git a/index.template.html b/index.template.html index 8a10079..205fbd8 100644 --- a/index.template.html +++ b/index.template.html @@ -89,16 +89,66 @@
-

Report Recovery

-
-
- You can report a recovery here. Enter the serial number (e.g. 'S1234567'), tick recovered/not recovered, and add some notes. Click here for information on how to locate a sonde's serial number. If the sonde is not on the map, type its serial into the top-left search box and press enter to retrieve historical data. You can then mark it as recovered. Optionally, you can use your location instead of the sonde's last location. -
-
- Serial - -
-
- Recovery Success -
- - -
-
-
- Use Car Position -
- - -
-
-
- Notes -
-
- - - - -
-
- Report Result - none -
-
-
-
-
- -
+ Recovery reporting is now on the recoveries tab! (Balloon icon) diff --git a/js/app.js b/js/app.js index 60fa4ee..a0c1ab4 100644 --- a/js/app.js +++ b/js/app.js @@ -748,6 +748,23 @@ $(window).ready(function() { // turning the switch on } else { e.removeClass('off').addClass('on'); + // Remove any planned recovery check. + $("#sw_recovery_planned").removeClass('on').addClass('off'); + } + }); + // Logic to switch the recovery Planned button + $("#sw_recovery_planned").click(function() { + var e = $(this); + + // turning the switch off + if(e.hasClass('on')) { + e.removeClass('on').addClass('off'); + + // turning the switch on + } else { + e.removeClass('off').addClass('on'); + // Set recovery OK to false. + $("#sw_recovery_ok").removeClass('on').addClass('off'); } }); // Logic to switch the use car position button @@ -768,11 +785,21 @@ $(window).ready(function() { callsign = $(this).val().trim(); offline.set('callsign', callsign); // put in localStorage CHASE_listenerSent = false; + $('#recovery_callsign').val(callsign); + }); + + $("#recovery_callsign").on('change keyup', function() { + callsign = $(this).val().trim(); + offline.set('callsign', callsign); // put in localStorage + CHASE_listenerSent = false; + $('#cc_callsign').val(callsign); }); + // load value from localStorage callsign = offline.get('callsign'); $('#cc_callsign').val(callsign); + $('#recovery_callsign').val(callsign); // settings page diff --git a/js/chasecar.lib.js b/js/chasecar.lib.js index 23b706c..262b7d7 100644 --- a/js/chasecar.lib.js +++ b/js/chasecar.lib.js @@ -45,8 +45,8 @@ ChaseCar.updatePosition = function(callsign, position) { ChaseCar.markRecovered = function(){ - // Distance limits reinstated 2021-12-04 - _run_checks = true; + // Remove range checks - 2025-01-24 + _range_check = false; _range_limit = 500000; // 200 km // Get the serial number to be marked recovered @@ -55,15 +55,15 @@ ChaseCar.markRecovered = function(){ _notes = $("#pr_notes").val().trim(); // Check it exists. - if(_serial.includes("chase") && _run_checks){ + if(_serial.includes("chase")){ $('#pr_last_report').text("Invalid sonde callsign."); return; } - _callsign = $("#cc_callsign").val().trim(); + _callsign = $("#recovery_callsign").val().trim(); if (_callsign == "" || _callsign == undefined || _callsign.length == 0) { - $('#pr_last_report').text("Enter a callsign in the chase-car section above!"); + $('#pr_last_report').text("Enter a callsign/name in the 'Recovered by' field!"); return; } @@ -109,7 +109,7 @@ ChaseCar.markRecovered = function(){ // Calculate the distance from the sonde _lookangles = calculate_lookangles(_chaser, _sonde); - if( (_lookangles.range > _range_limit ) && _run_checks){ + if( (_lookangles.range > _range_limit ) && _range_check){ $('#pr_last_report').text("Outside distance limit (500km)."); return; } @@ -120,13 +120,18 @@ ChaseCar.markRecovered = function(){ } } + // Logic to make recovery & planned mutually exclusive is in app.js + _recovered = $("#sw_recovery_ok").hasClass('on'); + _planned = $("#sw_recovery_planned").hasClass('on'); + var _doc = { "serial": _serial, "lat": _recov_lat, "lon": _recov_lon, "alt": 0.0, - "recovered": $("#sw_recovery_ok").hasClass('on'), + "recovered": _recovered, + "planned": _planned, "recovered_by": _callsign, "description": _notes }; @@ -142,6 +147,7 @@ ChaseCar.markRecovered = function(){ $('#pr_last_report').text("Submitting report..."); + $.ajax({ type: "PUT", url: ChaseCar.recovery_uri, diff --git a/js/sondehub.js b/js/sondehub.js index d0fd503..007a584 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -4699,8 +4699,17 @@ function updateRecoveryMarker(recovery) { div = document.createElement('div'); + _recovered_text = recovery.recovered ? " Recovered" : " Not Recovered"; + + // Override text is planned field exists and is true + if(recovery.hasOwnProperty('planned')){ + if(recovery.planned == true){ + _recovered_text = " Recovery Planned"; + } + } + html = "
"; - html += "
"+recovery.serial+(recovery.recovered ? " Recovered" : " Not Recovered")+"
"; + html += "
"+recovery.serial+_recovered_text+"
"; html += "
"; html += "
 "+format_coordinates(recovery.lat, recovery.lon, recovery.serial)+"
"; @@ -4755,6 +4764,7 @@ function updateRecoveryMarker(recovery) { recovery.recovered = r[i].recovered; recovery.description = r[i].description; recovery.datetime = r[i].datetime; + recovery.planned = r[i].planned; recovery.fresh = true; updateRecoveryMarker(recovery); @@ -4808,8 +4818,17 @@ function updateRecoveryPane(r){ recoveries[r_index] = {marker: null, infobox: null}; } + _recovered_text = r[i].recovered ? " Recovered by " : " Not Recovered by "; + + // Override text is planned field exists and is true + if(r[i].hasOwnProperty('planned')){ + if(r[i].planned == true){ + _recovered_text = " Recovery Planned by "; + } + } + html += "
"; - html += "
"+r[i].serial+(r[i].recovered ? " Recovered by " : " Not Recovered by ")+r[i].recovered_by+"
"; + html += "
"+r[i].serial+(_recovered_text)+r[i].recovered_by+"
"; html += "
 "+format_coordinates(lat, lon, r[i].serial)+"
"; var imp = offline.get('opt_imperial'); diff --git a/js/station.js b/js/station.js index 74f053c..59b87f4 100644 --- a/js/station.js +++ b/js/station.js @@ -195,7 +195,16 @@ function drawHistorical (data, station) { html += "
"; if (recovered) { - html += "
"+(recovery_info.recovered ? "Recovered by " : "Not Recovered by ")+recovery_info.recovered_by+"
"; + _recovered_text = recovery_info.recovered ? "Recovered by " : "Not Recovered by "; + + // Override text is planned field exists and is true + if(recovery_info.hasOwnProperty('planned')){ + if(recovery_info.planned == true){ + _recovered_text = "Recovery Planned by "; + } + } + + html += "
"+(_recovered_text)+recovery_info.recovered_by+"
"; html += "
Recovery time: "+formatDate(stringToDateUTC(recovery_info.datetime))+"
"; html += "
Recovery location: "+recovery_info.position[1]+", "+recovery_info.position[0] + "
"; html += "
Recovery notes: "+recovery_info.description+"
"; From 998449e9e3d7bc4686c7381b7c93e8ce60e15e7a Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Mon, 27 Jan 2025 16:03:41 +1030 Subject: [PATCH 03/20] Add recovery warning popup when at zoom >=13 --- index.template.html | 17 ++++++++----- js/app.js | 6 ++--- js/sondehub.js | 58 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 9 deletions(-) diff --git a/index.template.html b/index.template.html index 205fbd8..ceea0a1 100644 --- a/index.template.html +++ b/index.template.html @@ -91,11 +91,13 @@

Report Recovery


-
- You can report a recovery here. Enter the serial number (e.g. 'S1234567'), tick recovered/not recovered, and add some notes. Click here for information on how to locate a sonde's serial number. If the sonde is not on the map, type its serial into the top-left search box (may require landscape mode on mobile) and press enter to retrieve historical data. You can then mark it as recovered or planned. Optionally, you can use your location instead of the sonde's last location. +
+ Please report recovered radiosondes! Don't waste others time and effort with a frustrating failed recovery! + Enter the serial number, select recovered / planned, and add some notes. If marking as planned, please add contact information! + If the sonde is not on the map, type its serial into the top-left search box (may require landscape mode on mobile) and press enter to retrieve historical data.
- Serial + Serial (Help)
@@ -117,7 +119,7 @@

Report Recovery

- Use Car Position + Use Browser Position
@@ -411,6 +413,9 @@

Chase Mode

Zoom in for realtime data!
+
-
This version of SondeHub is out of date. Click here to reload. Page will reload automatically in -
+
This version of SondeHub is out of date. Click here to reload. Page will reload automatically in
+ diff --git a/js/app.js b/js/app.js index a0c1ab4..ec5f472 100644 --- a/js/app.js +++ b/js/app.js @@ -684,9 +684,9 @@ $(window).ready(function() { } else { wvar.box = null } - console.log("aaa") - console.log(wvar.box) - console.log("bbbb") + //console.log("aaa") + //console.log(wvar.box) + //console.log("bbbb") lhash_update(true); checkSize(); }); diff --git a/js/sondehub.js b/js/sondehub.js index 007a584..620abf2 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -1058,6 +1058,7 @@ function load() { } } updateZoom(); + recoveryPopup(); }); map.on('movestart', function() { @@ -1497,6 +1498,63 @@ function drawLOSPaths(vcallsign) { }); } +var recovery_popup = true; +function recoveryPopup(){ + // Conditions for showing this are: + // Zoom level >= 13 + // A sonde is in the map view area. (Use the subscribed sondes for this) + // If a user position is available, that position is within 500km of the sonde. + recovery_popup_limit = 500000; + + if( (map.getZoom() >= 13) && (clientTopic.length >= 2)){ + if(recovery_popup == true){ + // Logic to not show a popup if the centre of the map is > 500km from the viewer location, + _viewer_lat = parseFloat($('#cc_lat').text()) + _viewer_lon = parseFloat($('#cc_lon').text()) + + if ( (_viewer_lat != 0.0) && (_viewer_lon != 0.0) ){ + + _map_centre = { + 'lat':map.getCenter().lat, + 'lon':map.getCenter().lng, + 'alt':0.0 + }; + _viewer = { + 'lat': _viewer_lat, + 'lon': _viewer_lon, + 'alt': 0.0 + }; + + // Calculate the distance from the sonde + _lookangles = calculate_lookangles(_viewer, _map_centre); + + if(_lookangles.range > recovery_popup_limit){ + return; + } + } + + // If we're here, then we either don't have a valid viewer location, + // Or the viewer is within 500km. Show the popup. + console.log("Triggering Recovery Popup.") + document.getElementById("recovery_notice").style.display = "block"; + // Don't re-activate the popup again + recovery_popup = false; + return; + } + } + document.getElementById("recovery_notice").style.display = "none"; +} + +function show_recoveries(){ + if ($("#recoveriesbox").is(':visible') == false){ + $('.nav .recoveries').click(); + } + + document.getElementById("recovery_notice").style.display = "none"; + recovery_popup = false; +} + + function focusVehicle(vcallsign, ignoreOpt) { if(!offline.get('opt_hilight_vehicle') && ignoreOpt === undefined) return; From f53635e7b3789924cb106c0a9e9f0e7a61f7fb99 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Mon, 27 Jan 2025 16:13:52 +1030 Subject: [PATCH 04/20] Remove unneeded console.log --- js/sondehub.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/sondehub.js b/js/sondehub.js index 620abf2..df51278 100644 --- a/js/sondehub.js +++ b/js/sondehub.js @@ -1535,7 +1535,7 @@ function recoveryPopup(){ // If we're here, then we either don't have a valid viewer location, // Or the viewer is within 500km. Show the popup. - console.log("Triggering Recovery Popup.") + //console.log("Triggering Recovery Popup.") document.getElementById("recovery_notice").style.display = "block"; // Don't re-activate the popup again recovery_popup = false; @@ -1549,7 +1549,7 @@ function show_recoveries(){ if ($("#recoveriesbox").is(':visible') == false){ $('.nav .recoveries').click(); } - + document.getElementById("recovery_notice").style.display = "none"; recovery_popup = false; } From bdbef47146e2f6d03c363b018cccc6192b2ca8d8 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Mon, 27 Jan 2025 16:55:57 +1030 Subject: [PATCH 05/20] Change recovery popup text --- index.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.template.html b/index.template.html index ceea0a1..c6b693e 100644 --- a/index.template.html +++ b/index.template.html @@ -414,7 +414,7 @@

Chase Mode

Zoom in for realtime data!