Single dot keyer

This commit is contained in:
Neale Pickett 2022-05-08 21:52:12 -06:00
parent 5f78339faa
commit b9188bcdbf
2 changed files with 41 additions and 12 deletions

View File

@ -370,11 +370,41 @@ class ElBugKeyer extends BugKeyer {
} }
} }
/**
* Ultimatic Keyer.
*
* If you know what an Iambic keyer does, this works similarly, but doesn't go
* back and forth when both keys are held.
*/
class UltimaticKeyer extends ElBugKeyer {
Reset() {
super.Reset()
this.queue = new QSet()
}
Key(key, pressed) {
if (pressed) {
this.queue.add(key)
}
super.Key(key, pressed)
}
nextTxDuration() {
let key = this.queue.shift()
if (key != null) {
return this.keyDuration(key)
}
return super.nextTxDuration()
}
}
/** /**
* Single dot memory keyer. * Single dot memory keyer.
* *
* If you tap dit while a dah is sending, it queues up a dit to send, even if * If you tap dit while a dah is sending, it queues up a dit to send, but
* the dit key is no longer being held at the start of the next cycle. * reverts back to dah until the dah key is released or the dit key is pressed
* again. In other words, if the dah is held, it only pay attention to the edge
* on dit.
*/ */
class SingleDotKeyer extends ElBugKeyer { class SingleDotKeyer extends ElBugKeyer {
Reset() { Reset() {
@ -394,18 +424,17 @@ class SingleDotKeyer extends ElBugKeyer {
if (key != null) { if (key != null) {
return this.keyDuration(key) return this.keyDuration(key)
} }
return super.nextTxDuration() for (let key of [1, 0]) {
if (this.keyPressed[key]) {
return this.keyDuration(key)
}
}
return 0
} }
} }
class UltimaticKeyer extends SingleDotKeyer { class IambicKeyer {}
Key(key, pressed) {
if (pressed) {
this.queue.add(key)
}
super.Key(key, pressed)
}
}
/** /**
* Keyer class. This handles iambic and straight key input. * Keyer class. This handles iambic and straight key input.

View File

@ -43,7 +43,7 @@ class VailClient {
this.lamp = new Buzzer.Lamp() this.lamp = new Buzzer.Lamp()
this.buzzer = new Buzzer.ToneBuzzer() this.buzzer = new Buzzer.ToneBuzzer()
this.straightKeyer = new Keyer.StraightKeyer(() => this.beginTx(), () => this.endTx()) this.straightKeyer = new Keyer.StraightKeyer(() => this.beginTx(), () => this.endTx())
this.keyer = new Keyer.UltimaticKeyer(() => this.beginTx(), () => this.endTx()) this.keyer = new Keyer.SingleDotKeyer(() => this.beginTx(), () => this.endTx())
this.roboKeyer = new Keyer.ElBugKeyer(() => this.Buzz(), () => this.Silence()) this.roboKeyer = new Keyer.ElBugKeyer(() => this.Buzz(), () => this.Silence())
// Set up various input methods // Set up various input methods