From e87093e69c6e935f1829c1ab71469c69d136e582 Mon Sep 17 00:00:00 2001 From: Nonoo Date: Mon, 9 Nov 2020 12:07:39 +0100 Subject: [PATCH] Do not read S/OVF while transmitting --- civcontrol.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/civcontrol.go b/civcontrol.go index 81340e8..da30ee1 100644 --- a/civcontrol.go +++ b/civcontrol.go @@ -1302,15 +1302,17 @@ func (s *civControlStruct) loop() { s.deinitFinished <- true return case <-time.After(statusPollInterval): - if !s.state.getS.pending && time.Since(s.state.lastSReceivedAt) >= statusPollInterval { - _ = s.getS() - } - if !s.state.getOVF.pending && time.Since(s.state.lastOVFReceivedAt) >= statusPollInterval { - _ = s.getOVF() - } - if !s.state.getSWR.pending && time.Since(s.state.lastSWRReceivedAt) >= statusPollInterval && - (s.state.ptt || s.state.tune) { - _ = s.getSWR() + if s.state.ptt || s.state.tune { + if !s.state.getSWR.pending && time.Since(s.state.lastSWRReceivedAt) >= statusPollInterval { + _ = s.getSWR() + } + } else { + if !s.state.getS.pending && time.Since(s.state.lastSReceivedAt) >= statusPollInterval { + _ = s.getS() + } + if !s.state.getOVF.pending && time.Since(s.state.lastOVFReceivedAt) >= statusPollInterval { + _ = s.getOVF() + } } case <-s.resetSReadTimer: case <-s.newPendingCmdAdded: