Commit a374e265 authored by pixhawk's avatar pixhawk

Minor cleanups

parent b8ec5d47
...@@ -227,7 +227,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link) ...@@ -227,7 +227,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link)
// qDebug() << "LOSSCHANGED" << receiveLoss; // qDebug() << "LOSSCHANGED" << receiveLoss;
currLossCounter = 0; currLossCounter = 0;
currReceiveCounter = 0; currReceiveCounter = 0;
emit receiveLossChanged(receiveLoss); emit receiveLossChanged(message.sysid, receiveLoss);
} }
// The packet is emitted as a whole, as it is only 255 - 261 bytes short // The packet is emitted as a whole, as it is only 255 - 261 bytes short
......
...@@ -56,7 +56,8 @@ public slots: ...@@ -56,7 +56,8 @@ public slots:
virtual void receiveBytes(LinkInterface *link) = 0; virtual void receiveBytes(LinkInterface *link) = 0;
signals: signals:
void receiveLossChanged(float loss); /** @brief Update the packet loss from one system */
void receiveLossChanged(int uasId, float loss);
}; };
......
...@@ -67,7 +67,9 @@ void UDPLink::run() ...@@ -67,7 +67,9 @@ void UDPLink::run()
void UDPLink::setAddress(QString address) void UDPLink::setAddress(QString address)
{ {
// TODO Implement address Q_UNUSED(address);
// FIXME TODO Implement address
//socket->setLocalAddress(QHostAddress(address));
} }
void UDPLink::setPort(quint16 port) void UDPLink::setPort(quint16 port)
......
...@@ -44,8 +44,9 @@ CameraView::CameraView(int width, int height, int depth, int channels, QWidget* ...@@ -44,8 +44,9 @@ CameraView::CameraView(int width, int height, int depth, int channels, QWidget*
//setImageSize(width, height, depth, channels); //setImageSize(width, height, depth, channels);
receivedWidth = width; receivedWidth = width;
receivedHeight = height; receivedHeight = height;
receivedDepth = 8; receivedDepth = depth;
receivedChannels = 1; receivedChannels = channels;
imageId = -1;
// Fill with black background // Fill with black background
QImage fill = QImage(width, height, QImage::Format_Indexed8); QImage fill = QImage(width, height, QImage::Format_Indexed8);
...@@ -139,6 +140,7 @@ void CameraView::setImageSize(int width, int height, int depth, int channels) ...@@ -139,6 +140,7 @@ void CameraView::setImageSize(int width, int height, int depth, int channels)
void CameraView::startImage(int imgid, int width, int height, int depth, int channels) void CameraView::startImage(int imgid, int width, int height, int depth, int channels)
{ {
this->imageId = imgid;
//qDebug() << "CameraView: starting image (" << width << "x" << height << ", " << depth << "bits) with " << channels << "channels"; //qDebug() << "CameraView: starting image (" << width << "x" << height << ", " << depth << "bits) with " << channels << "channels";
// Copy previous image to screen if it hasn't been finished properly // Copy previous image to screen if it hasn't been finished properly
...@@ -208,6 +210,10 @@ void CameraView::saveImage() ...@@ -208,6 +210,10 @@ void CameraView::saveImage()
void CameraView::setPixels(int imgid, const unsigned char* imageData, int length, unsigned int startIndex) void CameraView::setPixels(int imgid, const unsigned char* imageData, int length, unsigned int startIndex)
{ {
// FIXME imgid can be used to receive and then display multiple images
// the image buffer should be converted into a n image buffer.
Q_UNUSED(imgid);
// qDebug() << "at" << __FILE__ << __LINE__ << ": Received startindex" << startIndex << "and length" << length << "(" << startIndex+length << "of" << rawExpectedBytes << "bytes)"; // qDebug() << "at" << __FILE__ << __LINE__ << ": Received startindex" << startIndex << "and length" << length << "(" << startIndex+length << "of" << rawExpectedBytes << "bytes)";
if (imageStarted) if (imageStarted)
......
...@@ -71,6 +71,8 @@ protected: ...@@ -71,6 +71,8 @@ protected:
int receivedChannels; int receivedChannels;
int receivedWidth; int receivedWidth;
int receivedHeight; int receivedHeight;
QMap<int, QImage*> images; ///< Reference to the received images
int imageId; ///< ID of the currently displayed image
void commitRawDataToGL(); void commitRawDataToGL();
}; };
......
...@@ -166,7 +166,7 @@ settings() ...@@ -166,7 +166,7 @@ settings()
adjustSize(); adjustSize();
// //
connect(mavlink, SIGNAL(receiveLossChanged(float)), info, SLOT(updateSendLoss(float))); connect(mavlink, SIGNAL(receiveLossChanged(int, float)), info, SLOT(updateSendLoss(int, float)));
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
......
...@@ -117,13 +117,19 @@ void UASInfoWidget::updateCPULoad(UASInterface* uas, double load) ...@@ -117,13 +117,19 @@ void UASInfoWidget::updateCPULoad(UASInterface* uas, double load)
} }
} }
void UASInfoWidget::updateReceiveLoss(float receiveLoss) void UASInfoWidget::updateReceiveLoss(int uasId, float receiveLoss)
{ {
Q_UNUSED(uasId);
this->receiveLoss = this->receiveLoss * 0.8f + receiveLoss * 0.2f; this->receiveLoss = this->receiveLoss * 0.8f + receiveLoss * 0.2f;
} }
void UASInfoWidget::updateSendLoss(float sendLoss) /**
The send loss is typically calculated on the GCS based on packets
that were received scrambled from the MAV
*/
void UASInfoWidget::updateSendLoss(int uasId, float sendLoss)
{ {
Q_UNUSED(uasId);
this->sendLoss = this->sendLoss * 0.8f + sendLoss * 0.2f; this->sendLoss = this->sendLoss * 0.8f + sendLoss * 0.2f;
} }
......
...@@ -56,8 +56,10 @@ public slots: ...@@ -56,8 +56,10 @@ public slots:
void updateBattery(UASInterface* uas, double voltage, double percent, int seconds); void updateBattery(UASInterface* uas, double voltage, double percent, int seconds);
void updateCPULoad(UASInterface* uas, double load); void updateCPULoad(UASInterface* uas, double load);
void updateReceiveLoss(float receiveLoss); /** @brief Set the loss rate of packets received by the MAV */
void updateSendLoss(float sendLoss); void updateReceiveLoss(int uasId, float receiveLoss);
/** @brief Set the loss rate of packets sent from the MAV */
void updateSendLoss(int uasId, float sendLoss);
void setVoltage(UASInterface* uas, double voltage); void setVoltage(UASInterface* uas, double voltage);
void setChargeLevel(UASInterface* uas, double chargeLevel); void setChargeLevel(UASInterface* uas, double chargeLevel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment