|
|
|
@ -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") + "...");
|
|
|
|
|