feat: Flex CWX type-ahead backspace (cwx erase) — phase 2

Completes the CWX type-ahead loop: with send-on-type the keyer-panel CW text
already streams each typed char to the radio's CWX buffer (which keys in order,
so you can keep typing while it sends); this adds the matching un-send. Route
wkBackspace to FlexBackspaceCW -> cwx erase N, so backspacing a mistyped char in
send-on-type removes it from the buffer before the radio keys it.
This commit is contained in:
2026-07-20 16:12:24 +02:00
parent b8db653981
commit 3cef885934
6 changed files with 35 additions and 3 deletions
+9
View File
@@ -10389,6 +10389,15 @@ func (a *App) FlexSetKeySpeed(wpm int) error {
return a.cat.FlexDo(func(fc cat.FlexController) error { return fc.SetCWSpeed(wpm) }) return a.cat.FlexDo(func(fc cat.FlexController) error { return fc.SetCWSpeed(wpm) })
} }
// FlexBackspaceCW removes the last n not-yet-keyed characters from the CWX buffer
// (type-ahead correction). n<1 deletes one.
func (a *App) FlexBackspaceCW(n int) error {
if a.cat == nil {
return fmt.Errorf("cat not initialized")
}
return a.cat.FlexDo(func(fc cat.FlexController) error { return fc.BackspaceCW(n) })
}
// IcomStopCW aborts the CW message currently being sent. // IcomStopCW aborts the CW message currently being sent.
func (a *App) IcomStopCW() error { func (a *App) IcomStopCW() error {
if a.cat == nil { if a.cat == nil {
+5 -2
View File
@@ -36,7 +36,7 @@ import {
GetWinkeyerSettings, SaveWinkeyerSettings, ListSerialPorts, GetWinkeyerStatus, GetWinkeyerSettings, SaveWinkeyerSettings, ListSerialPorts, GetWinkeyerStatus,
WinkeyerConnect, WinkeyerDisconnect, WinkeyerSend, WinkeyerStop, WinkeyerSetSpeed, WinkeyerBackspace, WinkeyerConnect, WinkeyerDisconnect, WinkeyerSend, WinkeyerStop, WinkeyerSetSpeed, WinkeyerBackspace,
IcomSendCW, IcomStopCW, IcomSetKeySpeed, IcomSetBreakIn, GetIcomState, IcomSendCW, IcomStopCW, IcomSetKeySpeed, IcomSetBreakIn, GetIcomState,
FlexSendCW, FlexStopCW, FlexSetKeySpeed, FlexSendCW, FlexStopCW, FlexSetKeySpeed, FlexBackspaceCW,
GetDVKMessages, GetDVKStatus, DVKPlay, DVKStop, GetDVKMessages, GetDVKStatus, DVKPlay, DVKStop,
StartCWDecoder, StopCWDecoder, SetCWDecoderPitch, StartCWDecoder, StopCWDecoder, SetCWDecoderPitch,
ChatAvailable, GetChatHistory, SendChatMessage, GetOnlineOperators, ChatAvailable, GetChatHistory, SendChatMessage, GetOnlineOperators,
@@ -2221,7 +2221,10 @@ export default function App() {
if (cwSourceRef.current === 'flex') { FlexSendCW(chars).catch(() => {}); return; } if (cwSourceRef.current === 'flex') { FlexSendCW(chars).catch(() => {}); return; }
WinkeyerSend(chars).catch(() => {}); WinkeyerSend(chars).catch(() => {});
} }
function wkBackspace() { WinkeyerBackspace().catch(() => {}); } function wkBackspace() {
if (cwSourceRef.current === 'flex') { FlexBackspaceCW(1).catch(() => {}); return; }
WinkeyerBackspace().catch(() => {});
}
function wkToggleSendOnType(on: boolean) { setWkSendOnType(on); saveWk({ send_on_type: on }); } function wkToggleSendOnType(on: boolean) { setWkSendOnType(on); saveWk({ send_on_type: on }); }
// Resolve slot status for any spot we haven't seen yet — debounced so we // Resolve slot status for any spot we haven't seen yet — debounced so we
+2
View File
@@ -192,6 +192,8 @@ export function FlexAmpOperate(arg1:boolean):Promise<void>;
export function FlexApplyBandAntenna(arg1:string):Promise<void>; export function FlexApplyBandAntenna(arg1:string):Promise<void>;
export function FlexBackspaceCW(arg1:number):Promise<void>;
export function FlexMox(arg1:boolean):Promise<void>; export function FlexMox(arg1:boolean):Promise<void>;
export function FlexSendCW(arg1:string):Promise<void>; export function FlexSendCW(arg1:string):Promise<void>;
+4
View File
@@ -342,6 +342,10 @@ export function FlexApplyBandAntenna(arg1) {
return window['go']['main']['App']['FlexApplyBandAntenna'](arg1); return window['go']['main']['App']['FlexApplyBandAntenna'](arg1);
} }
export function FlexBackspaceCW(arg1) {
return window['go']['main']['App']['FlexBackspaceCW'](arg1);
}
export function FlexMox(arg1) { export function FlexMox(arg1) {
return window['go']['main']['App']['FlexMox'](arg1); return window['go']['main']['App']['FlexMox'](arg1);
} }
+4 -1
View File
@@ -396,9 +396,12 @@ type FlexController interface {
SetCWBreakInDelay(int) error SetCWBreakInDelay(int) error
// CWX keyer — buffered CW keying via SmartSDR's CWX subsystem, so a Flex needs // CWX keyer — buffered CW keying via SmartSDR's CWX subsystem, so a Flex needs
// no WinKeyer / SmartCAT. SendCW queues text (the radio buffers and keys it); // no WinKeyer / SmartCAT. SendCW queues text (the radio buffers and keys it);
// StopCW clears the buffer, aborting the send. // StopCW clears the buffer, aborting the send. BackspaceCW removes the last n
// not-yet-keyed characters from the buffer (un-send while sending — for
// type-ahead corrections).
SendCW(string) error SendCW(string) error
StopCW() error StopCW() error
BackspaceCW(int) error
SetCWSidetone(bool) error SetCWSidetone(bool) error
SetSidetoneLevel(int) error SetSidetoneLevel(int) error
SetCWFilter(int) error SetCWFilter(int) error
+11
View File
@@ -1601,6 +1601,17 @@ func (f *Flex) StopCW() error {
return nil return nil
} }
// BackspaceCW removes the last n not-yet-keyed characters from the CWX buffer —
// the "un-send while sending" a serial WinKeyer can't do. Used for type-ahead
// corrections (backspacing a mistyped call before the radio has keyed it).
func (f *Flex) BackspaceCW(n int) error {
if n < 1 {
n = 1
}
f.send(fmt.Sprintf("cwx erase %d", n))
return nil
}
func (f *Flex) SetCWSidetone(on bool) error { func (f *Flex) SetCWSidetone(on bool) error {
f.mu.Lock() f.mu.Lock()
f.tx.cwSidetone = on f.tx.cwSidetone = on