Center channels when possible. Fix channel setting initial display. Add clear active count button.

This commit is contained in:
srcejon 2023-09-29 14:35:52 +01:00
parent 4462078ead
commit 33629b77e2
5 changed files with 51 additions and 1 deletions

View File

@ -337,6 +337,16 @@ void FreqScanner::processScanResults(const QDateTime& fftStartTime, const QList<
m_stepStartFrequency = frequencies.front() + m_scannerSampleRate / 2 - m_settings.m_channelBandwidth + m_settings.m_channelBandwidth / 2;
m_stepStopFrequency = frequencies.back();
// If all frequencies fit within bandwidth, we can have the first frequency more central
int totalBW = frequencies.back() - frequencies.front() + 2 * m_settings.m_channelBandwidth;
if (totalBW < m_scannerSampleRate)
{
int spareBWEachSide = (m_scannerSampleRate - totalBW) / 2;
int spareChannelsEachSide = spareBWEachSide / m_settings.m_channelBandwidth;
int offset = spareChannelsEachSide * m_settings.m_channelBandwidth;
m_stepStartFrequency -= offset;
}
initScan();
}
}

View File

@ -505,6 +505,10 @@ void FreqScannerGUI::displaySettings()
blockApplySettings(true);
int channelIndex = ui->channels->findText(m_settings.m_channel);
if (channelIndex >= 0) {
ui->channels->setCurrentIndex(channelIndex);
}
ui->deltaFrequency->setValue(m_settings.m_channelFrequencyOffset);
ui->channelBandwidth->setValue(m_settings.m_channelBandwidth);
ui->scanTime->setValue(m_settings.m_scanTime * 10.0);
@ -641,7 +645,14 @@ void FreqScannerGUI::on_remove_clicked()
ui->table->removeRow(row);
m_settings.m_frequencies.removeAt(row); // table_cellChanged isn't called for removeRow
m_settings.m_enabled.removeAt(row);
m_settings.m_notes.removeAt(row);
}
QList<QString> settingsKeys({
"frequencies",
"enabled",
"notes"
});
applySettings(settingsKeys);
}
static QList<QTableWidgetItem*> takeRow(QTableWidget* table, int row)
@ -695,6 +706,13 @@ void FreqScannerGUI::on_down_clicked()
}
}
void FreqScannerGUI::on_clearActiveCount_clicked()
{
for (int i = 0; i < ui->table->rowCount(); i++) {
ui->table->item(i, COL_ACTIVE_COUNT)->setData(Qt::DisplayRole, 0);
}
}
void FreqScannerGUI::on_table_cellChanged(int row, int column)
{
QTableWidgetItem* item = ui->table->item(row, column);
@ -911,6 +929,7 @@ void FreqScannerGUI::makeUIConnections()
QObject::connect(ui->remove, &QToolButton::clicked, this, &FreqScannerGUI::on_remove_clicked);
QObject::connect(ui->up, &QToolButton::clicked, this, &FreqScannerGUI::on_up_clicked);
QObject::connect(ui->down, &QToolButton::clicked, this, &FreqScannerGUI::on_down_clicked);
QObject::connect(ui->clearActiveCount, &QToolButton::clicked, this, &FreqScannerGUI::on_clearActiveCount_clicked);
}
void FreqScannerGUI::updateAbsoluteCenterFrequency()

View File

@ -134,6 +134,7 @@ private slots:
void on_remove_clicked();
void on_up_clicked();
void on_down_clicked();
void on_clearActiveCount_clicked();
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void handleInputMessages();

View File

@ -740,6 +740,20 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="clearActiveCount">
<property name="toolTip">
<string>Clear Active Count in all rows</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -16,7 +16,9 @@ Specifies the channel (such as an AM, NFM or DSD Demod), by device set and chann
<h3>2: Minimum frequency shift from center frequency of reception for channel</h3>
Use the wheels of keyboard to adjust the minimim frequency shift in Hz from the center frequency of reception for the channel (1). Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arrows. Pressing shift simultaneously moves digit by 5 and pressing control moves it by 2.
Use the wheels of keyboard to adjust the minimim frequency shift in Hz from the center frequency of reception for the channel (1).
This setting is typically used to avoid having the channel (1) centered at DC, which can be problematic for some demodulators used with SDRs with a DC spike.
<h3>3: Active frequency power</h3>
@ -119,3 +121,7 @@ Moves the selected rows up the frequency table (14).
<h3>19: Down</h3>
Moves the selected rows the the frequency table (14).
<h3>20: Clear Active Count</h3>
Press to reset the value in the Active Count column to 0 for all rows.