mirror of https://github.com/nealey/vail.git
Single dot keyer
This commit is contained in:
parent
5f78339faa
commit
b9188bcdbf
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue