Add CW Speed spinbox to CW sender

half-duplex
Phil Taylor 2023-01-25 18:01:24 +00:00
rodzic 4b40e20d98
commit ded6bd1ade
7 zmienionych plików z 202 dodań i 83 usunięć

Wyświetl plik

@ -41,6 +41,13 @@ void cwSender::handleKeySpeed(unsigned char wpm)
}
}
void cwSender::handlePitch(unsigned char pitch) {
quint16 cwPitch = round((((600.0 / 255.0) * pitch) + 300) / 5.0) * 5.0;
ui->pitchSpin->blockSignals(true);
ui->pitchSpin->setValue(cwPitch);
ui->pitchSpin->blockSignals(false);
}
void cwSender::handleBreakInMode(unsigned char b)
{
if(b < 3)
@ -107,6 +114,15 @@ void cwSender::on_wpmSpin_valueChanged(int wpm)
emit setKeySpeed((unsigned char)wpm);
}
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));
qDebug() << "Setting pitch" << pitch;
emit setPitch(pitch);
}
void cwSender::on_macro1btn_clicked()
{
processMacroButton(1, ui->macro1btn);

Wyświetl plik

@ -27,11 +27,13 @@ signals:
void sendCW(QString cwMessage);
void stopCW();
void setKeySpeed(unsigned char wpm);
void setPitch(unsigned char pitch);
void setBreakInMode(unsigned char b);
void getCWSettings();
public slots:
void handleKeySpeed(unsigned char wpm);
void handlePitch(unsigned char pitch);
void handleBreakInMode(unsigned char b);
void handleCurrentModeUpdate(mode_kind mode);
@ -47,6 +49,8 @@ private slots:
void on_wpmSpin_valueChanged(int arg1);
void on_pitchSpin_valueChanged(int arg1);
void on_macro1btn_clicked();
void on_macro2btn_clicked();

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<width>636</width>
<height>451</height>
</rect>
</property>
@ -18,23 +18,7 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="8">
<widget class="QPlainTextEdit" name="transcriptText">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>CW Transmission Transcript</string>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="8">
<item row="3" column="0" colspan="12">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Macros</string>
@ -177,45 +161,6 @@
</layout>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Break In</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="stopBtn">
<property name="toolTip">
<string>Stop sending CW</string>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QComboBox" name="breakinCombo">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the desired break-in mode:&lt;/p&gt;&lt;p&gt;1. None: You must manually key and unkey the radio.&lt;/p&gt;&lt;p&gt;2. Semi: Transmit is automatic and switches to receive at the end of the text.&lt;/p&gt;&lt;p&gt;3. Full: Same as semi, but with breaks between characters when possible.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>Semi</string>
</property>
</item>
<item>
<property name="text">
<string>Full</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="textToSendEdit">
<property name="sizePolicy">
@ -238,29 +183,6 @@
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QLabel" name="label">
<property name="text">
<string>WPM:</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QSpinBox" name="wpmSpin">
<property name="toolTip">
<string>Set the Words Per Minute</string>
</property>
<property name="minimum">
<number>6</number>
</property>
<property name="maximum">
<number>48</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="sendBtn">
<property name="text">
@ -274,6 +196,144 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="12">
<widget class="QPlainTextEdit" name="transcriptText">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>CW Transmission Transcript</string>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="stopBtn">
<property name="toolTip">
<string>Stop sending CW</string>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item row="1" column="3" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="3" column="0">
<widget class="QComboBox" name="breakinCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Set the desired break-in mode:&lt;/p&gt;&lt;p&gt;1. None: You must manually key and unkey the radio.&lt;/p&gt;&lt;p&gt;2. Semi: Transmit is automatic and switches to receive at the end of the text.&lt;/p&gt;&lt;p&gt;3. Full: Same as semi, but with breaks between characters when possible.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>Semi</string>
</property>
</item>
<item>
<property name="text">
<string>Full</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>WPM:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="wpmSpin">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Set the Words Per Minute</string>
</property>
<property name="minimum">
<number>6</number>
</property>
<property name="maximum">
<number>48</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Break In</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="pitchSpin">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>300</number>
</property>
<property name="maximum">
<number>900</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="stepType">
<enum>QAbstractSpinBox::DefaultStepType</enum>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>PITCH (Hz):</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>

Wyświetl plik

@ -936,6 +936,14 @@ void rigCommander::getCwPitch()
prepDataAndSend(payload);
}
void rigCommander::setCwPitch(unsigned char pitch)
{
QByteArray payload;
payload.setRawData("\x14\x09", 2);
payload.append(bcdEncodeInt(pitch));
prepDataAndSend(payload);
}
void rigCommander::getPskTone()
{
QByteArray payload;
@ -943,6 +951,14 @@ void rigCommander::getPskTone()
prepDataAndSend(payload);
}
void rigCommander::setPskTone(unsigned char tone)
{
QByteArray payload;
payload.setRawData("\x1a\x05\x00\x44", 4);
payload.append(bcdEncodeInt(tone));
prepDataAndSend(payload);
}
void rigCommander::getRttyMark()
{
QByteArray payload;
@ -950,6 +966,14 @@ void rigCommander::getRttyMark()
prepDataAndSend(payload);
}
void rigCommander::setRttyMark(unsigned char mark)
{
QByteArray payload;
payload.setRawData("\x1a\x05\x00\x41", 4);
payload.append(bcdEncodeInt(mark));
prepDataAndSend(payload);
}
void rigCommander::getTransmitFrequency()
{
QByteArray payload;

Wyświetl plik

@ -122,8 +122,11 @@ public slots:
void getPassband();
void getCwPitch();
void setCwPitch(unsigned char pitch);
void getPskTone();
void setPskTone(unsigned char tone);
void getRttyMark();
void setRttyMark(unsigned char mark);
// Repeater:
void setDuplexMode(duplexMode dm);

Wyświetl plik

@ -347,10 +347,13 @@ void wfmain::rigConnections()
connect(this, SIGNAL(stopCW()), rig, SLOT(sendStopCW()));
connect(this, SIGNAL(setKeySpeed(unsigned char)), rig, SLOT(setKeySpeed(unsigned char)));
connect(this, SIGNAL(getKeySpeed()), rig, SLOT(getKeySpeed()));
connect(this, SIGNAL(setCwPitch(unsigned char)), rig, SLOT(setCwPitch(unsigned char)));
connect(this, SIGNAL(setCWBreakMode(unsigned char)), rig, SLOT(setBreakIn(unsigned char)));
connect(this, SIGNAL(getCWBreakMode()), rig, SLOT(getBreakIn()));
connect(this->rig, &rigCommander::haveKeySpeed,
[=](const unsigned char &wpm) { cw->handleKeySpeed(wpm);});
[=](const unsigned char& wpm) { cw->handleKeySpeed(wpm); });
connect(this->rig, &rigCommander::haveCwPitch,
[=](const unsigned char& speed) { cw->handlePitch(speed); });
connect(this->rig, &rigCommander::haveCWBreakMode,
[=](const unsigned char &bm) { cw->handleBreakInMode(bm);});
@ -1079,7 +1082,9 @@ void wfmain::setupMainUI()
connect(this->cw, &cwSender::setBreakInMode,
[=](const unsigned char &bmode) { issueCmd(cmdSetBreakMode, bmode);});
connect(this->cw, &cwSender::setKeySpeed,
[=](const unsigned char &wpm) { issueCmd(cmdSetKeySpeed, wpm);});
[=](const unsigned char& wpm) { issueCmd(cmdSetKeySpeed, wpm); });
connect(this->cw, &cwSender::setPitch,
[=](const unsigned char& pitch) { issueCmd(cmdSetCwPitch, pitch); });
connect(this->cw, &cwSender::getCWSettings,
[=]() { issueDelayedCommand(cmdGetKeySpeed);
issueDelayedCommand(cmdGetBreakMode);});
@ -3708,6 +3713,12 @@ void wfmain::doCmd(commandtype cmddata)
emit setKeySpeed(wpm);
break;
}
case cmdSetCwPitch:
{
unsigned char pitch = (*std::static_pointer_cast<unsigned char>(data));
emit setCwPitch(pitch);
break;
}
case cmdSetATU:
{
bool atuOn = (*std::static_pointer_cast<bool>(data));
@ -6594,7 +6605,7 @@ void wfmain::receivePassband(quint16 pass)
void wfmain::receiveCwPitch(unsigned char pitch) {
if (currentModeInfo.mk == modeCW || currentModeInfo.mk == modeCW_R) {
cwPitch = round((((600.0 / 255.0) * pitch) + 300)/5.0)*5.0;
cwPitch = round((((600.0 / 255.0) * pitch) + 300) / 5.0) * 5.0;
passbandCenterFrequency = cwPitch / 2000000.0;
}
//qDebug() << "CW" << pitch << "Pitch" << cwPitch;

Wyświetl plik

@ -175,6 +175,7 @@ signals:
void stopCW();
void getKeySpeed();
void setKeySpeed(unsigned char wpm);
void setCwPitch(unsigned char pitch);
void setCWBreakMode(unsigned char breakMode);
void getCWBreakMode();