Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ test:
go test -v -timeout=30s ./...

build:
# go build -trimpath -buildmode=pie -mod=readonly -modcacherw -v -ldflags "-linkmode external -extldflags \"${LDFLAGS}\" -X main.version=${VERSION_NUMBER}" -o ${BINARY_NAME}
go build -trimpath -buildmode=pie -ldflags "-s -w -extldflags \"${LDFLAGS}\" -X main.version=${VERSION_NUMBER}" -o ${BINARY_NAME}

run: build
Expand Down
34 changes: 21 additions & 13 deletions core/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,26 @@ const (
ActionEntryClearVFO1 = "entry.clear_vfo1"
ActionEntryClearVFO2 = "entry.clear_vfo2"

ActionRadioXITActive = "radio.xit_active"
ActionRadioShiftFrequency = "radio.shift_frequency"
ActionRadioShiftXIT = "radio.shift_xit"
ActionRadioFrequencyUp = "radio.frequency_up"
ActionRadioFrequencyDown = "radio.frequency_down"
ActionRadioXITUp = "radio.xit_up"
ActionRadioXITDown = "radio.xit_down"
ActionRadioMuteAudioVFO1 = "radio.mute_audio_vfo1"
ActionRadioMuteAudioVFO2 = "radio.mute_audio_vfo2"
ActionRadioUnmuteAudioVFO1 = "radio.unmute_audio_vfo1"
ActionRadioUnmuteAudioVFO2 = "radio.unmute_audio_vfo2"
ActionRadioToggleAudioVFO1 = "radio.toggle_audio_vfo1"
ActionRadioToggleAudioVFO2 = "radio.toggle_audio_vfo2"
ActionRadioXITActive = "radio.xit_active"
ActionRadioRITActive = "radio.rit_active"
ActionRadioShiftFrequency = "radio.shift_frequency"
ActionRadioShiftXIT = "radio.shift_xit"
ActionRadioShiftRIT = "radio.shift_rit"
ActionRadioFrequencyUp = "radio.frequency_up"
ActionRadioFrequencyDown = "radio.frequency_down"
ActionRadioXITUp = "radio.xit_up"
ActionRadioXITDown = "radio.xit_down"
ActionRadioRITUp = "radio.rit_up"
ActionRadioRITDown = "radio.rit_down"
ActionIncrementalTuningToggle = "radio.incremental_tuning_toggle"
ActionIncrementalTuningUp = "radio.incremental_tuning_up"
ActionIncrementalTuningDown = "radio.incremental_tuning_down"
ActionRadioMuteAudioVFO1 = "radio.mute_audio_vfo1"
ActionRadioMuteAudioVFO2 = "radio.mute_audio_vfo2"
ActionRadioUnmuteAudioVFO1 = "radio.unmute_audio_vfo1"
ActionRadioUnmuteAudioVFO2 = "radio.unmute_audio_vfo2"
ActionRadioToggleAudioVFO1 = "radio.toggle_audio_vfo1"
ActionRadioToggleAudioVFO2 = "radio.toggle_audio_vfo2"

ActionBandmapMark = "bandmap.mark"
ActionBandmapGotoHighestValueSpot = "bandmap.goto_highest_value_spot"
Expand Down Expand Up @@ -83,5 +90,6 @@ const (
const (
DefaultFrequencyShift = Frequency(10) // Hz
DefaultXITShift = Frequency(10) // Hz
DefaultRITShift = Frequency(10) // Hz
DefaultSpeedShift = 1 // WPM
)
65 changes: 55 additions & 10 deletions core/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,11 @@ func (c *Controller) Startup() {
v.SetClient(c.Radio)
c.VFOs[vfoID] = v
c.Entry.SetVFO(core.VFOID(vfoID), v)
c.Radio.SetVFO(core.VFOID(vfoID), v)
c.Logbook.Notify(v)
c.Workmode.Notify(v)
}
c.Bandmap.SetVFO(c.VFOs[core.VFO1])
c.Workmode.Notify(c.VFOs[core.VFO1])

c.Radio.SetSendSpotsToTci(c.session.SendSpotsToTci())
c.Radio.SelectRadio(c.session.Radio1())
Expand Down Expand Up @@ -882,24 +883,52 @@ func (c *Controller) RequestQTC() {
c.QTCController.RequestQTC()
}

func (c *Controller) XITActive() bool {
return c.VFOs[core.VFO1].XITActive()
func (c *Controller) IncrementalTuningActive(vfo core.VFOID, kind core.IncrementalTuningKind) bool {
return c.Radio.IncrementalTuningActive(vfo, kind)
}

func (c *Controller) SetXITActive(active bool) {
c.VFOs[core.VFO1].SetXITActive(active)
func (c *Controller) FocusedIncrementalTuningActive(kind core.IncrementalTuningKind) bool {
return c.Radio.FocusedIncrementalTuningActive(kind)
}

func (c *Controller) ShiftXIT(delta core.Frequency) {
c.VFOs[core.VFO1].ShiftXITOffset(delta)
func (c *Controller) SetIncrementalTuningActive(vfo core.VFOID, kind core.IncrementalTuningKind, active bool) {
c.Radio.SetIncrementalTuningActive(vfo, kind, active)
}

func (c *Controller) SetFocusedIncrementalTuningActive(kind core.IncrementalTuningKind, active bool) {
c.Radio.SetFocusedIncrementalTuningActive(kind, active)
}

func (c *Controller) ShiftIncrementalTuning(kind core.IncrementalTuningKind, delta core.Frequency) {
c.Radio.ShiftIncrementalTuning(kind, delta)
}

func (c *Controller) XITUp() {
c.ShiftXIT(core.DefaultXITShift)
c.ShiftIncrementalTuning(core.XIT, core.DefaultXITShift)
}

func (c *Controller) XITDown() {
c.ShiftXIT(-core.DefaultXITShift)
c.ShiftIncrementalTuning(core.XIT, -core.DefaultXITShift)
}

func (c *Controller) RITUp() {
c.ShiftIncrementalTuning(core.RIT, core.DefaultRITShift)
}

func (c *Controller) RITDown() {
c.ShiftIncrementalTuning(core.RIT, -core.DefaultRITShift)
}

func (c *Controller) ToggleIncrementalTuning() {
c.Radio.ToggleIncrementalTuning()
}

func (c *Controller) IncrementalTuningUp() {
c.Radio.IncrementalTuningUp()
}

func (c *Controller) IncrementalTuningDown() {
c.Radio.IncrementalTuningDown()
}

func (c *Controller) MuteAudio(vfo core.VFOID) {
Expand Down Expand Up @@ -1043,11 +1072,27 @@ func (c *Controller) DoAction(id string, params map[string]string) error {
if err != nil {
return err
}
c.ShiftXIT(core.Frequency(amount))
c.ShiftIncrementalTuning(core.XIT, core.Frequency(amount))
case core.ActionRadioXITUp:
c.XITUp()
case core.ActionRadioXITDown:
c.XITDown()
case core.ActionRadioShiftRIT:
amount, err := shiftAmount(params, int(core.DefaultRITShift))
if err != nil {
return err
}
c.ShiftIncrementalTuning(core.RIT, core.Frequency(amount))
case core.ActionRadioRITUp:
c.RITUp()
case core.ActionRadioRITDown:
c.RITDown()
case core.ActionIncrementalTuningToggle:
c.ToggleIncrementalTuning()
case core.ActionIncrementalTuningUp:
c.IncrementalTuningUp()
case core.ActionIncrementalTuningDown:
c.IncrementalTuningDown()
case core.ActionKeyerShiftSpeed:
amount, err := shiftAmount(params, core.DefaultSpeedShift)
if err != nil {
Expand Down
25 changes: 14 additions & 11 deletions core/bandmap/bandmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,20 @@ func (v *nullView) RevealEntry(core.BandmapEntry) {}

type nullVFO struct{}

func (n *nullVFO) Name() string { return "" }
func (n *nullVFO) Notify(any) {}
func (n *nullVFO) Active() bool { return false }
func (n *nullVFO) Refresh() {}
func (n *nullVFO) SetFrequency(core.Frequency) {}
func (n *nullVFO) ShiftFrequency(core.Frequency) {}
func (n *nullVFO) SetBand(core.Band) {}
func (n *nullVFO) SetMode(core.Mode) {}
func (n *nullVFO) SetXIT(bool, core.Frequency) {}
func (n *nullVFO) XITActive() bool { return false }
func (n *nullVFO) SetXITActive(bool) {}
func (n *nullVFO) Name() string { return "" }
func (n *nullVFO) Notify(any) {}
func (n *nullVFO) Active() bool { return false }
func (n *nullVFO) Refresh() {}
func (n *nullVFO) SetFrequency(core.Frequency) {}
func (n *nullVFO) ShiftFrequency(core.Frequency) {}
func (n *nullVFO) SetBand(core.Band) {}
func (n *nullVFO) SetMode(core.Mode) {}
func (n *nullVFO) SetIncrementalTuning(core.IncrementalTuningKind, bool, core.Frequency) {}
func (n *nullVFO) ShiftOffset(core.IncrementalTuningKind, core.Frequency) {}
func (n *nullVFO) ToggleIncrementalTuning() {}
func (n *nullVFO) ShiftAvailableIncrementalTuning(core.Frequency) {}
func (n *nullVFO) IncrementalTuningActive(core.IncrementalTuningKind) bool { return false }
func (n *nullVFO) SetIncrementalTuningActive(core.IncrementalTuningKind, bool) {}

type nullCallinfo struct{}

Expand Down
2 changes: 1 addition & 1 deletion core/cfg/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var Default = &Data{
Address: "localhost:40001",
Keyer: "radio",
Options: map[string]string{
"single_vfo": "false",
"trx": "0",
},
},
},
Expand Down
60 changes: 53 additions & 7 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -1672,9 +1672,9 @@ type BandmapWeights struct {
Quality float64
}

type XITControl interface {
XITActive() bool
SetXITActive(bool)
type IncrementalTuningControl interface {
IncrementalTuningActive(kind IncrementalTuningKind) bool
SetIncrementalTuningActive(kind IncrementalTuningKind, active bool)
}

type VFOID int
Expand All @@ -1687,15 +1687,18 @@ const (
)

type VFO interface {
XITControl
IncrementalTuningControl
Name() string
Notify(any)
Refresh()
SetFrequency(Frequency)
ShiftFrequency(Frequency)
SetBand(Band)
SetMode(Mode)
SetXIT(bool, Frequency)
SetIncrementalTuning(IncrementalTuningKind, bool, Frequency)
ShiftOffset(IncrementalTuningKind, Frequency)
ToggleIncrementalTuning()
ShiftAvailableIncrementalTuning(Frequency)
}

type CurrentVFOListener interface {
Expand All @@ -1722,8 +1725,45 @@ type VFOModeListener interface {
VFOModeChanged(VFOID, Mode)
}

type VFOXITListener interface {
VFOXITChanged(VFOID, bool, Frequency)
type IncrementalTuningKind int

const (
RIT IncrementalTuningKind = iota
XIT
)

func (k IncrementalTuningKind) String() string {
switch k {
case RIT:
return "RIT"
case XIT:
return "XIT"
default:
return "unknown"
}
}

func (k IncrementalTuningKind) Workmode() Workmode {
if k == RIT {
return Run
}
return SearchPounce
}

type VFOIncrementalTuningListener interface {
VFOIncrementalTuningChanged(vfo VFOID, kind IncrementalTuningKind, active bool, offset Frequency)
}

type IncrementalTuningAvailabilityListener interface {
IncrementalTuningAvailabilityChanged(vfo VFOID, kind IncrementalTuningKind, available bool)
}

type IncrementalTuningActiveListener interface {
IncrementalTuningActiveChanged(vfo VFOID, kind IncrementalTuningKind, active bool)
}

type IncrementalTuningVisibilityListener interface {
IncrementalTuningVisibilityChanged(vfo VFOID, kind IncrementalTuningKind, visible bool)
}

type VFOPTTListener interface {
Expand All @@ -1744,6 +1784,12 @@ func (f ConnectionChangedFunc) ConnectionChanged(connected bool) {
f(connected)
}

type CurrentVFOChangedFunc func(VFOID)

func (f CurrentVFOChangedFunc) CurrentVFOChanged(vfo VFOID) {
f(vfo)
}

type Service int

const (
Expand Down
20 changes: 0 additions & 20 deletions core/entry/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ type View interface {
SetFrequency(core.VFOID, core.Frequency)
SetBand(vfo core.VFOID, text string)
SetMode(vfo core.VFOID, text string)
SetXITActive(vfo core.VFOID, active bool)
SetXIT(vfo core.VFOID, active bool, offset core.Frequency)
SetTXState(vfo core.VFOID, ptt bool, parrotActive bool, parrotTimeLeft time.Duration)

SetCallsign(core.VFOID, string)
Expand Down Expand Up @@ -737,11 +735,6 @@ func (c *Controller) bandEntered(band core.Band) {
c.vfos[c.focusedVFO].SetBand(band)
}

func (c *Controller) SetXITActive(active bool) {
c.vfos[core.VFO1].SetXITActive(active)
c.view.SetActiveField(c.focusedVFO, c.activeField[c.focusedVFO])
}

func (c *Controller) VFOFrequencyChanged(vfo core.VFOID, frequency core.Frequency) {
c.asyncRunner(func() {
if vfo == core.VFO1 && c.editing {
Expand Down Expand Up @@ -871,19 +864,6 @@ func (c *Controller) VFOModeChanged(vfo core.VFOID, mode core.Mode) {
})
}

func (c *Controller) VFOXITChanged(vfo core.VFOID, active bool, offset core.Frequency) {
c.asyncRunner(func() {
c.view.SetXIT(vfo, active, offset)
})
}

func (c *Controller) XITActiveChanged(active bool) {
// TODO: add VFO parameter to XITActiveChanged
c.asyncRunner(func() {
c.view.SetXITActive(core.VFO1, active)
})
}

func (c *Controller) VFOPTTChanged(vfo core.VFOID, active bool) {
c.asyncRunner(func() {
if vfo != core.VFO1 {
Expand Down
18 changes: 10 additions & 8 deletions core/entry/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func TestEntryController_ClearView(t *testing.T) {
view.AssertExpectations(t)
}


func TestEntryController_EnterNewCallsign(t *testing.T) {
_, log, _, view, controller, _ := setupEntryTestWithClassicExchangeFields()
log.Activate()
Expand Down Expand Up @@ -598,10 +597,13 @@ func (v *testVFO) Refresh() {
v.controller.VFOBandChanged(core.VFO1, core.Band160m)
v.controller.VFOModeChanged(core.VFO1, core.ModeCW)
}
func (v *testVFO) SetFrequency(core.Frequency) {}
func (v *testVFO) ShiftFrequency(core.Frequency) {}
func (v *testVFO) SetBand(core.Band) {}
func (v *testVFO) SetMode(core.Mode) {}
func (v *testVFO) SetXIT(bool, core.Frequency) {}
func (v *testVFO) XITActive() bool { return false }
func (v *testVFO) SetXITActive(bool) {}
func (v *testVFO) SetFrequency(core.Frequency) {}
func (v *testVFO) ShiftFrequency(core.Frequency) {}
func (v *testVFO) SetBand(core.Band) {}
func (v *testVFO) SetMode(core.Mode) {}
func (v *testVFO) SetIncrementalTuning(core.IncrementalTuningKind, bool, core.Frequency) {}
func (v *testVFO) ShiftOffset(core.IncrementalTuningKind, core.Frequency) {}
func (v *testVFO) ToggleIncrementalTuning() {}
func (v *testVFO) ShiftAvailableIncrementalTuning(core.Frequency) {}
func (v *testVFO) IncrementalTuningActive(core.IncrementalTuningKind) bool { return false }
func (v *testVFO) SetIncrementalTuningActive(core.IncrementalTuningKind, bool) {}
Loading
Loading