kopia lustrzana https://gitlab.com/eliggett/wfview
Various other fixes, including cwsender
rodzic
4d12608b8f
commit
f610d6d9ad
|
@ -327,8 +327,7 @@ bool cachingQueue::compare(QVariant a, QVariant b)
|
|||
if (a.value<bool>() != b.value<bool>())
|
||||
changed=true;
|
||||
} else if (!strcmp(a.typeName(),"QString")) {
|
||||
if (a.value<QString>() != b.value<QString>())
|
||||
changed=true;
|
||||
changed=true;
|
||||
} else if (!strcmp(a.typeName(),"uchar")) {
|
||||
if (a.value<uchar>() != b.value<uchar>())
|
||||
changed=true;
|
||||
|
|
101
cwsender.cpp
101
cwsender.cpp
|
@ -20,6 +20,51 @@ cwSender::cwSender(QWidget *parent) :
|
|||
connect(ui->textToSendEdit->lineEdit(), &QLineEdit::textEdited, this, &cwSender::textChanged);
|
||||
this->setObjectName("CW Sender");
|
||||
queue = cachingQueue::getInstance(this);
|
||||
|
||||
connect(this, &cwSender::sendCW, queue, [=](const QString &cwMessage) {
|
||||
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<QString>(cwMessage)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::stopCW, queue, [=]() {
|
||||
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<QString>(QChar(0xff))));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setBreakInMode, queue, [=](const unsigned char &bmode) {
|
||||
queue->add(priorityImmediate,queueItem(funcBreakIn,QVariant::fromValue<uchar>(bmode)));
|
||||
});
|
||||
|
||||
|
||||
connect(this, &cwSender::setDashRatio, queue, [=](const unsigned char& ratio) {
|
||||
queue->add(priorityImmediate,queueItem(funcDashRatio,QVariant::fromValue<uchar>(ratio)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setPitch, queue, [=](const unsigned char& pitch) {
|
||||
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<ushort>(pitch)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::getCWSettings, queue, [=]() {
|
||||
queue->add(priorityImmediate,funcKeySpeed);
|
||||
queue->add(priorityImmediate,funcBreakIn);
|
||||
queue->add(priorityImmediate,funcCwPitch);
|
||||
queue->add(priorityImmediate,funcDashRatio);
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setKeySpeed, tone,
|
||||
[=](const unsigned char& wpm) { tone->setSpeed(wpm); });
|
||||
|
||||
connect(this, &cwSender::setDashRatio, tone,
|
||||
[=](const unsigned char& ratio) { tone->setRatio(ratio); });
|
||||
|
||||
connect(this, &cwSender::setPitch, tone,
|
||||
[=](const unsigned char& pitch) { tone->setFrequency(pitch); });
|
||||
|
||||
connect(this, &cwSender::setLevel, tone,
|
||||
[=](const unsigned char& level) { tone->setLevel(level); });
|
||||
|
||||
connect(this, &cwSender::stopCW, tone,
|
||||
[=]() { tone->stopSending(); });
|
||||
|
||||
|
||||
}
|
||||
|
||||
cwSender::~cwSender()
|
||||
|
@ -51,6 +96,7 @@ void cwSender::showEvent(QShowEvent *event)
|
|||
|
||||
void cwSender::handleKeySpeed(unsigned char wpm)
|
||||
{
|
||||
qInfo(logCW()) << "Received key speed" << wpm;
|
||||
if (wpm != ui->wpmSpin->value() && (wpm >= ui->wpmSpin->minimum()) && (wpm <= ui->wpmSpin->maximum()))
|
||||
{
|
||||
ui->wpmSpin->blockSignals(true);
|
||||
|
@ -63,6 +109,7 @@ void cwSender::handleKeySpeed(unsigned char wpm)
|
|||
#else
|
||||
emit setKeySpeed(ratio);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,19 +244,19 @@ void cwSender::on_breakinCombo_activated(int brkmode)
|
|||
void cwSender::on_wpmSpin_valueChanged(int wpm)
|
||||
{
|
||||
emit setKeySpeed((unsigned char)wpm);
|
||||
queue->add(priorityImmediate,queueItem(funcKeySpeed,QVariant::fromValue<ushort>(wpm)));
|
||||
}
|
||||
|
||||
void cwSender::on_dashSpin_valueChanged(double ratio)
|
||||
{
|
||||
emit setDashRatio((unsigned char)double(ratio * 10));
|
||||
queue->add(priorityImmediate,queueItem(funcDashRatio,QVariant::fromValue<uchar>(ratio*10.0)));
|
||||
}
|
||||
|
||||
void cwSender::on_pitchSpin_valueChanged(int arg1)
|
||||
{
|
||||
// quint16 cwPitch = round((((600.0 / 255.0) * pitch) + 300) / 5.0) * 5.0;
|
||||
unsigned char pitch = 0;
|
||||
pitch = ceil((arg1 - 300) * (255.0 / 600.0));
|
||||
emit setPitch(pitch);
|
||||
queue->add(priorityImmediate,queueItem(funcCwPitch,QVariant::fromValue<ushort>(arg1)));
|
||||
//emit setPitch(pitch);
|
||||
}
|
||||
|
||||
void cwSender::on_macro1btn_clicked()
|
||||
|
@ -283,52 +330,6 @@ void cwSender::on_sidetoneEnableChk_clicked(bool clicked)
|
|||
tone->send(text); ui->sidetoneEnableChk->setEnabled(false);
|
||||
});
|
||||
|
||||
connect(this, &cwSender::sendCW, queue, [=](const QString &cwMessage) {
|
||||
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<QString>(cwMessage)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::stopCW, queue, [=]() {
|
||||
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<QString>(QChar(0xff))));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setBreakInMode, queue, [=](const unsigned char &bmode) {
|
||||
queue->add(priorityImmediate,queueItem(funcBreakIn,QVariant::fromValue<uchar>(bmode)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setKeySpeed, queue, [=](const unsigned char& wpm) {
|
||||
queue->add(priorityImmediate,queueItem(funcKeySpeed,QVariant::fromValue<ushort>(wpm)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setDashRatio, queue, [=](const unsigned char& ratio) {
|
||||
queue->add(priorityImmediate,queueItem(funcDashRatio,QVariant::fromValue<uchar>(ratio)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setPitch, queue, [=](const unsigned char& pitch) {
|
||||
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<ushort>(pitch)));
|
||||
});
|
||||
|
||||
connect(this, &cwSender::getCWSettings, queue, [=]() {
|
||||
queue->add(priorityImmediate,funcKeySpeed);
|
||||
queue->add(priorityImmediate,funcBreakIn);
|
||||
queue->add(priorityImmediate,funcCwPitch);
|
||||
queue->add(priorityImmediate,funcDashRatio);
|
||||
});
|
||||
|
||||
connect(this, &cwSender::setKeySpeed, tone,
|
||||
[=](const unsigned char& wpm) { tone->setSpeed(wpm); });
|
||||
|
||||
connect(this, &cwSender::setDashRatio, tone,
|
||||
[=](const unsigned char& ratio) { tone->setRatio(ratio); });
|
||||
|
||||
connect(this, &cwSender::setPitch, tone,
|
||||
[=](const unsigned char& pitch) { tone->setFrequency(pitch); });
|
||||
|
||||
connect(this, &cwSender::setLevel, tone,
|
||||
[=](const unsigned char& level) { tone->setLevel(level); });
|
||||
|
||||
connect(this, &cwSender::stopCW, tone,
|
||||
[=]() { tone->stopSending(); });
|
||||
|
||||
connect(tone, &cwSidetone::finished, this,
|
||||
[=]() { ui->sidetoneEnableChk->setEnabled(true); });
|
||||
|
||||
|
|
|
@ -2081,6 +2081,12 @@ void rigCommander::parseCommand()
|
|||
}
|
||||
break;
|
||||
// The following group are 2 bytes converted to uchar (0-255)
|
||||
case funcKeySpeed: {
|
||||
uchar level = bcdHexToUChar(payloadIn[0],payloadIn[1]);
|
||||
value.setValue<ushort>(round((level / 6.071) + 6));
|
||||
break;
|
||||
}
|
||||
|
||||
case funcAGCTime:
|
||||
case funcRfGain:
|
||||
case funcSquelch:
|
||||
|
@ -2092,7 +2098,6 @@ void rigCommander::parseCommand()
|
|||
case funcCwPitch:
|
||||
case funcRFPower:
|
||||
case funcMicGain:
|
||||
case funcKeySpeed:
|
||||
case funcNotchFilter:
|
||||
case funcCompressorLevel:
|
||||
case funcBreakInDelay:
|
||||
|
@ -5313,6 +5318,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
|
|||
if (func == funcSendCW)
|
||||
{
|
||||
val = value.value<QString>().length();
|
||||
qInfo(logRig()) << "Send CW received";
|
||||
}
|
||||
|
||||
if (func == funcAfGain && value.isValid() && udp != Q_NULLPTR) {
|
||||
|
@ -5355,7 +5361,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
|
|||
else if (!strcmp(value.typeName(),"QString"))
|
||||
{
|
||||
QString text = value.value<QString>();
|
||||
if (pttAllowed && func == funcSendCW)
|
||||
if (func == funcSendCW)
|
||||
{
|
||||
QByteArray textData = text.toLocal8Bit();
|
||||
unsigned char p=0;
|
||||
|
@ -5369,7 +5375,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
|
|||
(p==0x2D) || (p==0x2C) || (p==0x3A) ||
|
||||
(p==0x27) || (p==0x28) || (p==0x29) ||
|
||||
(p==0x3D) || (p==0x2B) || (p==0x22) ||
|
||||
(p==0x40) || (p==0x20) )
|
||||
(p==0x40) || (p==0x20) || p == 0xff)
|
||||
{
|
||||
// Allowed character, continue
|
||||
} else {
|
||||
|
@ -5378,11 +5384,16 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
|
|||
}
|
||||
}
|
||||
payload.append(textData);
|
||||
qInfo(logRig()) << "Sending CW: payload:" << payload.toHex(' ');
|
||||
}
|
||||
}
|
||||
else if (!strcmp(value.typeName(),"uchar"))
|
||||
{
|
||||
payload.append(value.value<uchar>());
|
||||
if (func == funcDashRatio) {
|
||||
payload.append(bcdEncodeChar(value.value<uchar>()));
|
||||
} else {
|
||||
payload.append(value.value<uchar>());
|
||||
}
|
||||
}
|
||||
else if (!strcmp(value.typeName(),"ushort"))
|
||||
{
|
||||
|
@ -5391,6 +5402,15 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
|
|||
//qInfo() << "Setting filter width" << value.value<ushort>() << "sub" << sub << "hex" << payload.toHex();
|
||||
|
||||
}
|
||||
else if (func == funcKeySpeed){
|
||||
ushort wpm = round((value.value<ushort>()-6) * (6.071));
|
||||
payload.append(bcdEncodeInt(wpm));
|
||||
}
|
||||
else if (func == funcCwPitch) {
|
||||
ushort pitch = 0;
|
||||
pitch = ceil((value.value<ushort>() - 300) * (255.0 / 600.0));
|
||||
payload.append(bcdEncodeInt(pitch));
|
||||
}
|
||||
else {
|
||||
payload.append(bcdEncodeInt(value.value<ushort>()));
|
||||
}
|
||||
|
@ -5701,7 +5721,7 @@ void rigCommander::receiveCommand(funcs func, QVariant value, bool sub)
|
|||
}
|
||||
// This was a set command, so queue a get straight after to retrieve the updated value
|
||||
// will fail on some commands so they would need to be added here:
|
||||
if (func != funcScopeFixedEdgeFreq && func != funcSpeech && func != funcBandStackReg && func != funcMemoryContents)
|
||||
if (func != funcScopeFixedEdgeFreq && func != funcSpeech && func != funcBandStackReg && func != funcMemoryContents && func != funcSendCW)
|
||||
{
|
||||
queue->addUnique(priorityImmediate,func,false,sub);
|
||||
}
|
||||
|
|
|
@ -5432,7 +5432,6 @@ void wfmain::receiveValue(cacheItem val){
|
|||
// There is only a single CW Pitch setting, so send to both scopes.
|
||||
ui->mainScope->receiveCwPitch(val.value.value<uchar>());
|
||||
ui->subScope->receiveCwPitch(val.value.value<uchar>());
|
||||
//receiveCwPitch(val.value.value<uchar>());
|
||||
cw->handlePitch(val.value.value<uchar>());
|
||||
break;
|
||||
case funcMicGain:
|
||||
|
|
Ładowanie…
Reference in New Issue