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 { WSPREncoded } from './js/WSPREncoded.js';
|
||||
|
||||
// This function reuses your existing code to perform the same search
|
||||
// as the wspr.live URL you provided.
|
||||
async function fetchWsprData() {
|
||||
// as the wspr.live URL you provided, then decodes the telemetry.
|
||||
async function fetchAndDecodeWsprData() {
|
||||
const querier = new QuerierWsprLive();
|
||||
|
||||
// Parameters from your query URL:
|
||||
@@ -16,9 +17,38 @@ async function fetchWsprData() {
|
||||
const results = await querier.SearchRegularType1(band, min, callsign, timeStart, timeEnd);
|
||||
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Decoded ${positions.length} positions.`);
|
||||
console.log(positions);
|
||||
|
||||
return positions;
|
||||
}
|
||||
|
||||
fetchWsprData();
|
||||
fetchAndDecodeWsprData();
|
||||
|
||||
Reference in New Issue
Block a user