mirror of
https://github.com/smittix/intercept.git
synced 2026-07-24 00:48:11 -07:00
Speed up satellite live telemetry updates
This commit is contained in:
@@ -792,6 +792,7 @@
|
|||||||
const DASHBOARD_FETCH_TIMEOUT_MS = 30000;
|
const DASHBOARD_FETCH_TIMEOUT_MS = 30000;
|
||||||
const PASS_FETCH_TIMEOUT_MS = 90000;
|
const PASS_FETCH_TIMEOUT_MS = 90000;
|
||||||
const SAT_DRAWER_FETCH_TIMEOUT_MS = 15000;
|
const SAT_DRAWER_FETCH_TIMEOUT_MS = 15000;
|
||||||
|
const TELEMETRY_POLL_INTERVAL_MS = 3000;
|
||||||
const BUILTIN_TX_FALLBACK = {
|
const BUILTIN_TX_FALLBACK = {
|
||||||
25544: [
|
25544: [
|
||||||
{ description: 'APRS digipeater', downlink_low: 145.825, downlink_high: 145.825, uplink_low: null, uplink_high: null, mode: 'FM AX.25', baud: 1200, status: 'active', type: 'beacon', service: 'Packet' },
|
{ description: 'APRS digipeater', downlink_low: 145.825, downlink_high: 145.825, uplink_low: null, uplink_high: null, mode: 'FM AX.25', baud: 1200, status: 'active', type: 'beacon', service: 'Packet' },
|
||||||
@@ -1015,10 +1016,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applyTelemetryPosition(pos, options = {}) {
|
function applyTelemetryPosition(pos, options = {}) {
|
||||||
const { updateVisible = false } = options;
|
const { updateVisible = false, noradId = selectedSatellite } = options;
|
||||||
if (!pos) return;
|
if (!pos) return;
|
||||||
latestLivePosition = pos;
|
latestLivePosition = pos;
|
||||||
cacheLivePosition(selectedSatellite, pos);
|
cacheLivePosition(noradId, pos);
|
||||||
|
|
||||||
const telLat = document.getElementById('telLat');
|
const telLat = document.getElementById('telLat');
|
||||||
const telLon = document.getElementById('telLon');
|
const telLon = document.getElementById('telLon');
|
||||||
@@ -1259,7 +1260,13 @@
|
|||||||
if (!pos) {
|
if (!pos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
applyTelemetryPosition({ ...pos, visibleCount }, { updateVisible: true });
|
applyTelemetryPosition(
|
||||||
|
{ ...pos, visibleCount },
|
||||||
|
{
|
||||||
|
updateVisible: true,
|
||||||
|
noradId: parseInt(pos.norad_id, 10) || selectedSatellite
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function findSelectedPosition(positions) {
|
function findSelectedPosition(positions) {
|
||||||
@@ -1291,6 +1298,7 @@
|
|||||||
const lat = parseFloat(document.getElementById('obsLat')?.value);
|
const lat = parseFloat(document.getElementById('obsLat')?.value);
|
||||||
const lon = parseFloat(document.getElementById('obsLon')?.value);
|
const lon = parseFloat(document.getElementById('obsLon')?.value);
|
||||||
if (!Number.isFinite(lat) || !Number.isFinite(lon) || !selectedSatellite) return;
|
if (!Number.isFinite(lat) || !Number.isFinite(lon) || !selectedSatellite) return;
|
||||||
|
const requestedSatellite = selectedSatellite;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
@@ -1303,7 +1311,7 @@
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
latitude: lat,
|
latitude: lat,
|
||||||
longitude: lon,
|
longitude: lon,
|
||||||
satellites: [selectedSatellite],
|
satellites: [requestedSatellite],
|
||||||
includeTrack: false
|
includeTrack: false
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -1313,16 +1321,17 @@
|
|||||||
if (!contentType.includes('application/json')) return;
|
if (!contentType.includes('application/json')) return;
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
if (data.status !== 'success' || !Array.isArray(data.positions)) return;
|
if (data.status !== 'success' || !Array.isArray(data.positions)) return;
|
||||||
if (!findSelectedPosition(data.positions)) {
|
const pos = data.positions.find(p => parseInt(p.norad_id, 10) === requestedSatellite) || null;
|
||||||
return;
|
if (!pos) return;
|
||||||
}
|
cacheLivePosition(requestedSatellite, pos);
|
||||||
|
if (requestedSatellite !== selectedSatellite) return;
|
||||||
handleLivePositions(data.positions);
|
handleLivePositions(data.positions);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTelemetryPolling() {
|
function startTelemetryPolling() {
|
||||||
if (_telemetryPollTimer) return;
|
if (_telemetryPollTimer) return;
|
||||||
_telemetryPollTimer = setInterval(fetchCurrentTelemetry, 10000);
|
_telemetryPollTimer = setInterval(fetchCurrentTelemetry, TELEMETRY_POLL_INTERVAL_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
function splitAtAntimeridian(track) {
|
function splitAtAntimeridian(track) {
|
||||||
|
|||||||
Reference in New Issue
Block a user