Skip to content

Commit

Permalink
rigcontrol: Fix PTT STATE 3 experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhpedersen committed Jan 22, 2025
1 parent c435dba commit c52b1a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 4 additions & 8 deletions rigcontrol/hamlib/experimental_ptt.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ import (
)

// Experimental PTT STATE 3 (https://github.com/la5nta/pat/issues/184)

func init() {
if experimentalPTT3Enabled() {
var experimentalPTT3Enabled = func() bool {
ok, _ := strconv.ParseBool(os.Getenv("EXPERIMENTAL_HAMLIB_PTT3"))
if ok {
log.Println("Experimental PTT3 enabled (https://github.com/la5nta/pat/issues/184)")
}
}

func experimentalPTT3Enabled() bool {
ok, _ := strconv.ParseBool(os.Getenv("EXPERIMENTAL_HAMLIB_PTT3"))
return ok
}
}()
10 changes: 4 additions & 6 deletions rigcontrol/hamlib/rigctld.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,11 @@ func (v *tcpVFO) GetPTT() (bool, error) {
// Enable (or disable) PTT on this VFO.
func (v *tcpVFO) SetPTT(on bool) error {
bInt := 0
if on == true {
if on {
bInt = 1
}

// Experimental PTT STATE 3 (https://github.com/la5nta/pat/issues/184)
if experimentalPTT3Enabled() {
bInt = 3
if experimentalPTT3Enabled {
bInt = 3
}
}

_, err := v.cmd(`\set_ptt %d`, bInt)
Expand Down

0 comments on commit c52b1a2

Please sign in to comment.