feat: added mute and AGC-T to Flex control

This commit is contained in:
2026-06-27 21:03:13 +02:00
parent 19c5045dc6
commit 464a1c702c
7 changed files with 41 additions and 10 deletions
+2
View File
@@ -251,6 +251,7 @@ type FlexTXState struct {
AGCMode string `json:"agc_mode,omitempty"`
AGCThreshold int `json:"agc_threshold"`
AudioLevel int `json:"audio_level"`
Mute bool `json:"mute"`
NB bool `json:"nb"`
NBLevel int `json:"nb_level"`
NR bool `json:"nr"`
@@ -312,6 +313,7 @@ type FlexController interface {
SetAGCMode(string) error
SetAGCThreshold(int) error
SetAudioLevel(int) error
SetMute(bool) error
SetNB(bool) error
SetNBLevel(int) error
SetNR(bool) error
+7
View File
@@ -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)) }