feat: added mute and AGC-T to Flex control
This commit is contained in:
@@ -73,6 +73,7 @@ type flexSlice struct {
|
||||
agcMode string // off | slow | med | fast
|
||||
agcThreshold int // 0-100
|
||||
audioLevel int // 0-100 (RX volume)
|
||||
mute bool // RX audio muted
|
||||
nb bool // noise blanker
|
||||
nbLevel int
|
||||
nr bool // noise reduction
|
||||
@@ -670,6 +671,8 @@ func (f *Flex) handleStatus(payload string) {
|
||||
s.agcThreshold = atoiDefault(val, s.agcThreshold)
|
||||
case "audio_level":
|
||||
s.audioLevel = atoiDefault(val, s.audioLevel)
|
||||
case "audio_mute", "mute":
|
||||
s.mute = val == "1"
|
||||
case "nb":
|
||||
s.nb = val == "1"
|
||||
case "nb_level":
|
||||
@@ -1029,6 +1032,7 @@ func (f *Flex) FlexState() FlexTXState {
|
||||
st.AGCMode = rx.agcMode
|
||||
st.AGCThreshold = rx.agcThreshold
|
||||
st.AudioLevel = rx.audioLevel
|
||||
st.Mute = rx.mute
|
||||
st.NB = rx.nb
|
||||
st.NBLevel = rx.nbLevel
|
||||
st.NR = rx.nr
|
||||
@@ -1076,6 +1080,8 @@ func (f *Flex) sendSlice(param string, val any) error {
|
||||
rx.agcThreshold = toInt(val)
|
||||
case "audio_level":
|
||||
rx.audioLevel = toInt(val)
|
||||
case "audio_mute", "mute":
|
||||
rx.mute = fmt.Sprint(val) == "1"
|
||||
case "nb":
|
||||
rx.nb = val == "1"
|
||||
case "nb_level":
|
||||
@@ -1126,6 +1132,7 @@ func (f *Flex) SetAGCMode(m string) error {
|
||||
}
|
||||
func (f *Flex) SetAGCThreshold(l int) error { return f.sendSlice("agc_threshold", clampLevel(l)) }
|
||||
func (f *Flex) SetAudioLevel(l int) error { return f.sendSlice("audio_level", clampLevel(l)) }
|
||||
func (f *Flex) SetMute(on bool) error { return f.sendSlice("audio_mute", boolFlex(on)) }
|
||||
func (f *Flex) SetNB(on bool) error { return f.sendSlice("nb", boolFlex(on)) }
|
||||
func (f *Flex) SetNBLevel(l int) error { return f.sendSlice("nb_level", clampLevel(l)) }
|
||||
func (f *Flex) SetNR(on bool) error { return f.sendSlice("nr", boolFlex(on)) }
|
||||
|
||||
Reference in New Issue
Block a user