diff --git a/core/entry/entry.go b/core/entry/entry.go index e653b98..1559d72 100644 --- a/core/entry/entry.go +++ b/core/entry/entry.go @@ -3,6 +3,7 @@ package entry import ( "fmt" "log" + "math" "strconv" "strings" @@ -13,6 +14,10 @@ import ( "github.com/ftl/hellocontest/core/ticker" ) +const ( + jumpThreshold core.Frequency = 250 // Hz +) + // View represents the visual part of the QSO data entry. type View interface { SetUTC(string) @@ -430,8 +435,17 @@ func (c *Controller) VFOFrequencyChanged(frequency core.Frequency) { if c.selectedFrequency == frequency { return } + jump := math.Abs(float64(c.selectedFrequency-frequency)) > float64(jumpThreshold) c.selectedFrequency = frequency c.view.SetFrequency(c.selectedFrequency) + + if jump { + c.asyncRunner(func() { + c.Clear() + c.activeField = core.CallsignField + c.view.SetActiveField(c.activeField) + }) + } } func (c *Controller) bandSelected(s string) {