summaryrefslogtreecommitdiffstats
path: root/clients/tde
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-10-30 02:28:57 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-10-30 12:13:17 -0500
commit8faa3da1094d1785d3343c2869d9f8c95f01cf97 (patch)
treed6a7e029810759972c17395a22593a75256f611c /clients/tde
parentb783a269490763ec242e967fa713dbf732e5ac13 (diff)
downloadulab-8faa3da1094d1785d3343c2869d9f8c95f01cf97.tar.gz
ulab-8faa3da1094d1785d3343c2869d9f8c95f01cf97.zip
Fix image distortion when certain greyscale values are utilized
Store last used values in FPGA viewer and programmer GUI for convenience on GUI restart
Diffstat (limited to 'clients/tde')
-rw-r--r--clients/tde/src/part/fpgaprogram/part.cpp13
-rw-r--r--clients/tde/src/part/fpgaprogram/part.h5
-rw-r--r--clients/tde/src/part/fpgaview/part.cpp53
-rw-r--r--clients/tde/src/part/fpgaview/part.h6
4 files changed, 58 insertions, 19 deletions
diff --git a/clients/tde/src/part/fpgaprogram/part.cpp b/clients/tde/src/part/fpgaprogram/part.cpp
index a7edbe2..ced624e 100644
--- a/clients/tde/src/part/fpgaprogram/part.cpp
+++ b/clients/tde/src/part/fpgaprogram/part.cpp
@@ -103,6 +103,11 @@ FPGAProgramPart::FPGAProgramPart(TQWidget *parentWidget, const char *widgetName,
// Create widgets
m_base = new FPGAProgramBase(widget());
+ // Load configuration
+ m_config = new KSimpleConfig("ulab_client_part_fpgaprogrammer.conf", false);
+ m_config->setGroup("UI");
+ m_base->programmingInputFile->setURL(m_config->readPathEntry("programmingInputFile", ""));
+
// Initialize widgets
m_base->setMinimumSize(500,350);
m_base->programmingLogBox->setReadOnly(true);
@@ -115,6 +120,12 @@ FPGAProgramPart::FPGAProgramPart(TQWidget *parentWidget, const char *widgetName,
}
FPGAProgramPart::~FPGAProgramPart() {
+ // Save field state for restoration on next load
+ m_config->setGroup("UI");
+ m_config->writeEntry("programmingInputFile", m_base->programmingInputFile->url());
+ m_config->sync();
+ delete m_config;
+
if (m_connectionMutex->locked()) {
printf("[WARNING] Exiting when data transfer still in progress!\n\r"); fflush(stdout);
}
@@ -165,6 +176,7 @@ void FPGAProgramPart::connectionClosed() {
void FPGAProgramPart::postInit() {
setUsingFixedSize(false);
+ processLockouts();
}
bool FPGAProgramPart::openURL(const KURL &url) {
@@ -317,6 +329,7 @@ void FPGAProgramPart::mainEventLoop() {
}
setTickerMessage(i18n("Connected"));
+ processLockouts();
if (m_commHandlerState == ModeIdle_StateProcessStatus) {
m_pingDelayTimer->start(250, TRUE);
diff --git a/clients/tde/src/part/fpgaprogram/part.h b/clients/tde/src/part/fpgaprogram/part.h
index 48dde79..95ea66c 100644
--- a/clients/tde/src/part/fpgaprogram/part.h
+++ b/clients/tde/src/part/fpgaprogram/part.h
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (c) 2012 Timothy Pearson
+ * (c) 2012-2013 Timothy Pearson
* Raptor Engineering
* http://www.raptorengineeringinc.com
*/
@@ -29,6 +29,8 @@
#include <tqframe.h>
#include <tqimage.h>
+#include <ksimpleconfig.h>
+
#include <tdeparts/browserextension.h>
#include <tdeparts/statusbarextension.h>
#include <tdeparts/part.h>
@@ -81,6 +83,7 @@ namespace RemoteLab
private:
FPGAProgramBase* m_base;
TQMutex* m_connectionMutex;
+ KSimpleConfig* m_config;
TQTimer* m_pingDelayTimer;
TQTimer* m_forcedUpdateTimer;
TQTimer* m_updateTimeoutTimer;
diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp
index dc5c9d9..c9589f5 100644
--- a/clients/tde/src/part/fpgaview/part.cpp
+++ b/clients/tde/src/part/fpgaview/part.cpp
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (c) 2012 Timothy Pearson
+ * (c) 2012-2013 Timothy Pearson
* Raptor Engineering
* http://www.raptorengineeringinc.com
*/
@@ -589,7 +589,7 @@ 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_batchOutputFile(NULL), m_dataOutputFile(NULL), m_dataMemorySize(16384),
m_inputImageViewer(NULL), m_outputImageViewer(NULL)
{
// Initialize important base class variables
@@ -611,6 +611,16 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
// Create widgets
m_base = new FPGAViewBase(widget());
+ // Load configuration
+ m_config = new KSimpleConfig("ulab_client_part_fpgaviewer.conf", false);
+ m_config->setGroup("UI");
+ m_interfaceMode = (RemoteLab::FPGAViewPart::InterfaceMode)(m_config->readNumEntry("interfaceMode", BasicInterfaceMode));
+ m_base->batchTestInputFile->setURL(m_config->readPathEntry("batchTestInputFile", ""));
+ m_base->batchTestOutputFile->setURL(m_config->readPathEntry("batchTestOutputFile", ""));
+ m_base->batchTest16BitCheckBox->setChecked(m_config->readBoolEntry("batchUsing16Bit", false));
+ m_base->dataProcessingInputFile->setURL(m_config->readPathEntry("dataProcessingInputFile", ""));
+ m_base->dataProcessingOutputFile->setURL(m_config->readPathEntry("dataProcessingOutputFile", ""));
+
// Create menu actions
// Submenus
TDEActionCollection *const ac = actionCollection();
@@ -740,12 +750,21 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
connect(m_base->dataProcessingInputFile, SIGNAL(textChanged(const TQString &)), this, SLOT(processLockouts()));
connect(m_base->dataProcessingOutputFile, SIGNAL(textChanged(const TQString &)), this, SLOT(processLockouts()));
- processAllGraphicsUpdates();
-
TQTimer::singleShot(0, this, TQT_SLOT(postInit()));
}
FPGAViewPart::~FPGAViewPart() {
+ // Save field state for restoration on next load
+ m_config->setGroup("UI");
+ m_config->writeEntry("interfaceMode", m_interfaceMode);
+ m_config->writeEntry("batchTestInputFile", m_base->batchTestInputFile->url());
+ m_config->writeEntry("batchTestOutputFile", m_base->batchTestOutputFile->url());
+ m_config->writeEntry("batchUsing16Bit", m_base->batchTest16BitCheckBox->isChecked());
+ m_config->writeEntry("dataProcessingInputFile", m_base->dataProcessingInputFile->url());
+ m_config->writeEntry("dataProcessingOutputFile", m_base->dataProcessingOutputFile->url());
+ m_config->sync();
+ delete m_config;
+
// Close any active image display windows
m_interfaceMode = BasicInterfaceMode;
if (m_inputImageViewer) {
@@ -1056,6 +1075,8 @@ void FPGAViewPart::connectionClosed() {
}
void FPGAViewPart::postInit() {
+ processAllGraphicsUpdates();
+
setUsingFixedSize(true);
connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateDisplay()));
connect(m_timeoutTimer, SIGNAL(timeout()), this, SLOT(updateDisplay()));
@@ -1433,7 +1454,7 @@ void FPGAViewPart::updateDisplay() {
// Is it an image?
m_dataIsImage = m_dataInputImage.load(m_base->dataProcessingInputFile->url());
- if ((file.size() <= 16384) || ((m_dataIsImage) && ((m_dataInputImage.height()*m_dataInputImage.width()) <= 16384))) {
+ if ((file.size() <= m_dataMemorySize) || ((m_dataIsImage) && ((m_dataInputImage.height()*m_dataInputImage.width()) <= m_dataMemorySize))) {
m_base->dataProcessingProgressBar->setTotalSteps(0);
m_base->dataProcessingProgressBar->setProgress(0);
@@ -1472,23 +1493,21 @@ void FPGAViewPart::updateDisplay() {
m_socket->writeBlock("M\r", 2);
m_socket->writeBufferedData();
int len = m_dataByteArray.size();
- int txlen = 16384;
+ int txlen = m_dataMemorySize;
if (len >= txlen) {
len = txlen;
}
- TQByteArray dataToSend(16384*2);
+ TQByteArray dataToSend(m_dataMemorySize);
for (i=0; i<len; i++) {
- dataToSend[(i*2)+0] = m_dataByteArray[i];
- dataToSend[(i*2)+1] = '\r';
+ dataToSend[i] = m_dataByteArray[i];
}
for (; i<txlen; i++) {
- dataToSend[(i*2)+0] = 0;
- dataToSend[(i*2)+1] = '\r';
+ dataToSend[i] = 0;
}
- m_base->dataProcessingProgressBar->setTotalSteps(txlen*4);
+ m_base->dataProcessingProgressBar->setTotalSteps(txlen*2);
m_base->dataProcessingProgressBar->setProgress(0);
int offset = 0;
- while (offset < (txlen*2)) {
+ while (offset < txlen) {
m_socket->writeBlock(dataToSend.data()+offset, 1024);
m_socket->writeBufferedData();
offset = offset + 1024;
@@ -1553,13 +1572,13 @@ void FPGAViewPart::updateDisplay() {
}
}
else if (m_commHandlerState == 2) {
- if (m_socket->bytesAvailable() >= 16384) {
- TQByteArray recData(16384);
+ if (m_socket->bytesAvailable() >= m_dataMemorySize) {
+ TQByteArray recData(m_dataMemorySize);
int offset = 0;
- while (offset < 16384) {
+ while (offset < m_dataMemorySize) {
m_socket->readBlock(recData.data()+offset, 1024);
offset = offset + 1024;
- m_base->dataProcessingProgressBar->setProgress((16384*2) + offset);
+ m_base->dataProcessingProgressBar->setProgress((m_dataMemorySize*2) + offset);
}
m_base->dataProcessingStatusLabel->setText(i18n("Writing data to file") + "...");
diff --git a/clients/tde/src/part/fpgaview/part.h b/clients/tde/src/part/fpgaview/part.h
index b49ace2..81f74f7 100644
--- a/clients/tde/src/part/fpgaview/part.h
+++ b/clients/tde/src/part/fpgaview/part.h
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (c) 2012 Timothy Pearson
+ * (c) 2012-2013 Timothy Pearson
* Raptor Engineering
* http://www.raptorengineeringinc.com
*/
@@ -29,6 +29,8 @@
#include <tqframe.h>
#include <tqimage.h>
+#include <ksimpleconfig.h>
+
#include <tdeparts/browserextension.h>
#include <tdeparts/statusbarextension.h>
#include <tdeparts/part.h>
@@ -207,6 +209,7 @@ namespace RemoteLab
private:
FPGAViewBase* m_base;
TQMutex* m_connectionMutex;
+ KSimpleConfig* m_config;
TQTimer* m_updateTimer;
TQTimer* m_timeoutTimer;
@@ -247,6 +250,7 @@ namespace RemoteLab
TQImage m_dataInputImage;
TQFile* m_dataOutputFile;
TQByteArray m_dataByteArray;
+ int m_dataMemorySize;
ImageViewerWindow* m_inputImageViewer;
ImageViewerWindow* m_outputImageViewer;