diff --git a/src/Nonemm.App/AppSession.QsySpot.cs b/src/Nonemm.App/AppSession.QsySpot.cs index 9ce940d..7884e99 100644 --- a/src/Nonemm.App/AppSession.QsySpot.cs +++ b/src/Nonemm.App/AppSession.QsySpot.cs @@ -28,6 +28,16 @@ public sealed partial class AppSession Dispatcher.UIThread.Post(() => SpotOnQsy(position, before)); } + /// A tune made in the program itself (frequency step, band button, bandmap + /// click). It spots the call at once, before the caller changes the boxes. + /// The radio then reports the same frequency back, which moves nothing. + public void TuneHere(OperatingPosition position, Frequency frequency, Mode? mode = null) + { + Frequency before = position.Frequency; + position.Tune(frequency, mode); + SpotOnQsy(position, before); + } + /// Where the radio was when the call in each entry window was first seen. /// A radio reports every few hundred hertz as the knob turns, so the move /// is measured from here and not from the previous report. @@ -59,7 +69,6 @@ public sealed partial class AppSession || call.All(char.IsAsciiDigit) || position.IsRunning || position.Editing is not null - || position.IsEntryComplete || band is null || band != Bands.ForFrequency(now) || Math.Abs(now.Hertz - before.Hertz) <= Settings.QsySpotHertz diff --git a/src/Nonemm.App/Windows/EntryWindow.Bands.cs b/src/Nonemm.App/Windows/EntryWindow.Bands.cs index a30cc52..035687a 100644 --- a/src/Nonemm.App/Windows/EntryWindow.Bands.cs +++ b/src/Nonemm.App/Windows/EntryWindow.Bands.cs @@ -130,7 +130,7 @@ public sealed partial class EntryWindow ModeCategory.Digital => Modes.Rtty, _ => Modes.Cw, }; - Logging.Tune(where, wanted); + session.TuneHere(Logging, where, wanted); _ = session.Radio?.TuneAsync(where); boxes[0].Focus(); Refresh(); diff --git a/src/Nonemm.App/Windows/EntryWindow.Macros.cs b/src/Nonemm.App/Windows/EntryWindow.Macros.cs index 292666c..dfaf8eb 100644 --- a/src/Nonemm.App/Windows/EntryWindow.Macros.cs +++ b/src/Nonemm.App/Windows/EntryWindow.Macros.cs @@ -476,7 +476,7 @@ public sealed partial class EntryWindow return; } Frequency moved = Frequency.FromHertz(Logging.Frequency.Hertz + hertz); - Logging.Tune(moved); + session.TuneHere(Logging, moved); _ = session.Radio?.TuneAsync(moved); Refresh(); } diff --git a/src/Nonemm.App/Windows/EntryWindow.Menu.cs b/src/Nonemm.App/Windows/EntryWindow.Menu.cs index 21e7d93..1ba8cc6 100644 --- a/src/Nonemm.App/Windows/EntryWindow.Menu.cs +++ b/src/Nonemm.App/Windows/EntryWindow.Menu.cs @@ -714,7 +714,7 @@ public sealed partial class EntryWindow { return; } - Logging.Tune(frequency); + session.TuneHere(Logging, frequency); _ = session.Radio?.TuneAsync(frequency); Logging.Entry.Call = call; SyncBoxes();