Fixed camera control related issues and

This commit is contained in:
Ubuntu
2025-04-01 15:38:31 +00:00
parent 1a189f1f1c
commit 1009af4a32
3 changed files with 12 additions and 6 deletions
+8 -3
View File
@@ -1,9 +1,10 @@
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#include <QUdpSocket>
#include "aienginegimbalserver.h" #include "aienginegimbalserver.h"
#include "aienginegimbalserveractions.h" #include "aienginegimbalserveractions.h"
AiEngineGimbalServer::AiEngineGimbalServer(QObject *parent) AiEngineGimbalServer::AiEngineGimbalServer(QObject *parent)
: QObject{parent} : QObject{parent}
{ {
@@ -31,8 +32,12 @@ AiEngineGimbalServer::AiEngineGimbalServer(QObject *parent)
// Create and bind the new UDP socket for receiving commands // Create and bind the new UDP socket for receiving commands
mReceiveUdpSocket = new QUdpSocket(this); mReceiveUdpSocket = new QUdpSocket(this);
mReceiveUdpSocket->bind(QHostAddress::LocalHost, 45454);
// mReceiveUdpSocket->bind(QHostAddress::LocalHost, 45454);
if (!mReceiveUdpSocket->bind(QHostAddress::LocalHost, 45454)) {
qDebug() << "Failed to bind UDP socket:" << mReceiveUdpSocket->errorString();
}
// Connect the socket to handle incoming messages // Connect the socket to handle incoming messages
connect(mReceiveUdpSocket, &QUdpSocket::readyRead, this, &AiEngineGimbalServer::processUdpCommands); connect(mReceiveUdpSocket, &QUdpSocket::readyRead, this, &AiEngineGimbalServer::processUdpCommands);
} }
+3 -2
View File
@@ -35,8 +35,9 @@ private:
AiEngineGimbalServerUDPResponse mUdpResponse; AiEngineGimbalServerUDPResponse mUdpResponse;
AiEngineGimbalServerActions mActions; AiEngineGimbalServerActions mActions;
bool mIsAvailable; bool mIsAvailable;
QUdpSocket mReceiveUdpSocket; // UDP socket for receiving commands QUdpSocket *mReceiveUdpSocket; // UDP socket for receiving commands
private slots: private slots:
void processPendingDatagrams(void); // Handles incoming UDP messages // void processPendingDatagrams(void); // Handles incoming UDP messages
void processUdpCommands(void);
}; };
+1 -1
View File
@@ -623,7 +623,7 @@ static int convert_image_rga(image_buffer_t* src_img, image_buffer_t* dst_img, i
if (drect.width != dstWidth || drect.height != dstHeight) { if (drect.width != dstWidth || drect.height != dstHeight) {
im_rect dst_whole_rect = {0, 0, dstWidth, dstHeight}; im_rect dst_whole_rect = {0, 0, dstWidth, dstHeight};
int imcolor; int imcolor;
char* p_imcolor = &imcolor; int* p_imcolor = &imcolor;
p_imcolor[0] = color; p_imcolor[0] = color;
p_imcolor[1] = color; p_imcolor[1] = color;
p_imcolor[2] = color; p_imcolor[2] = color;