Add Sky Map support to Rotator Controller.

pull/1986/head
srcejon 2024-02-14 13:21:26 +00:00
rodzic 2708a81623
commit 1ace16cfe2
4 zmienionych plików z 32 dodań i 3 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -25,6 +25,11 @@
#include <QSerialPort>
#include <QRegularExpression>
#include "maincore.h"
#include "util/astronomy.h"
#include "SWGTargetAzimuthElevation.h"
#include "gs232controller.h"
#include "gs232controllerworker.h"
#include "gs232controllerreport.h"
@ -32,7 +37,8 @@
MESSAGE_CLASS_DEFINITION(GS232ControllerWorker::MsgConfigureGS232ControllerWorker, Message)
MESSAGE_CLASS_DEFINITION(GS232ControllerReport::MsgReportAzAl, Message)
GS232ControllerWorker::GS232ControllerWorker() :
GS232ControllerWorker::GS232ControllerWorker(GS232Controller *controller) :
m_controller(controller),
m_msgQueueToFeature(nullptr),
m_device(nullptr),
m_serialPort(this),
@ -193,6 +199,8 @@ void GS232ControllerWorker::applySettings(const GS232ControllerSettings& setting
{
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));
}
}

Wyświetl plik

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