1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-10 10:33:29 -05:00

VOR Localizer: added forced round robin average and turn time progress bar

This commit is contained in:
f4exb 2020-12-08 08:28:55 +01:00
parent a16c041aab
commit 6a334ff303
16 changed files with 133 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

View File

@ -31,13 +31,21 @@ When checked, radials on the map will drawn adjusted for magnetic declination. F
<h3>4: Round robin turn time</h3> <h3>4: Round robin turn time</h3>
Available VOR demodulator channels are allocated to service the selected VORs on the map and displayed in the VOR table (B). There could be less available channels than the number of VORs to service in which case the channel(s) of the same device can be used to service VORs in turn in a round robin fashion. This sets the time in seconds dedicated to each turn. More details on channels allocation agorithm is given in (6). Available VOR demodulator channels are allocated to service the selected VORs on the map and displayed in the VOR table (B). There could be less available channels than the number of VORs to service in which case the channel(s) of the same device can be used to service VORs in turn in a round robin fashion. This sets the time in seconds dedicated to each turn. More details on channels allocation agorithm is given in (7).
<h3>5: Center frequency shift</h3> <h3>5: Round robin turn time progress</h3>
Shows the round robin turn time progress
<h3>6: Force averaging over round robin turn time</h3>
Averaging of radial direction and signal magnitudes normally take place only if there is more than one round robin turn for a device. This forces averaging even if only one round robin turn exists i.e. the channels for this device are active continuously. Such an averaging may help in getting a better position fix.
<h3>7: Center frequency shift</h3>
The center frequency of the device may be shifted from its value computed from VOR allocation. This can help moving the channel center away from the device DC if necessary. The center frequency of the device may be shifted from its value computed from VOR allocation. This can help moving the channel center away from the device DC if necessary.
<h3>6: List of VOR demodulator channels in the system</h3> <h3>8: List of VOR demodulator channels in the system</h3>
This combo is not used to select anything but just to show the VOR demodulators that have been detected and that will be used to service the list of selected VORs int the (B) table. This combo is not used to select anything but just to show the VOR demodulators that have been detected and that will be used to service the list of selected VORs int the (B) table.
@ -47,7 +55,7 @@ Channels may be used in round robin turns if their number is not enough to cover
When there is more than one turn for a device valid radial directions are averaged and the resulting average is used during the round robin loop. Averaging also takes place for reference and variable signal levels. When there is more than one turn for a device valid radial directions are averaged and the resulting average is used during the round robin loop. Averaging also takes place for reference and variable signal levels.
<h3>7: Refresh VOR demodulators list and allocation</h3> <h3>9: Refresh VOR demodulators list and allocation</h3>
Use this button to (re)scan the available VOR demodulators in the SDRangel instance and (re)run the round robin allocation. Use this button to (re)scan the available VOR demodulators in the SDRangel instance and (re)run the round robin allocation.

View File

