Let Enter send the message the contact has got to

ESM is how most people run N1MM, and it was not here at all — not in the code,
not even in the list of what is missing. Config ▸ ESM turns it on and it stays
on between runs.

The decision is a table in N1MM's function-key documentation, and it is written
here as one: the state of the callsign and exchange boxes, whether the station
is running or searching, and whether the call and the exchange have gone out
already, give the function keys Enter sends and whether the contact is logged
after them. Esm.Decide is that table and nothing else, so it is tested against
every row rather than by clicking.

Searching: type a call, Enter sends your call, space moves to the exchange, and
once the exchange is filled in Enter sends yours and logs. Running: Enter calls
CQ, a call in the box makes Enter send his call and the exchange, and the next
Enter ends the contact and logs it. A dupe gets QSO B4 while running and nothing
while searching, unless dupes are worked, which is what N1MM recommends and what
this does out of the box. F1 puts a searching station into run mode.

The entry window highlights the keys Enter would send next, so what is about to
happen is on the screen rather than in the operator's head. `=` sends whatever
Enter last sent. Escape and F12 put ESM back to the start of a contact.

Send Corrected Call is in as well: copy SM3AB, send it, fix it to SM3ABC, and
the message that ends the contact goes out as "SM3ABC TU DL1ABC". That is why
N1MM's documentation says to put ! in F5 rather than {CALL}, so the default F5
message is now ! . F6 is QSO B4, which is the message ESM sends a dupe; it used
to repeat the exchange, which no part of the table asks for.

{EXCHSENT} means something again, now that there is an ESM state for it to set.

Worked end to end against a fake cwdaemon: a search-and-pounce contact logged in
four keystrokes, a run contact in three, both with the right text on the keyer
in the right order, and the corrected call in front of the last message.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-28 07:59:11 +00:00
parent 333d3b97c2
commit 0c440ed865
13 changed files with 458 additions and 13 deletions

View File

@@ -15,7 +15,13 @@ public sealed partial class EntryWindow
/// actions after `{END}` still run.
private static readonly TimeSpan SendingPatience = TimeSpan.FromMinutes(2);
private void SendMessage(int index)
private void SendMessage(int index) => _ = SendKeyAsync(index);
/// Sends one function key's message. The task finishes when the text has
/// been handed to the keyer, not when it has gone out on the air, so a
/// second key can be queued behind it. `prefix` carries the corrected call
/// that ESM puts in front of the message that ends a contact.
private async Task SendKeyAsync(int index, string prefix = "")
{
if (Logging is null)
{
@@ -45,12 +51,15 @@ public sealed partial class EntryWindow
Status("no keyer — Config ▸ Keyer");
return;
}
string text = prefix + plan.Text;
// the box has to point at this radio before the key does
_ = session.PointTransmitAtAsync(radioNumber);
Status($"sending {plan.Text}");
_ = SendThenAsync(session.Keyer, plan.Text, plan.After);
await session.PointTransmitAtAsync(radioNumber);
Status($"sending {text}");
await SendThenAsync(session.Keyer, text, plan.After);
}
/// Hands the text to the keyer, and leaves what follows `{END}` to run on
/// its own once the keyer says the message has gone out.
private async Task SendThenAsync(MessageSender keyer, string text, IReadOnlyList<MessageAction> after)
{
try
@@ -62,10 +71,14 @@ public sealed partial class EntryWindow
Status(e.Message);
return;
}
if (after.Count == 0)
if (after.Count > 0)
{
return;
_ = RunWhenSentAsync(keyer, after);
}
}
private async Task RunWhenSentAsync(MessageSender keyer, IReadOnlyList<MessageAction> after)
{
await WhenSentAsync(keyer);
Dispatcher.UIThread.Post(() =>
{
@@ -130,6 +143,9 @@ public sealed partial class EntryWindow
case MessageCommand.SpotMe:
SpotMe();
break;
case MessageCommand.ExchangeSent:
exchangeSent = true;
break;
// the manual's table has the two page macros the other way round;
// the keys they are named after move the frequency this way
case MessageCommand.FrequencyUp: