From 8fffdac0a4e8d99a16a493cc42710282a8458561 Mon Sep 17 00:00:00 2001 From: kb-light Date: Thu, 28 Dec 2017 11:55:47 +0100 Subject: [PATCH] [BUGFIX] fix calculation of wifi clients (#106) --- output/meshviewer-ffrgb/struct.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/output/meshviewer-ffrgb/struct.go b/output/meshviewer-ffrgb/struct.go index b84627f..88707af 100644 --- a/output/meshviewer-ffrgb/struct.go +++ b/output/meshviewer-ffrgb/struct.go @@ -106,15 +106,14 @@ func NewNode(nodes *runtime.Nodes, n *runtime.Node) *Node { } if statistic := n.Statistics; statistic != nil { node.Clients = statistic.Clients.Total - if node.Clients == 0 { - node.Clients = statistic.Clients.Wifi24 + statistic.Clients.Wifi5 - } node.ClientsWifi24 = statistic.Clients.Wifi24 node.ClientsWifi5 = statistic.Clients.Wifi5 - wifi := node.ClientsWifi24 - node.ClientsWifi5 - if node.Clients >= wifi { - node.ClientsOthers = node.Clients - wifi + clientsWifi := node.ClientsWifi24 + node.ClientsWifi5 + if node.Clients == 0 { + node.Clients = clientsWifi + } else if node.Clients >= clientsWifi { + node.ClientsOthers = node.Clients - clientsWifi } node.RootFSUsage = statistic.RootFsUsage