Merge branch 'psk-refresh' into 'master'

Poll PSKReporter every 5 minutes, and only if there have been transmissions

Closes #94

See merge request gridtracker.org/gridtracker!105
rich-presence
Matthew Chambers 2021-05-20 20:54:21 +00:00
commit d7e7cb2d84
1 zmienionych plików z 30 dodań i 11 usunięć

Wyświetl plik

@ -434,6 +434,9 @@ var g_dxccCount = {};
var g_unconfirmedCalls = new Map(); var g_unconfirmedCalls = new Map();
var g_tracker = {}; var g_tracker = {};
var g_lastTrasmissionTimeSec = timeNowSec();
const PSKREPORTER_INTERVAL_IN_SECONDS = 5 * 60;
initQSOdata(); initQSOdata();
@ -6767,6 +6770,8 @@ function handleWsjtxStatus(newMessage)
} }
else else
{ {
g_lastTrasmissionTimeSec = g_timeNow;
txrxdec.style.backgroundColor = "Red"; txrxdec.style.backgroundColor = "Red";
txrxdec.style.borderColor = "Orange"; txrxdec.style.borderColor = "Orange";
txrxdec.innerHTML = "TRANSMIT"; txrxdec.innerHTML = "TRANSMIT";
@ -15988,18 +15993,22 @@ function pskSpotCheck(timeSec)
if (myDEcall == null || myDEcall == "NOCALL" || myDEcall == "") return; if (myDEcall == null || myDEcall == "NOCALL" || myDEcall == "") return;
if ((g_spotsEnabled == 1 || g_rosterSpot) && (timeSec - g_receptionReports.lastDownloadTimeSec > 120 || g_receptionReports.lastDownloadTimeSec > timeSec)) if (
(g_spotsEnabled == 1 || g_rosterSpot) &&
(g_receptionReports.lastDownloadTimeSec < g_lastTrasmissionTimeSec) &&
(
timeSec - g_receptionReports.lastDownloadTimeSec > PSKREPORTER_INTERVAL_IN_SECONDS ||
g_receptionReports.lastDownloadTimeSec > timeSec
)
)
{ {
g_receptionReports.lastDownloadTimeSec = timeSec; g_receptionReports.lastDownloadTimeSec = timeSec;
localStorage.receptionSettings = JSON.stringify(g_receptionSettings); localStorage.receptionSettings = JSON.stringify(g_receptionSettings);
spotRefreshDiv.innerHTML = "..refreshing.."; spotRefreshDiv.innerHTML = "…refreshing…";
getBuffer( getBuffer(
"https://retrieve.pskreporter.info/query?rronly=1&lastseqno=" + `https://retrieve.pskreporter.info/query?rronly=1&lastseqno=${g_receptionReports.lastSequenceNumber}` +
g_receptionReports.lastSequenceNumber + `&senderCallsign=${encodeURIComponent(myRawCall)}` +
"&senderCallsign=" + `&appcontact=${encodeURIComponent(`GT-${pjson.version}`)}`,
encodeURIComponent(myRawCall) +
"&appcontact=" +
encodeURIComponent("contact@gridtracker.org"),
pskSpotResults, pskSpotResults,
null, null,
"https", "https",
@ -16007,10 +16016,20 @@ function pskSpotCheck(timeSec)
); );
} }
else if (g_spotsEnabled == 1) else if (g_spotsEnabled == 1)
{
if (
g_lastTrasmissionTimeSec < g_receptionReports.lastDownloadTimeSec &&
(timeSec - g_receptionReports.lastDownloadTimeSec) > PSKREPORTER_INTERVAL_IN_SECONDS
)
{
spotRefreshDiv.innerHTML = "No recent TX"
}
else
{ {
spotRefreshDiv.innerHTML = spotRefreshDiv.innerHTML =
"Refresh: " + "Refresh: " +
Number(120 - (timeSec - g_receptionReports.lastDownloadTimeSec)).toDHMS(); Number(PSKREPORTER_INTERVAL_IN_SECONDS - (timeSec - g_receptionReports.lastDownloadTimeSec)).toDHMS();
}
} }
} }