@ -134,7 +134,9 @@ bool VORLocalizer::handleMessage(const Message& cmd)
return true; return true;
} }
bool singlePlan = (m_vorSinglePlans.contains(navId)) ? m_vorSinglePlans[navId] : false; bool singlePlan = (m_vorSinglePlans.contains(navId)) && !m_settings.m_forceRRAveraging ?
m_vorSinglePlans[navId] :
false;
// qDebug() << "VORLocalizer::handleMessage: MainCore::MsgChannelReport(VORDemodSC): " // qDebug() << "VORLocalizer::handleMessage: MainCore::MsgChannelReport(VORDemodSC): "
// << "navId:" << navId // << "navId:" << navId
@ -289,6 +291,9 @@ void VORLocalizer::applySettings(const VORLocalizerSettings& settings, bool forc
if ((m_settings.m_rrTime != settings.m_rrTime) || force) { if ((m_settings.m_rrTime != settings.m_rrTime) || force) {
reverseAPIKeys.append("rrTime"); reverseAPIKeys.append("rrTime");
} }
if ((m_settings.m_forceRRAveraging != settings.m_forceRRAveraging) || force) {
reverseAPIKeys.append("forceRRAveraging");
}
if ((m_settings.m_centerShift != settings.m_centerShift) || force) { if ((m_settings.m_centerShift != settings.m_centerShift) || force) {
reverseAPIKeys.append("centerShift"); reverseAPIKeys.append("centerShift");
} }
@ -440,6 +445,7 @@ void VORLocalizer::webapiFormatFeatureSettings(
response.getVorLocalizerSettings()->setRgbColor(settings.m_rgbColor); response.getVorLocalizerSettings()->setRgbColor(settings.m_rgbColor);
response.getVorLocalizerSettings()->setMagDecAdjust(settings.m_magDecAdjust); response.getVorLocalizerSettings()->setMagDecAdjust(settings.m_magDecAdjust);
response.getVorLocalizerSettings()->setRrTime(settings.m_rrTime); response.getVorLocalizerSettings()->setRrTime(settings.m_rrTime);
response.getVorLocalizerSettings()->setForceRrAveraging(settings.m_forceRRAveraging ? 1 : 0);
response.getVorLocalizerSettings()->setCenterShift(settings.m_centerShift); response.getVorLocalizerSettings()->setCenterShift(settings.m_centerShift);
response.getVorLocalizerSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0); response.getVorLocalizerSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
@ -472,6 +478,9 @@ void VORLocalizer::webapiUpdateFeatureSettings(
if (featureSettingsKeys.contains("rrTime")) { if (featureSettingsKeys.contains("rrTime")) {
settings.m_rrTime = response.getVorLocalizerSettings()->getRrTime(); settings.m_rrTime = response.getVorLocalizerSettings()->getRrTime();
} }
if (featureSettingsKeys.contains("forceRRAveraging")) {
settings.m_forceRRAveraging = response.getVorLocalizerSettings()->getForceRrAveraging() != 0;
}
if (featureSettingsKeys.contains("centerShift")) { if (featureSettingsKeys.contains("centerShift")) {
settings.m_centerShift = response.getVorLocalizerSettings()->getCenterShift(); settings.m_centerShift = response.getVorLocalizerSettings()->getCenterShift();
} }
@ -515,6 +524,9 @@ void VORLocalizer::webapiReverseSendSettings(QList<QString>& channelSettingsKeys
if (channelSettingsKeys.contains("rrTime") || force) { if (channelSettingsKeys.contains("rrTime") || force) {
swgVORLocalizerSettings->setRrTime(settings.m_rrTime); swgVORLocalizerSettings->setRrTime(settings.m_rrTime);
} }
if (channelSettingsKeys.contains("forceRRAveraging") || force) {
swgVORLocalizerSettings->setForceRrAveraging(settings.m_forceRRAveraging ? 1 : 0);
}
if (channelSettingsKeys.contains("centerShift") || force) { if (channelSettingsKeys.contains("centerShift") || force) {
swgVORLocalizerSettings->setCenterShift(settings.m_centerShift); swgVORLocalizerSettings->setCenterShift(settings.m_centerShift);
} }

View File

@ -916,6 +916,11 @@ bool VORLocalizerGUI::handleMessage(const Message& message)
vorGUI->m_frequencyItem->setForeground(QBrush(Qt::green)); vorGUI->m_frequencyItem->setForeground(QBrush(Qt::green));
} }
} }
ui->rrTurnTimeProgress->setMaximum(m_settings.m_rrTime);
ui->rrTurnTimeProgress->setValue(0);
ui->rrTurnTimeProgress->setToolTip(tr("Round robin turn %1s").arg(0));
m_rrSecondsCount = 0;
} }
return false; return false;
@ -1215,7 +1220,8 @@ VORLocalizerGUI::VORLocalizerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISe
m_progressDialog(nullptr), m_progressDialog(nullptr),
m_vorModel(this), m_vorModel(this),
m_vors(nullptr), m_vors(nullptr),
m_lastFeatureState(0) m_lastFeatureState(0),
m_rrSecondsCount(0)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -1312,6 +1318,10 @@ VORLocalizerGUI::VORLocalizerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISe
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(1000); m_statusTimer.start(1000);
ui->rrTurnTimeProgress->setMaximum(m_settings.m_rrTime);
ui->rrTurnTimeProgress->setValue(0);
ui->rrTurnTimeProgress->setToolTip(tr("Round robin turn time %1s").arg(0));
displaySettings(); displaySettings();
applySettings(true); applySettings(true);
} }
@ -1362,6 +1372,7 @@ void VORLocalizerGUI::displaySettings()
ui->rrTime->setValue(m_settings.m_rrTime); ui->rrTime->setValue(m_settings.m_rrTime);
ui->centerShiftText->setText(tr("%1k").arg(m_settings.m_centerShift/1000)); ui->centerShiftText->setText(tr("%1k").arg(m_settings.m_centerShift/1000));
ui->centerShift->setValue(m_settings.m_centerShift/1000); ui->centerShift->setValue(m_settings.m_centerShift/1000);
ui->forceRRAveraging->setChecked(m_settings.m_forceRRAveraging);
blockApplySettings(false); blockApplySettings(false);
} }
@ -1405,8 +1416,8 @@ void VORLocalizerGUI::updateStatus()
void VORLocalizerGUI::tick() void VORLocalizerGUI::tick()
{ {
// Try to determine position, based on intersection of two radials // Try to determine position, based on intersection of two radials - every second
if (m_tickCount % 50) if (++m_tickCount == 20)
{ {
float lat, lon; float lat, lon;
@ -1425,7 +1436,11 @@ void VORLocalizerGUI::tick()
stationObject->setProperty("stationName", QVariant::fromValue(MainCore::instance()->getSettings().getStationName())); stationObject->setProperty("stationName", QVariant::fromValue(MainCore::instance()->getSettings().getStationName()));
} }
} }
}
m_tickCount++; m_rrSecondsCount++;
ui->rrTurnTimeProgress->setMaximum(m_settings.m_rrTime);
ui->rrTurnTimeProgress->setValue(m_rrSecondsCount <= m_settings.m_rrTime ? m_rrSecondsCount : m_settings.m_rrTime);
ui->rrTurnTimeProgress->setToolTip(tr("Round robin turn time %1s").arg(m_rrSecondsCount));
m_tickCount = 0;
}
} }

