Read split from the radio, and read two of them
Split. RadioState carries a transmit frequency, zero meaning the radio transmits where it listens, so split is not a second flag that can disagree with it. The contact stores it in N1MM's QSX column, the entry window shows 14008.00 followed by the transmit frequency, and the bandmap draws a red bar there. SetSplitAsync sets the frequency before turning split on, or a radio last split somewhere else transmits there. Every command now goes out with a + in front, asking rigctld for its extended answer: named fields ended by an RPRT line. The raw answer is bare values with no terminator, so the client had to know how many lines each command returns — there was a `command == "m"` special case for the one that returns two. Add a third such command and get the count wrong once, and every later answer is read against the wrong command for the rest of the session. RigctldReply parses the extended form and is tested on its own. A radio that cannot do split answers RPRT -11. That is an answer, not a broken connection, so the frequency and mode it did report still count. Two radios. Settings hold a list rather than one host and port, with the single radio an older settings file holds carried into it. Both radios are read and both show on the bandmap, the active one green and the other orange, but only the active one drives the entry window: the second radio moving must not drag the operator off the station being worked. Ctrl+Tab swaps, and a contact records which radio made it. This is not a full two-radio operating position — no second entry window, no alternating CQ, no audio switching. It is two radios read and logged correctly. Tested against a stand-in for rigctld over a real socket, and looked at under Xvfb with two fake radios, one of them split. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using Nonemm.Contests;
|
||||
using Nonemm.Core;
|
||||
using Nonemm.Rig;
|
||||
using Nonemm.Spotting;
|
||||
|
||||
namespace Nonemm.App.Windows;
|
||||
@@ -63,16 +64,35 @@ public sealed partial class BandmapWindow : RefreshableWindow
|
||||
View.InvalidateVisual();
|
||||
}
|
||||
|
||||
/// Only the receiver is known. The radio does not report the transmit VFO
|
||||
/// or a second radio yet, so those bars are not drawn; `VfoRole` has the
|
||||
/// roles ready for when it does.
|
||||
private IReadOnlyList<VfoMarker> Vfos() =>
|
||||
session.Logging is null
|
||||
? []
|
||||
: [VfoMarker.Centred(
|
||||
session.Logging.Frequency,
|
||||
Modes.Bandwidth(session.Logging.Mode),
|
||||
VfoRole.Receive)];
|
||||
/// Green for where the operator is listening, red for where the radio
|
||||
/// transmits when working split, orange for the other radio of a two-radio
|
||||
/// station.
|
||||
private IReadOnlyList<VfoMarker> Vfos()
|
||||
{
|
||||
if (session.Logging is null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
Frequency width = Modes.Bandwidth(session.Logging.Mode);
|
||||
List<VfoMarker> markers =
|
||||
[
|
||||
VfoMarker.Centred(session.Logging.Frequency, width, VfoRole.Receive),
|
||||
];
|
||||
if (session.Logging.TransmitFrequency.Hertz > 0)
|
||||
{
|
||||
markers.Add(VfoMarker.Centred(
|
||||
session.Logging.TransmitFrequency, width, VfoRole.Transmit));
|
||||
}
|
||||
foreach (Radio other in session.Radios.Where(r => r.Number != session.ActiveRadioNumber))
|
||||
{
|
||||
if (other.State is { } state)
|
||||
{
|
||||
markers.Add(VfoMarker.Centred(
|
||||
state.Frequency, Modes.Bandwidth(state.Mode), VfoRole.Second));
|
||||
}
|
||||
}
|
||||
return markers;
|
||||
}
|
||||
|
||||
/// The slice to show, centred on the receiver and kept inside the band.
|
||||
private (Frequency Low, Frequency High) Window(Band band, Frequency centre)
|
||||
|
||||
@@ -257,16 +257,13 @@ public sealed partial class EntryWindow
|
||||
return;
|
||||
}
|
||||
session.Save(updated);
|
||||
if (updated.RadioEnabled)
|
||||
session.ConnectRadios();
|
||||
Status(session.Radios.Count switch
|
||||
{
|
||||
session.ConnectRadio();
|
||||
Status($"radio: rigctld at {updated.RigctldHost}:{updated.RigctldPort}");
|
||||
}
|
||||
else
|
||||
{
|
||||
session.DisconnectRadio();
|
||||
Status("radio disconnected");
|
||||
}
|
||||
0 => "no radio",
|
||||
1 => $"radio: rigctld at {updated.Radios[0].Host}:{updated.Radios[0].Port}",
|
||||
_ => $"{session.Radios.Count} radios · Ctrl+Tab moves between them",
|
||||
});
|
||||
}
|
||||
|
||||
private async void OnClusterSettings(object? sender, RoutedEventArgs e)
|
||||
|
||||
@@ -78,9 +78,9 @@ public sealed partial class EntryWindow : Window
|
||||
|
||||
private IEnumerable<(string What, Action Start)> Connections()
|
||||
{
|
||||
if (session.Settings.RadioEnabled)
|
||||
if (session.Settings.Radios.Any(r => r.IsEnabled))
|
||||
{
|
||||
yield return ("radio", session.ConnectRadio);
|
||||
yield return ("radios", session.ConnectRadios);
|
||||
}
|
||||
if (session.Settings.ClusterEnabled)
|
||||
{
|
||||
@@ -175,6 +175,11 @@ public sealed partial class EntryWindow : Window
|
||||
SyncBoxes();
|
||||
boxes[0].Focus();
|
||||
break;
|
||||
case Key.Tab when e.KeyModifiers.HasFlag(KeyModifiers.Control):
|
||||
e.Handled = true;
|
||||
session.SwapRadio();
|
||||
Status($"radio {session.ActiveRadioNumber}");
|
||||
break;
|
||||
case Key.Tab when FocusedIsEntryBox():
|
||||
e.Handled = true;
|
||||
MoveFocus(forward: !e.KeyModifiers.HasFlag(KeyModifiers.Shift));
|
||||
@@ -284,7 +289,9 @@ public sealed partial class EntryWindow : Window
|
||||
VerdictText.Text = "";
|
||||
return;
|
||||
}
|
||||
FrequencyText.Text = Logging.Frequency.Kilohertz.ToString("0.00");
|
||||
FrequencyText.Text = Logging.TransmitFrequency.Hertz > 0
|
||||
? $"{Logging.Frequency.Kilohertz:0.00} ▸ {Logging.TransmitFrequency.Kilohertz:0.0}"
|
||||
: Logging.Frequency.Kilohertz.ToString("0.00");
|
||||
ModeText.Text = Logging.Mode.Name;
|
||||
RunText.Text = Logging.IsRunning ? "RUN" : "S&P";
|
||||
RunBorder.Background = Logging.IsRunning ? Verdicts.Worth : new SolidColorBrush(Color.FromArgb(0x22, 0x80, 0x80, 0x80));
|
||||
@@ -310,8 +317,9 @@ public sealed partial class EntryWindow : Window
|
||||
" ",
|
||||
Logging.Contest.MultiplierNames.Select(
|
||||
(name, at) => $"{name} {Logging.Log.Tally.MultiplierCount(at + 1)}"));
|
||||
string radio = session.Radios.Count > 1 ? $" · radio {session.ActiveRadioNumber}" : "";
|
||||
return $"{Logging.Contest.DisplayName} · {Logging.Log.Tally.Qsos} Q · " +
|
||||
$"{Logging.Log.Tally.Points} pts · {mults} · {Logging.Log.TotalScore:N0}";
|
||||
$"{Logging.Log.Tally.Points} pts · {mults} · {Logging.Log.TotalScore:N0}{radio}";
|
||||
}
|
||||
|
||||
private string VerdictLine(Verdict? verdict)
|
||||
|
||||
Reference in New Issue
Block a user