All but Iambic B working
This commit is contained in:
parent
d8a615813e
commit
a6eaae4da1
|
@ -97,6 +97,9 @@ void VailAdapter::HandleMIDI(midiEventPacket_t event) {
|
||||||
break;
|
break;
|
||||||
case 1: // set dit duration (0-254) *2ms
|
case 1: // set dit duration (0-254) *2ms
|
||||||
this->ditDuration = event.byte3 * 2 * MILLISECOND;
|
this->ditDuration = event.byte3 * 2 * MILLISECOND;
|
||||||
|
if (this->keyer) {
|
||||||
|
this->keyer->SetDitDuration(this->ditDuration);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
90
keyers.cpp
90
keyers.cpp
|
@ -35,7 +35,7 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < arrlen; i++) {
|
for (int i = 0; i < arrlen; i++) {
|
||||||
if (arr[arrlen] == i) {
|
if (arr[arrlen] == val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void beginPulsing() {
|
void beginPulsing() {
|
||||||
|
if (!this->nextPulse) {
|
||||||
this->nextPulse = 1;
|
this->nextPulse = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual void pulse(unsigned int millis) {
|
virtual void pulse(unsigned int millis) {
|
||||||
if (this->TxClosed(0)) {
|
if (this->TxClosed(0)) {
|
||||||
|
@ -226,24 +228,19 @@ public:
|
||||||
|
|
||||||
class UltimaticKeyer: public ElBugKeyer {
|
class UltimaticKeyer: public ElBugKeyer {
|
||||||
public:
|
public:
|
||||||
QSet *queue;
|
QSet queue;
|
||||||
|
|
||||||
using ElBugKeyer::ElBugKeyer;
|
using ElBugKeyer::ElBugKeyer;
|
||||||
|
|
||||||
void Reset() {
|
|
||||||
ElBugKeyer::Reset();
|
|
||||||
this->queue = new QSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Key(Paddle key, bool pressed) {
|
void Key(Paddle key, bool pressed) {
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
this->queue->add(key);
|
this->queue.add(key);
|
||||||
}
|
}
|
||||||
ElBugKeyer::Key(key, pressed);
|
ElBugKeyer::Key(key, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int nextTx() {
|
virtual int nextTx() {
|
||||||
int key = this->queue->shift();
|
int key = this->queue.shift();
|
||||||
if (key != -1) {
|
if (key != -1) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -253,24 +250,19 @@ public:
|
||||||
|
|
||||||
class SingleDotKeyer: public ElBugKeyer {
|
class SingleDotKeyer: public ElBugKeyer {
|
||||||
public:
|
public:
|
||||||
QSet *queue;
|
QSet queue;
|
||||||
|
|
||||||
using ElBugKeyer::ElBugKeyer;
|
using ElBugKeyer::ElBugKeyer;
|
||||||
|
|
||||||
void Reset() {
|
|
||||||
ElBugKeyer::Reset();
|
|
||||||
this->queue = new QSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Key(Paddle key, bool pressed) {
|
void Key(Paddle key, bool pressed) {
|
||||||
if (pressed && (key == 0)) {
|
if (pressed && (key == PADDLE_DIT)) {
|
||||||
this->queue->add(key);
|
this->queue.add(key);
|
||||||
}
|
}
|
||||||
ElBugKeyer::Key(key, pressed);
|
ElBugKeyer::Key(key, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int nextTx() {
|
virtual int nextTx() {
|
||||||
int key = this->queue->shift();
|
int key = this->queue.shift();
|
||||||
if (key != -1) {
|
if (key != -1) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +279,7 @@ public:
|
||||||
|
|
||||||
virtual int nextTx() {
|
virtual int nextTx() {
|
||||||
int next = ElBugKeyer::nextTx();
|
int next = ElBugKeyer::nextTx();
|
||||||
if (this->whichKeyPressed() != -1) {
|
if (this->keyPressed[PADDLE_DIT] && this->keyPressed[PADDLE_DAH]) {
|
||||||
this->nextRepeat = 1 - this->nextRepeat;
|
this->nextRepeat = 1 - this->nextRepeat;
|
||||||
}
|
}
|
||||||
return next;
|
return next;
|
||||||
|
@ -296,25 +288,20 @@ public:
|
||||||
|
|
||||||
class IambicAKeyer: public IambicKeyer {
|
class IambicAKeyer: public IambicKeyer {
|
||||||
public:
|
public:
|
||||||
QSet *queue;
|
QSet queue;
|
||||||
|
|
||||||
using IambicKeyer::IambicKeyer;
|
using IambicKeyer::IambicKeyer;
|
||||||
|
|
||||||
void Reset() {
|
|
||||||
IambicKeyer::Reset();
|
|
||||||
this->queue = new QSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Key(Paddle key, bool pressed) {
|
void Key(Paddle key, bool pressed) {
|
||||||
if (pressed && (key == 0)) {
|
if (pressed && (key == PADDLE_DIT)) {
|
||||||
this->queue->add(key);
|
this->queue.add(key);
|
||||||
}
|
}
|
||||||
IambicKeyer::Key(key, pressed);
|
IambicKeyer::Key(key, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int nextTx() {
|
virtual int nextTx() {
|
||||||
int next = IambicKeyer::nextTx();
|
int next = IambicKeyer::nextTx();
|
||||||
int key = this->queue->shift();
|
int key = this->queue.shift();
|
||||||
if (key != -1) {
|
if (key != -1) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -324,30 +311,29 @@ public:
|
||||||
|
|
||||||
class IambicBKeyer: public IambicKeyer {
|
class IambicBKeyer: public IambicKeyer {
|
||||||
public:
|
public:
|
||||||
QSet *queue;
|
QSet queue;
|
||||||
|
|
||||||
using IambicKeyer::IambicKeyer;
|
using IambicKeyer::IambicKeyer;
|
||||||
|
|
||||||
void Reset() {
|
void Reset() {
|
||||||
IambicKeyer::Reset();
|
IambicKeyer::Reset();
|
||||||
this->queue = new QSet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Key(Paddle key, bool pressed) {
|
void Key(Paddle key, bool pressed) {
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
this->queue->add(key);
|
this->queue.add(key);
|
||||||
}
|
}
|
||||||
IambicKeyer::Key(key, pressed);
|
IambicKeyer::Key(key, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int nextTx() {
|
virtual int nextTx() {
|
||||||
for (int key = 0; key < 2; key++) {
|
for (int key = 0; key < len(this->keyPressed); key++) {
|
||||||
if (this->keyPressed[key]) {
|
if (this->keyPressed[key]) {
|
||||||
this->queue->add(key);
|
this->queue.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->queue->shift();
|
return this->queue.shift();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -385,26 +371,26 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// StraightKeyer straightKeyer = StraightKeyer();
|
StraightKeyer straightKeyer = StraightKeyer();
|
||||||
// BugKeyer bugKeyer = BugKeyer();
|
BugKeyer bugKeyer = BugKeyer();
|
||||||
// ElBugKeyer elBugKeyer = ElBugKeyer();
|
ElBugKeyer elBugKeyer = ElBugKeyer();
|
||||||
// SingleDotKeyer singleDotKeyer = SingleDotKeyer();
|
SingleDotKeyer singleDotKeyer = SingleDotKeyer();
|
||||||
// UltimaticKeyer ultimaticKeyer = UltimaticKeyer();
|
UltimaticKeyer ultimaticKeyer = UltimaticKeyer();
|
||||||
// IambicKeyer iambicKeyer = IambicKeyer();
|
IambicKeyer iambicKeyer = IambicKeyer();
|
||||||
// IambicAKeyer iambicAKeyer = IambicAKeyer();
|
IambicAKeyer iambicAKeyer = IambicAKeyer();
|
||||||
// IambicBKeyer iambicBKeyer = IambicBKeyer();
|
IambicBKeyer iambicBKeyer = IambicBKeyer();
|
||||||
// KeyaheadKeyer keyaheadKeyer = KeyaheadKeyer();
|
KeyaheadKeyer keyaheadKeyer = KeyaheadKeyer();
|
||||||
|
|
||||||
Keyer *keyers[] = {
|
Keyer *keyers[] = {
|
||||||
// &straightKeyer,
|
&straightKeyer,
|
||||||
// &bugKeyer,
|
&bugKeyer,
|
||||||
// &elBugKeyer,
|
&elBugKeyer,
|
||||||
// &singleDotKeyer,
|
&singleDotKeyer,
|
||||||
// &ultimaticKeyer,
|
&ultimaticKeyer,
|
||||||
// &iambicKeyer,
|
&iambicKeyer,
|
||||||
// &iambicAKeyer,
|
&iambicAKeyer,
|
||||||
// &iambicBKeyer,
|
&iambicBKeyer,
|
||||||
// &keyaheadKeyer,
|
&keyaheadKeyer,
|
||||||
};
|
};
|
||||||
|
|
||||||
Keyer *GetKeyerByNumber(int n, Transmitter *output) {
|
Keyer *GetKeyerByNumber(int n, Transmitter *output) {
|
||||||
|
|
Loading…
Reference in New Issue