1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Add Sky Map support to Rotator Controller.

This commit is contained in:
srcejon 2024-02-14 13:21:26 +00:00
parent 2708a81623
commit 1ace16cfe2
4 changed files with 32 additions and 3 deletions

View File

@ -142,7 +142,7 @@ void GS232Controller::start()
qDebug("GS232Controller::start"); qDebug("GS232Controller::start");
m_thread = new QThread(); m_thread = new QThread();
m_worker = new GS232ControllerWorker(); m_worker = new GS232ControllerWorker(this);
m_worker->moveToThread(m_thread); m_worker->moveToThread(m_thread);
QObject::connect(m_thread, &QThread::started, m_worker, &GS232ControllerWorker::startWork); QObject::connect(m_thread, &QThread::started, m_worker, &GS232ControllerWorker::startWork);
QObject::connect(m_thread, &QThread::finished, m_worker, &QObject::deleteLater); QObject::connect(m_thread, &QThread::finished, m_worker, &QObject::deleteLater);

View File

@ -29,6 +29,7 @@
const QStringList GS232ControllerSettings::m_pipeTypes = { const QStringList GS232ControllerSettings::m_pipeTypes = {
QStringLiteral("ADSBDemod"), QStringLiteral("ADSBDemod"),
QStringLiteral("Map"), QStringLiteral("Map"),
QStringLiteral("SkyMap"),
QStringLiteral("StarTracker"), QStringLiteral("StarTracker"),
QStringLiteral("SatelliteTracker") QStringLiteral("SatelliteTracker")
}; };
@ -36,6 +37,7 @@ const QStringList GS232ControllerSettings::m_pipeTypes = {
const QStringList GS232ControllerSettings::m_pipeURIs = { const QStringList GS232ControllerSettings::m_pipeURIs = {
QStringLiteral("sdrangel.channel.adsbdemod"), QStringLiteral("sdrangel.channel.adsbdemod"),
QStringLiteral("sdrangel.feature.map"), QStringLiteral("sdrangel.feature.map"),
QStringLiteral("sdrangel.feature.skymap"),
QStringLiteral("sdrangel.feature.startracker"), QStringLiteral("sdrangel.feature.startracker"),
QStringLiteral("sdrangel.feature.satellitetracker") QStringLiteral("sdrangel.feature.satellitetracker")
}; };

View File

@ -25,6 +25,11 @@
#include <QSerialPort> #include <QSerialPort>
#include <QRegularExpression> #include <QRegularExpression>
#include "maincore.h"
#include "util/astronomy.h"
#include "SWGTargetAzimuthElevation.h"
#include "gs232controller.h" #include "gs232controller.h"
#include "gs232controllerworker.h" #include "gs232controllerworker.h"
#include "gs232controllerreport.h" #include "gs232controllerreport.h"
@ -32,7 +37,8 @@
MESSAGE_CLASS_DEFINITION(GS232ControllerWorker::MsgConfigureGS232ControllerWorker, Message) MESSAGE_CLASS_DEFINITION(GS232ControllerWorker::MsgConfigureGS232ControllerWorker, Message)
MESSAGE_CLASS_DEFINITION(GS232ControllerReport::MsgReportAzAl, Message) MESSAGE_CLASS_DEFINITION(GS232ControllerReport::MsgReportAzAl, Message)
GS232ControllerWorker::GS232ControllerWorker() : GS232ControllerWorker::GS232ControllerWorker(GS232Controller *controller) :
m_controller(controller),
m_msgQueueToFeature(nullptr), m_msgQueueToFeature(nullptr),
m_device(nullptr), m_device(nullptr),
m_serialPort(this), m_serialPort(this),
@ -193,6 +199,8 @@ void GS232ControllerWorker::applySettings(const GS232ControllerSettings& setting
{ {
setAzimuth(azimuth); setAzimuth(azimuth);
} }
sendToSkyMap(azimuth, elevation);
} }
} }
@ -280,3 +288,18 @@ void GS232ControllerWorker::update()
} }
} }
void GS232ControllerWorker::sendToSkyMap(float azimuth, float elevation)
{
QList<ObjectPipe*> targetPipes;
MainCore::instance()->getMessagePipes().getMessagePipes(m_controller, "target", targetPipes);
for (const auto& pipe : targetPipes)
{
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
SWGSDRangel::SWGTargetAzimuthElevation *swgTarget = new SWGSDRangel::SWGTargetAzimuthElevation();
swgTarget->setName(new QString("Rotator"));
swgTarget->setAzimuth(azimuth);
swgTarget->setElevation(elevation);
messageQueue->push(MainCore::MsgTargetAzimuthElevation::create(m_controller, swgTarget));
}
}

View File

@ -32,6 +32,8 @@
#include "gs232controllersettings.h" #include "gs232controllersettings.h"
#include "controllerprotocol.h" #include "controllerprotocol.h"
class GS232Controller;
class GS232ControllerWorker : public QObject class GS232ControllerWorker : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -62,7 +64,7 @@ public:
{ } { }
}; };
GS232ControllerWorker(); GS232ControllerWorker(GS232Controller *controller);
~GS232ControllerWorker(); ~GS232ControllerWorker();
void startWork(); void startWork();
void stopWork(); void stopWork();
@ -72,6 +74,7 @@ public:
private: private:
GS232Controller *m_controller;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
MessageQueue *m_msgQueueToFeature; //!< Queue to report channel change to main feature object MessageQueue *m_msgQueueToFeature; //!< Queue to report channel change to main feature object
GS232ControllerSettings m_settings; GS232ControllerSettings m_settings;
@ -92,6 +95,7 @@ private:
QIODevice *openSocket(const GS232ControllerSettings& settings); QIODevice *openSocket(const GS232ControllerSettings& settings);
void setAzimuth(float azimuth); void setAzimuth(float azimuth);
void setAzimuthElevation(float azimuth, float elevation); void setAzimuthElevation(float azimuth, float elevation);
void sendToSkyMap(float azimuth, float elevation);
private slots: private slots:
void handleInputMessages(); void handleInputMessages();