From 4f07c62cc9364969fb4adf7e74a4e05d821db801 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Tue, 21 Apr 2020 21:00:16 +0200 Subject: [PATCH] use the latest available thread --- htdocs/lib/Js8Threads.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/lib/Js8Threads.js b/htdocs/lib/Js8Threads.js index 12997a6..d665b10 100644 --- a/htdocs/lib/Js8Threads.js +++ b/htdocs/lib/Js8Threads.js @@ -96,6 +96,9 @@ Js8Threader.prototype.findThread = function(freq) { // max frequency deviation: 5 Hz. this may be a little tight. return thread.isOpen() && Math.abs(thread.getAverageFrequency() - freq) <= 5; }); + matching.sort(function(a, b){ + return b.getLatestTimestamp() - a.getLatestTimestamp(); + }); return matching[0] || false; };