serialport reconnect rework - v1.3.0.1

This commit is contained in:
Amateur Audio Dude
2024-09-23 17:49:01 +10:00
committed by GitHub
parent a7931257d5
commit b4047cbabb
2 changed files with 39 additions and 0 deletions
+12
View File
@@ -425,6 +425,18 @@ function handleData(wss, receivedData, rdsWss) {
}
}
// Serialport retry code when port is open but communication is lost (additional code in index.js)
isSerialportAlive = true;
lastFrequencyAlive = '87.500';
setInterval(() => {
lastFrequencyAlive = initialData.freq;
// Activate serialport retry if handleData has not been executed for over 10 seconds
if (((Date.now() - lastUpdateTime) > 8000) && !isSerialportRetrying && serverConfig.xdrd.wirelessConnection === false) {
isSerialportAlive = false;
isSerialportRetrying = true;
}
}, 2000);
function showOnlineUsers(currentUsers) {
dataToSend.users = currentUsers;
initialData.users = currentUsers;