Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a button to reset the list of TLEs to defaults compiled in Sdrangel #2151

Merged
merged 6 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified doc/img/SatelliteTracker_plugin_settingsdialog2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions plugins/feature/satellitetracker/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ For commands, scripts and speech, the following variables can be substituted: `$

![Satellite tracker settings dialog](../../../doc/img/SatelliteTracker_plugin_settingsdialog2.png)

On the TLEs tab, you can provide a list of URL from which satellite Two Line Element files can be downloaded from.
On the TLEs tab, you can manage the default list of URLs from which satellite Two Line Element files can be downloaded from.
You can add, edit, delete single entries or restore the default list.
TLE files contain the orbital parameters for a satellite and are required in order to be able to calculate a satellites position.
TLEs for may satellites can be obtained from https://www.celestrak.com/NORAD/elements/
To use a TLE file on a local disk, use a URL such as file:my_tle.txt

![Satellite tracker settings dialog](../../../doc/img/SatelliteTracker_plugin_settingsdialog3.png)

On the display tab, you can set:
On the Display tab, you can set:

* The update period in seconds, which controls how frequently satellite positions are calculated.
* The default frequency in MHz that is used for calculating Doppler and free space path loss in the Satellite Data table.
Expand All @@ -122,6 +123,13 @@ only be displayed if the source in the Rotator Controller is set to this Satelli
* Whether times are displayed in the local time zone or UTC.
* Whether to draw the satellites on the map.

![Satellite tracker settings dialog](../../../doc/img/SatelliteTracker_plugin_settingsdialog4.png)

On the Replay tab, you can set what happens when the start button is pressed:
* Whether to replay a satellite pass in the past.
* The start date and time of the replay.
* Whether to also send the replayed date and time to the Map feature.

<h3>9: Latitude</h3>

Specifies the latitude in decimal degrees (North positive) of the antenna location.
Expand Down
6 changes: 0 additions & 6 deletions plugins/feature/satellitetracker/satellitetrackersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@

#include "satellitetrackersettings.h"

#define DEAFULT_TARGET "ISS"
#define DEFAULT_TLES {"https://db.satnogs.org/api/tle/", "https://www.amsat.org/tle/current/nasabare.txt", "http://celestrak.org/NORAD/elements/gp.php?GROUP=weather&FORMAT=tle", "https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle", "https://celestrak.org/NORAD/elements/gp.php?CATNR=36395&FORMAT=tle"}
#define DEFAULT_DATE_FORMAT "yyyy/MM/dd"
#define DEFAULT_AOS_SPEECH "${name} is visible for ${duration} minutes. Max elevation, ${elevation} degrees."
#define DEFAULT_LOS_SPEECH "${name} is no longer visible."

SatelliteTrackerSettings::SatelliteTrackerSettings() :
m_rollupState(nullptr)
{
Expand Down
6 changes: 6 additions & 0 deletions plugins/feature/satellitetracker/satellitetrackersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

class Serializable;

#define DEAFULT_TARGET "ISS"
#define DEFAULT_TLES {"https://db.satnogs.org/api/tle/", "https://www.amsat.org/tle/current/nasabare.txt", "https://celestrak.org/NORAD/elements/gp.php?GROUP=weather&FORMAT=tle", "https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle", "https://celestrak.org/NORAD/elements/gp.php?CATNR=36395&FORMAT=tle"}
#define DEFAULT_DATE_FORMAT "yyyy/MM/dd"
#define DEFAULT_AOS_SPEECH "${name} is visible for ${duration} minutes. Max elevation, ${elevation} degrees."
#define DEFAULT_LOS_SPEECH "${name} is no longer visible."

#define SAT_COL_COLUMNS 18

struct SatelliteTrackerSettings
Expand Down
Copy link
Collaborator

@srcejon srcejon Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include "qmessagebox.h" should be #include < QMessageBox >

Use "" for sdrangel includes and <> for system/library includes.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "util/units.h"
#include "satellitetrackersettingsdialog.h"
#include <QDebug>
#include <QMessageBox>

SatelliteTrackerSettingsDialog::SatelliteTrackerSettingsDialog(SatelliteTrackerSettings *settings,
QWidget* parent) :
Expand Down Expand Up @@ -49,12 +50,7 @@ SatelliteTrackerSettingsDialog::SatelliteTrackerSettingsDialog(SatelliteTrackerS
ui->dateFormat->setText(settings->m_dateFormat);
ui->utc->setChecked(settings->m_utc);
ui->drawOnMap->setChecked(settings->m_drawOnMap);
for (int i = 0; i < settings->m_tles.size(); i++)
{
QListWidgetItem *item = new QListWidgetItem(settings->m_tles[i]);
item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
ui->tles->addItem(item);
}
updateTleWidget(settings->m_tles);
ui->replayEnabled->setChecked(settings->m_replayEnabled);
ui->replayDateTime->setDateTime(settings->m_replayStartDateTime);
ui->sendTimeToMap->setChecked(settings->m_sendTimeToMap);
Expand All @@ -65,9 +61,19 @@ SatelliteTrackerSettingsDialog::~SatelliteTrackerSettingsDialog()
delete ui;
}

void SatelliteTrackerSettingsDialog::updateTleWidget(QList<QString> tles)
{
for (int i = 0; i < tles.size(); i++)
{
QListWidgetItem *item = new QListWidgetItem(tles[i]);
item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
ui->tles->addItem(item);
}
}

void SatelliteTrackerSettingsDialog::on_addTle_clicked()
{
QListWidgetItem *item = new QListWidgetItem("http://");
QListWidgetItem *item = new QListWidgetItem("https://");
item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
ui->tles->addItem(item);
}
Expand All @@ -79,6 +85,16 @@ void SatelliteTrackerSettingsDialog::on_removeTle_clicked()
delete items[i];
}

void SatelliteTrackerSettingsDialog::on_defaultTles_clicked()
{
QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Confirm ovewrite", "Replace the current TLE list with the default?", QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
if (reply == QMessageBox::Yes) {
ui->tles->clear();
updateTleWidget(DEFAULT_TLES);
}
}

void SatelliteTrackerSettingsDialog::accept()
{
m_settings->m_heightAboveSeaLevel = ui->height->value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ class SatelliteTrackerSettingsDialog : public QDialog {
explicit SatelliteTrackerSettingsDialog(SatelliteTrackerSettings* settings, QWidget* parent = 0);
~SatelliteTrackerSettingsDialog();

void updateTleWidget(QList<QString> tles);

SatelliteTrackerSettings *m_settings;

private slots:
void on_addTle_clicked();
void on_removeTle_clicked();
void accept();

void on_defaultTles_clicked();

private:
Ui::SatelliteTrackerSettingsDialog* ui;
};
Expand Down
20 changes: 18 additions & 2 deletions plugins/feature/satellitetracker/satellitetrackersettingsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>487</width>
<height>543</height>
<height>603</height>
</rect>
</property>
<property name="font">
Expand Down Expand Up @@ -363,6 +363,20 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="defaultTles">
<property name="toolTip">
<string>Load preset TLE sources</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/star.png</normaloff>:/star.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="buttonHorizontalSpacer">
<property name="orientation">
Expand Down Expand Up @@ -680,7 +694,9 @@
<tabstop>utc</tabstop>
<tabstop>drawOnMap</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
Expand Down
Loading