// Package kpa talks to the Elecraft KPA500 and KPA1500 amplifiers. // // One package for both: they share the Elecraft command set — ASCII, a caret // prefix, a semicolon terminator, case-insensitive on the way in and upper case // on the way back — which is the same family as the K3/K4 panel in // internal/cat. What differs between the two models is the transport and which // commands exist, not the grammar. // // # Transports // // KPA500: serial only. // // KPA1500: serial, and a network server. Four things may be connected AT ONCE, // which is unusual enough to design around — the Host PC USB port, the XCVR // SERIAL connector when repurposed as a second host, ONE TCP client, and any // number of UDP clients: // // - TCP on port 1500 (changed with ^CP). Single client. If the operator // already has the Elecraft utility or another program on TCP, OpsLog will // not get in, and the failure is a refused connection rather than anything // the amplifier says. // - UDP on the same port. Many clients, one command per packet and at most // one response, and packets may be dropped under congestion — so it is the // right choice for sharing the amplifier and the wrong one for a command // that must not be missed. // // # Pacing // // There is NO flow control. The reference is explicit: pace commands by waiting // for the response to the previous one. So this client is strictly // question-and-answer on one connection, like the ACOM and SPE clients, rather // than firing a poll cycle and sorting out the replies afterwards. // // # Serial speed // // 4800 to 230400, 8N1, set on the amplifier (^BR / SERIAL SPEED HOST) and not // negotiated. Elecraft's own utility finds it by sending bare semicolons at // each speed until something answers — worth copying if operators turn up with // amplifiers whose speed they do not know. // // # What is settled, and how // // From the KPA1500 Programming Reference: // // - ^SW is the SWR IN TENTHS. "123 is 12.3:1", so ^SW015 is 1.5:1. This was // first taken from Hamlib's backend and is now confirmed by the document, // which matters more than it sounds: a wrongly scaled SWR bar reports a // good match on a bad antenna. // - ^WS returns forward power AND SWR together, ^VI returns PA voltage AND // current together. Two round trips instead of four on the link the display // depends on while the operator is transmitting. // - ^SF returns the fault log: index, fault code, a short name in quotes, a // timestamp, and fault-specific values. ^FC describes the codes. // // # Not touched // // ^TX simulates a KEY IN — it makes the amplifier transmit from software — and // ^ON0 switches the main supplies off. Neither belongs on a poll loop or behind // a button that can be pressed by accident. package kpa