feat: Add WSPR telemetry decoding and fix module paths
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
40
index.js
40
index.js
@@ -1,8 +1,9 @@
|
|||||||
import { QuerierWsprLive } from './js/QuerierWsprLive.js';
|
import { QuerierWsprLive } from './js/QuerierWsprLive.js';
|
||||||
|
import { WSPREncoded } from './js/WSPREncoded.js';
|
||||||
|
|
||||||
// This function reuses your existing code to perform the same search
|
// This function reuses your existing code to perform the same search
|
||||||
// as the wspr.live URL you provided.
|
// as the wspr.live URL you provided, then decodes the telemetry.
|
||||||
async function fetchWsprData() {
|
async function fetchAndDecodeWsprData() {
|
||||||
const querier = new QuerierWsprLive();
|
const querier = new QuerierWsprLive();
|
||||||
|
|
||||||
// Parameters from your query URL:
|
// Parameters from your query URL:
|
||||||
@@ -16,9 +17,38 @@ async function fetchWsprData() {
|
|||||||
const results = await querier.SearchRegularType1(band, min, callsign, timeStart, timeEnd);
|
const results = await querier.SearchRegularType1(band, min, callsign, timeStart, timeEnd);
|
||||||
|
|
||||||
console.log(`Found ${results.length} records.`);
|
console.log(`Found ${results.length} records.`);
|
||||||
console.log(results);
|
|
||||||
|
|
||||||
return results;
|
const positions = [];
|
||||||
|
for (const record of results) {
|
||||||
|
// Decode telemetry from grid and power
|
||||||
|
const telemetry = WSPREncoded.DecodeU4BGridPower(record.grid4, record.powerDbm);
|
||||||
|
|
||||||
|
if (telemetry.msgType === 'standard') {
|
||||||
|
// If it's standard telemetry, decode callsign for fine-grained location
|
||||||
|
const [grid56, altitudeMeters] = WSPREncoded.DecodeU4BCall(record.callsign);
|
||||||
|
|
||||||
|
const fullGrid = record.grid4 + grid56;
|
||||||
|
|
||||||
|
// Convert Maidenhead grid to latitude and longitude
|
||||||
|
const [lat, lng] = WSPREncoded.DecodeMaidenheadToDeg(fullGrid);
|
||||||
|
|
||||||
|
positions.push({
|
||||||
|
time: record.time,
|
||||||
|
callsign: record.callsign,
|
||||||
|
grid: fullGrid,
|
||||||
|
lat: lat,
|
||||||
|
lng: lng,
|
||||||
|
altitude: altitudeMeters,
|
||||||
|
powerDbm: record.powerDbm,
|
||||||
|
rxBy: record.rxCallsign,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchWsprData();
|
console.log(`Decoded ${positions.length} positions.`);
|
||||||
|
console.log(positions);
|
||||||
|
|
||||||
|
return positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchAndDecodeWsprData();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ See the /faq/tos page for details.
|
|||||||
(If this generated header is stamped on a file which is a 3rd party file or under a different license or copyright, then ignore this copyright statement and use that file's terms.)
|
(If this generated header is stamped on a file which is a 3rd party file or under a different license or copyright, then ignore this copyright statement and use that file's terms.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as utl from '/js/Utl.js';
|
import * as utl from './Utl.js';
|
||||||
|
|
||||||
import { Base } from './Base.js';
|
import { Base } from './Base.js';
|
||||||
import { CandidateFilterByBadTelemetry } from './CandidateFilterByBadTelemetry.js';
|
import { CandidateFilterByBadTelemetry } from './CandidateFilterByBadTelemetry.js';
|
||||||
@@ -19,9 +19,9 @@ import { CodecHeartbeat } from './CodecHeartbeat.js';
|
|||||||
import { CodecExpandedBasicTelemetry } from './CodecExpandedBasicTelemetry.js';
|
import { CodecExpandedBasicTelemetry } from './CodecExpandedBasicTelemetry.js';
|
||||||
import { CodecHighResLocation } from './CodecHighResLocation.js';
|
import { CodecHighResLocation } from './CodecHighResLocation.js';
|
||||||
import { QuerierWsprLive } from './QuerierWsprLive.js';
|
import { QuerierWsprLive } from './QuerierWsprLive.js';
|
||||||
import { WSPR } from '/js/WSPR.js';
|
import { WSPR } from './WSPR.js';
|
||||||
import { WsprCodecMaker } from '/pro/codec/WsprCodec.js';
|
import { WsprCodecMaker } from '/pro/codec/WsprCodec.js';
|
||||||
import { WSPREncoded } from '/js/WSPREncoded.js';
|
import { WSPREncoded } from './WSPREncoded.js';
|
||||||
import { WsprMessageCandidate, NonRejectedOnlyFilter } from './WsprMessageCandidate.js';
|
import { WsprMessageCandidate, NonRejectedOnlyFilter } from './WsprMessageCandidate.js';
|
||||||
import { WsprSearchResultDataTableBuilder } from './WsprSearchResultDataTableBuilder.js';
|
import { WsprSearchResultDataTableBuilder } from './WsprSearchResultDataTableBuilder.js';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user