View File

@ -237,6 +237,7 @@ private:
QIcon m_muteIcon; QIcon m_muteIcon;
QTimer m_statusTimer; QTimer m_statusTimer;
int m_lastFeatureState; int m_lastFeatureState;
int m_rrSecondsCount;
explicit VORLocalizerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr); explicit VORLocalizerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *feature, QWidget* parent = nullptr);
virtual ~VORLocalizerGUI(); virtual ~VORLocalizerGUI();

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>398</width> <width>462</width>
<height>893</height> <height>893</height>
</rect> </rect>
</property> </property>
@ -18,7 +18,7 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>352</width> <width>462</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -42,7 +42,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>390</width> <width>461</width>
<height>61</height> <height>61</height>
</rect> </rect>
</property> </property>
@ -178,16 +178,10 @@
<widget class="QLabel" name="rrTimeText"> <widget class="QLabel" name="rrTimeText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>30</width> <width>26</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Sound volume (%)</string> <string>Sound volume (%)</string>
</property> </property>
@ -200,9 +194,34 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line"> <widget class="QProgressBar" name="rrTurnTimeProgress">
<property name="orientation"> <property name="maximumSize">
<enum>Qt::Vertical</enum> <size>
<width>100</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QProgressBar{border: 2px solid rgb(79, 79, 79); text-align: center;}
QToolTip{background-color: white; color: black;}</string>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="forceRRAveraging">
<property name="toolTip">
<string>Force radials and signals magnitudes averaging over round robin turn</string>
</property>
<property name="text">
<string>A</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -245,7 +264,7 @@
<widget class="QLabel" name="centerShiftText"> <widget class="QLabel" name="centerShiftText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>30</width> <width>26</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@ -330,7 +349,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>110</y> <y>110</y>
<width>391</width> <width>461</width>
<height>140</height> <height>140</height>
</rect> </rect>
</property> </property>
@ -461,7 +480,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>260</y> <y>260</y>
<width>391</width> <width>461</width>
<height>581</height> <height>581</height>
</rect> </rect>
</property> </property>

