summaryrefslogtreecommitdiffstats
path: root/clients
diff options
context:
space:
mode:
Diffstat (limited to 'clients')
-rw-r--r--clients/tde/src/part/fpgaview/layout.ui4
-rw-r--r--clients/tde/src/part/fpgaview/part.cpp41
-rw-r--r--clients/tde/src/part/fpgaview/part.h5
3 files changed, 38 insertions, 12 deletions
diff --git a/clients/tde/src/part/fpgaview/layout.ui b/clients/tde/src/part/fpgaview/layout.ui
index 0d9b269..e1803e1 100644
--- a/clients/tde/src/part/fpgaview/layout.ui
+++ b/clients/tde/src/part/fpgaview/layout.ui
@@ -706,7 +706,7 @@
<cstring>groupInputImage</cstring>
</property>
<property name="title">
- <string>Input Image (128x128):</string>
+ <string>Input Image:</string>
</property>
<grid>
<property name="name">
@@ -767,7 +767,7 @@
<cstring>groupOutputImage</cstring>
</property>
<property name="title">
- <string>Output Image (128x128):</string>
+ <string>Output Image:</string>
</property>
<grid>
<property name="name">
diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp
index c9589f5..b40f167 100644
--- a/clients/tde/src/part/fpgaview/part.cpp
+++ b/clients/tde/src/part/fpgaview/part.cpp
@@ -47,6 +47,7 @@
#include <tqprogressbar.h>
#include <unistd.h> //access()
#include <stdint.h>
+#include <math.h>
#include <tqpainter.h>
@@ -589,7 +590,8 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
m_commHandlerState(0), m_commHandlerMode(0), m_commHandlerNextState(0), m_commHandlerNextMode(0), m_connectionActiveAndValid(false), m_tickerState(0), m_remoteInputModeEnabled(false), m_4bitInputValue(0), m_4bitOutputValue(0),
m_8bitInputValue(0), m_8bitOutputValue(0), m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(0xff),
m_7segDigit2OutputValue(0xff), m_7segDigit1OutputValue(0xff), m_7segDigit0OutputValue(0xff),
- m_batchOutputFile(NULL), m_dataOutputFile(NULL), m_dataMemorySize(16384),
+ m_batchOutputFile(NULL), m_dataOutputFile(NULL), m_dataMemorySize(16384), m_dataMemorySizePrev(0),
+ m_dataMemoryImageWidth(128), m_dataMemoryImageHeight(128),
m_inputImageViewer(NULL), m_outputImageViewer(NULL)
{
// Initialize important base class variables
@@ -989,12 +991,12 @@ void FPGAViewPart::processLockouts() {
if (!m_inputImageViewer) {
m_inputImageViewer = new ImageViewerWindow(i18n("Remote FPGA Input Image"));
mdiMainForm()->addWindow(m_inputImageViewer);
- m_inputImageViewer->resize(m_base->ImageInputLabel->size());
+ m_inputImageViewer->resize(m_dataMemoryImageWidth, m_dataMemoryImageHeight);
}
if (!m_outputImageViewer) {
m_outputImageViewer = new ImageViewerWindow(i18n("Remote FPGA Output Image"));
mdiMainForm()->addWindow(m_outputImageViewer);
- m_outputImageViewer->resize(m_base->ImageOutputLabel->size());
+ m_outputImageViewer->resize(m_dataMemoryImageWidth, m_dataMemoryImageHeight);
}
}
@@ -1191,6 +1193,21 @@ void FPGAViewPart::receiveInputStatesFromRemoteFPGA() {
m_remoteInputModeEnabled = true;
}
+ // DSP RAM size
+ m_socket->readBlock(data, 1);
+ m_dataMemorySize = pow(2, data[0]);
+
+ if (m_dataMemorySize != m_dataMemorySizePrev) {
+ unsigned int newSize = round(sqrt(m_dataMemorySize));
+ m_dataMemoryImageWidth = newSize;
+ m_dataMemoryImageHeight = newSize;
+ m_base->groupInputImage->setTitle(TQString("Input Image (%1x%2):").arg(m_dataMemoryImageWidth).arg(m_dataMemoryImageHeight));
+ m_base->groupOutputImage->setTitle(TQString("Output Image (%1x%2):").arg(m_dataMemoryImageWidth).arg(m_dataMemoryImageHeight));
+ m_inputImageViewer->resize(m_dataMemoryImageWidth, m_dataMemoryImageHeight);
+ m_outputImageViewer->resize(m_dataMemoryImageWidth, m_dataMemoryImageHeight);
+ m_dataMemorySizePrev = m_dataMemorySize;
+ }
+
// 4-bit outputs
m_socket->readBlock(data, 1);
m_4bitOutputValue = data[0];
@@ -1260,8 +1277,8 @@ void FPGAViewPart::updateDisplay() {
break;
case 1:
// Get all data
- if (m_socket->bytesAvailable() >= 41) {
- if (m_socket->bytesAvailable() == 41) {
+ if (m_socket->bytesAvailable() >= 42) {
+ if (m_socket->bytesAvailable() == 42) {
// Process the received data packet
receiveInputStatesFromRemoteFPGA();
@@ -1392,8 +1409,8 @@ void FPGAViewPart::updateDisplay() {
}
else if (m_commHandlerState == 2) {
// Get all data
- if (m_socket->bytesAvailable() >= 41) {
- if (m_socket->bytesAvailable() == 41) {
+ if (m_socket->bytesAvailable() >= 42) {
+ if (m_socket->bytesAvailable() == 42) {
TQString line;
// Process the received data packet
@@ -1483,7 +1500,10 @@ void FPGAViewPart::updateDisplay() {
// Show image in GUI
TQPixmap inputImagePixmap(displayImage);
- m_base->ImageInputLabel->setPixmap(inputImagePixmap);
+ TQImage scaledDisplayImage = displayImage;
+ scaledDisplayImage = scaledDisplayImage.smoothScale(m_base->ImageInputLabel->width(), m_base->ImageInputLabel->height());
+ TQPixmap scaledInputImagePixmap(scaledDisplayImage);
+ m_base->ImageInputLabel->setPixmap(scaledInputImagePixmap);
m_inputImageViewer->setPixmap(inputImagePixmap);
}
@@ -1603,7 +1623,10 @@ void FPGAViewPart::updateDisplay() {
}
}
TQPixmap outputImagePixmap(outputImage);
- m_base->ImageOutputLabel->setPixmap(outputImagePixmap);
+ TQImage scaledOutputImage = outputImage;
+ scaledOutputImage = scaledOutputImage.smoothScale(m_base->ImageOutputLabel->width(), m_base->ImageOutputLabel->height());
+ TQPixmap scaledOutputImagePixmap(scaledOutputImage);
+ m_base->ImageOutputLabel->setPixmap(scaledOutputImagePixmap);
m_outputImageViewer->setPixmap(outputImagePixmap);
outputImage.save(m_dataOutputFile, "PNG");
}
diff --git a/clients/tde/src/part/fpgaview/part.h b/clients/tde/src/part/fpgaview/part.h
index 81f74f7..8262689 100644
--- a/clients/tde/src/part/fpgaview/part.h
+++ b/clients/tde/src/part/fpgaview/part.h
@@ -250,7 +250,10 @@ namespace RemoteLab
TQImage m_dataInputImage;
TQFile* m_dataOutputFile;
TQByteArray m_dataByteArray;
- int m_dataMemorySize;
+ unsigned int m_dataMemorySize;
+ unsigned int m_dataMemorySizePrev;
+ unsigned int m_dataMemoryImageWidth;
+ unsigned int m_dataMemoryImageHeight;
ImageViewerWindow* m_inputImageViewer;
ImageViewerWindow* m_outputImageViewer;