From 425763627de9b22f7bedde037b4c2d6c2403ac47 Mon Sep 17 00:00:00 2001 From: andrekir Date: Wed, 13 Dec 2023 17:29:36 -0300 Subject: [PATCH] refactor: cleanup `isOnline` logic --- app/src/main/java/com/geeksville/mesh/NodeInfo.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/NodeInfo.kt b/app/src/main/java/com/geeksville/mesh/NodeInfo.kt index 51f39af35..de4ad9c35 100644 --- a/app/src/main/java/com/geeksville/mesh/NodeInfo.kt +++ b/app/src/main/java/com/geeksville/mesh/NodeInfo.kt @@ -222,17 +222,12 @@ data class NodeInfo( /** * true if the device was heard from recently - * - * Note: if a node has never had its time set, it will have a time of zero. In that - * case assume it is online - so that we will start sending GPS updates */ val isOnline: Boolean get() { val now = System.currentTimeMillis() / 1000 - // FIXME - use correct timeout from the device settings - val timeout = - 15 * 60 // Don't set this timeout too tight, or otherwise we will stop sending GPS helper positions to our device - return (now - lastHeard <= timeout) || lastHeard == 0 + val timeout = 15 * 60 + return (now - lastHeard <= timeout) } /// return the position if it is valid, else null