View File

@ -66,6 +66,7 @@ struct VORLocalizerSettings
QString m_title; QString m_title;
bool m_magDecAdjust; //!< Adjust for magnetic declination when drawing radials on the map bool m_magDecAdjust; //!< Adjust for magnetic declination when drawing radials on the map
int m_rrTime; //!< Round robin turn time in seconds int m_rrTime; //!< Round robin turn time in seconds
bool m_forceRRAveraging; //!< Force radial and signal magnitude averaging over RR turn
int m_centerShift; //!< Center frequency shift to apply to move away from DC int m_centerShift; //!< Center frequency shift to apply to move away from DC
bool m_useReverseAPI; bool m_useReverseAPI;
QString m_reverseAPIAddress; QString m_reverseAPIAddress;

View File

@ -9666,6 +9666,10 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "Round robin turn time in seconds" "description" : "Round robin turn time in seconds"
}, },
"forceRRAveraging" : {
"type" : "integer",
"description" : "Force radial and signal magnitudes averaging over the round robin turn\n * 0 - Do not force averaging\n * 1 - Force averaging\n"
},
"centerShift" : { "centerShift" : {
"type" : "integer", "type" : "integer",
"description" : "Shift of center frequency in Hz" "description" : "Shift of center frequency in Hz"
@ -44874,7 +44878,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2020-12-06T23:43:21.772+01:00 Generated 2020-12-08T00:22:13.522+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -22,6 +22,12 @@ VORLocalizerSettings:
rrTime: rrTime:
description: Round robin turn time in seconds description: Round robin turn time in seconds
type: integer type: integer
forceRRAveraging:
type: integer
description: >
Force radial and signal magnitudes averaging over the round robin turn
* 0 - Do not force averaging
* 1 - Force averaging
centerShift: centerShift:
description: Shift of center frequency in Hz description: Shift of center frequency in Hz
type: integer type: integer

View File

@ -22,6 +22,12 @@ VORLocalizerSettings:
rrTime: rrTime:
description: Round robin turn time in seconds description: Round robin turn time in seconds
type: integer type: integer
forceRRAveraging:
type: integer
description: >
Force radial and signal magnitudes averaging over the round robin turn
* 0 - Do not force averaging
* 1 - Force averaging
centerShift: centerShift:
description: Shift of center frequency in Hz description: Shift of center frequency in Hz
type: integer type: integer

View File

@ -9666,6 +9666,10 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"description" : "Round robin turn time in seconds" "description" : "Round robin turn time in seconds"
}, },
"forceRRAveraging" : {
"type" : "integer",
"description" : "Force radial and signal magnitudes averaging over the round robin turn\n * 0 - Do not force averaging\n * 1 - Force averaging\n"
},
"centerShift" : { "centerShift" : {
"type" : "integer", "type" : "integer",
"description" : "Shift of center frequency in Hz" "description" : "Shift of center frequency in Hz"
@ -44874,7 +44878,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2020-12-06T23:43:21.772+01:00 Generated 2020-12-08T00:22:13.522+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -46,6 +46,8 @@ SWGVORLocalizerSettings::SWGVORLocalizerSettings() {
m_mag_dec_adjust_isSet = false; m_mag_dec_adjust_isSet = false;
rr_time = 0; rr_time = 0;
m_rr_time_isSet = false; m_rr_time_isSet = false;
force_rr_averaging = 0;
m_force_rr_averaging_isSet = false;
center_shift = 0; center_shift = 0;
m_center_shift_isSet = false; m_center_shift_isSet = false;
} }
@ -74,6 +76,8 @@ SWGVORLocalizerSettings::init() {
m_mag_dec_adjust_isSet = false; m_mag_dec_adjust_isSet = false;
rr_time = 0; rr_time = 0;
m_rr_time_isSet = false; m_rr_time_isSet = false;
force_rr_averaging = 0;
m_force_rr_averaging_isSet = false;
center_shift = 0; center_shift = 0;
m_center_shift_isSet = false; m_center_shift_isSet = false;
} }
@ -94,6 +98,7 @@ SWGVORLocalizerSettings::cleanup() {
} }
SWGVORLocalizerSettings* SWGVORLocalizerSettings*
@ -125,6 +130,8 @@ SWGVORLocalizerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&rr_time, pJson["rrTime"], "qint32", ""); ::SWGSDRangel::setValue(&rr_time, pJson["rrTime"], "qint32", "");
::SWGSDRangel::setValue(&force_rr_averaging, pJson["forceRRAveraging"], "qint32", "");
::SWGSDRangel::setValue(&center_shift, pJson["centerShift"], "qint32", ""); ::SWGSDRangel::setValue(&center_shift, pJson["centerShift"], "qint32", "");
} }
@ -170,6 +177,9 @@ SWGVORLocalizerSettings::asJsonObject() {
if(m_rr_time_isSet){ if(m_rr_time_isSet){
obj->insert("rrTime", QJsonValue(rr_time)); obj->insert("rrTime", QJsonValue(rr_time));
} }
if(m_force_rr_averaging_isSet){
obj->insert("forceRRAveraging", QJsonValue(force_rr_averaging));
}
if(m_center_shift_isSet){ if(m_center_shift_isSet){
obj->insert("centerShift", QJsonValue(center_shift)); obj->insert("centerShift", QJsonValue(center_shift));
} }
@ -267,6 +277,16 @@ SWGVORLocalizerSettings::setRrTime(qint32 rr_time) {
this->m_rr_time_isSet = true; this->m_rr_time_isSet = true;
} }
qint32
SWGVORLocalizerSettings::getForceRrAveraging() {
return force_rr_averaging;
}
void
SWGVORLocalizerSettings::setForceRrAveraging(qint32 force_rr_averaging) {
this->force_rr_averaging = force_rr_averaging;
this->m_force_rr_averaging_isSet = true;
}
qint32 qint32
SWGVORLocalizerSettings::getCenterShift() { SWGVORLocalizerSettings::getCenterShift() {
return center_shift; return center_shift;
@ -309,6 +329,9 @@ SWGVORLocalizerSettings::isSet(){
if(m_rr_time_isSet){ if(m_rr_time_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(m_force_rr_averaging_isSet){
isObjectUpdated = true; break;
}
if(m_center_shift_isSet){ if(m_center_shift_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }

View File

@ -69,6 +69,9 @@ public:
qint32 getRrTime(); qint32 getRrTime();
void setRrTime(qint32 rr_time); void setRrTime(qint32 rr_time);
qint32 getForceRrAveraging();
void setForceRrAveraging(qint32 force_rr_averaging);
qint32 getCenterShift(); qint32 getCenterShift();
void setCenterShift(qint32 center_shift); void setCenterShift(qint32 center_shift);
@ -103,6 +106,9 @@ private:
qint32 rr_time; qint32 rr_time;
bool m_rr_time_isSet; bool m_rr_time_isSet;
qint32 force_rr_averaging;
bool m_force_rr_averaging_isSet;
qint32 center_shift; qint32 center_shift;
bool m_center_shift_isSet; bool m_center_shift_isSet;