mirror of
https://github.com/nonoo/kappanhang.git
synced 2025-12-06 08:02:00 +01:00
Read Vd right after TX
This commit is contained in:
parent
77296462a6
commit
7b384decc9
|
|
@ -6,7 +6,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const civAddress = 0xa4
|
const civAddress = 0xa4
|
||||||
const vdReadInterval = time.Minute
|
|
||||||
|
|
||||||
type civOperatingMode struct {
|
type civOperatingMode struct {
|
||||||
name string
|
name string
|
||||||
|
|
@ -62,8 +61,7 @@ var civBands = []civBand{
|
||||||
}
|
}
|
||||||
|
|
||||||
type civControlStruct struct {
|
type civControlStruct struct {
|
||||||
st *serialStream
|
st *serialStream
|
||||||
vdReadTimer *time.Timer
|
|
||||||
|
|
||||||
state struct {
|
state struct {
|
||||||
freq uint
|
freq uint
|
||||||
|
|
@ -211,7 +209,10 @@ func (s *civControlStruct) decodeTransmitStatus(d []byte) {
|
||||||
if d[1] == 1 {
|
if d[1] == 1 {
|
||||||
s.state.ptt = true
|
s.state.ptt = true
|
||||||
} else {
|
} else {
|
||||||
s.state.ptt = false
|
if s.state.ptt { // PTT released?
|
||||||
|
s.state.ptt = false
|
||||||
|
_ = s.getVd()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
if d[1] == 2 {
|
if d[1] == 2 {
|
||||||
|
|
@ -222,7 +223,10 @@ func (s *civControlStruct) decodeTransmitStatus(d []byte) {
|
||||||
_ = s.getTransmitStatus()
|
_ = s.getTransmitStatus()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
s.state.tune = false
|
if s.state.tune { // Tune finished?
|
||||||
|
s.state.tune = false
|
||||||
|
_ = s.getVd()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statusLog.reportPTT(s.state.ptt, s.state.tune)
|
statusLog.reportPTT(s.state.ptt, s.state.tune)
|
||||||
|
|
@ -239,9 +243,6 @@ func (s *civControlStruct) decodeVd(d []byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
statusLog.reportVd(((float64(int(d[1])<<8) + float64(d[2])) / 0x0241) * 16)
|
statusLog.reportVd(((float64(int(d[1])<<8) + float64(d[2])) / 0x0241) * 16)
|
||||||
s.vdReadTimer = time.AfterFunc(vdReadInterval, func() {
|
|
||||||
_ = s.getVd()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,10 +481,3 @@ func (s *civControlStruct) init(st *serialStream) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *civControlStruct) deinit() {
|
|
||||||
if s.vdReadTimer != nil {
|
|
||||||
s.vdReadTimer.Stop()
|
|
||||||
s.vdReadTimer = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -270,9 +270,6 @@ func (s *serialStream) deinit() {
|
||||||
s.deinitNeededChan <- true
|
s.deinitNeededChan <- true
|
||||||
<-s.deinitFinishedChan
|
<-s.deinitFinishedChan
|
||||||
}
|
}
|
||||||
if civControl != nil {
|
|
||||||
civControl.deinit()
|
|
||||||
}
|
|
||||||
civControl = nil
|
civControl = nil
|
||||||
s.common.deinit()
|
s.common.deinit()
|
||||||
s.rxSeqBuf.deinit()
|
s.rxSeqBuf.deinit()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue