From 0ffb793cb56ec10a43ae241299b347bc4fef7b5c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 10 Jan 2014 23:13:22 -0600 Subject: Relayout the GUI to be more in line with expected norms Add user logic reset signal Stabilize data transfer --- clients/tde/src/part/fpgaview/layout.ui | 301 +++++++++++++++----------------- clients/tde/src/part/fpgaview/part.cpp | 61 +++++-- clients/tde/src/part/fpgaview/part.h | 2 + 3 files changed, 194 insertions(+), 170 deletions(-) (limited to 'clients') diff --git a/clients/tde/src/part/fpgaview/layout.ui b/clients/tde/src/part/fpgaview/layout.ui index e1803e1..95328ab 100644 --- a/clients/tde/src/part/fpgaview/layout.ui +++ b/clients/tde/src/part/fpgaview/layout.ui @@ -50,7 +50,7 @@ group8BitInput - + 8-Bit Input (Switches) @@ -96,10 +96,33 @@ group8BitInputLED0 - + + + unnamed_spacer + + + Horizontal + + + Expanding + + + + 0 + 0 + + + + group8BitInputValueText + + + + + AlignVCenter|AlignRight + @@ -154,10 +177,115 @@ group8BitOutputLED0 - + + + unnamed_spacer + + + Horizontal + + + Expanding + + + + 0 + 0 + + + + group8BitOutputValueText + + + + + AlignVCenter|AlignRight + + + + + + + group4BitOutput + + + 4-Bit Input (Buttons) + + + + unnamed_grid + + + + group4BitInputLED3 + + + + + group4BitInputLED2 + + + + + group4BitInputLED1 + + + + + group4BitInputLED0 + + + + + group4BitInputValueText + + + AlignVCenter|AlignRight + + + + + + + group4BitOutput + + + 4-Bit Output Values + + + + unnamed_grid + + + + group4BitOutputLED3 + + + + + group4BitOutputLED2 + + + + + group4BitOutputLED1 + + + + + group4BitOutputLED0 + + + + + group4BitOutputValueText + + + AlignVCenter|AlignRight + @@ -215,175 +343,30 @@ + + AlignVCenter|AlignRight + - + - group4BitInput + groupGlobalControl - Buttons: + Global Controls unnamed_grid - + - unnamed_layout + groupGlobalControlResetButton + + + Strobe User Logic Reset - - - unnamed_grid - - - - unnamed_layout - - - - unnamed_grid - - - - unnamed_spacer - - - Horizontal - - - Expanding - - - - 0 - 0 - - - - - - group4BitInputLED0 - - - - - unnamed_spacer - - - Horizontal - - - Expanding - - - - 0 - 0 - - - - - - - - group4BitInputLED3 - - - - - group4BitInputLED1 - - - - - unnamed_layout - - - - unnamed_grid - - - - unnamed_spacer - - - Horizontal - - - Expanding - - - - 0 - 0 - - - - - - group4BitInputLED2 - - - - - unnamed_spacer - - - Horizontal - - - Expanding - - - - 0 - 0 - - - - - - - - group4BitInputValueLabel - - - In: - - - AlignBottom|AlignLeft - - - - - group4BitOutputValueLabel - - - Out: - - - AlignTop|AlignLeft - - - - - group4BitInputValueText - - - AlignBottom|AlignRight - - - - - group4BitOutputValueText - - - AlignTop|AlignRight - - - diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp index 36809c2..d90eca4 100644 --- a/clients/tde/src/part/fpgaview/part.cpp +++ b/clients/tde/src/part/fpgaview/part.cpp @@ -589,7 +589,7 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj : RemoteInstrumentPart( parent, name ), m_base(NULL), m_interfaceMode(BasicInterfaceMode), 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_7segDigit2OutputValue(0xff), m_7segDigit1OutputValue(0xff), m_7segDigit0OutputValue(0xff), m_sendingUserLogicReset(false), m_batchOutputFile(NULL), m_dataOutputFile(NULL), m_dataMemorySize(16384), m_dataMemorySizePrev(0), m_dataMemoryImageWidth(128), m_dataMemoryImageHeight(128), m_inputImageViewer(NULL), m_outputImageViewer(NULL) @@ -637,15 +637,14 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj m_modeSubMenu->insert(m_modeAdvancedEnabled); // Initialize widgets - m_base->group4BitInputValueLabel->setFixedSize(LED_BASE_SIZE*2, LED_BASE_SIZE*2); - m_base->group4BitOutputValueLabel->setFixedSize(LED_BASE_SIZE*2, LED_BASE_SIZE*2); - m_base->group4BitInputValueText->setFixedSize(LED_BASE_SIZE*2, LED_BASE_SIZE*2); - m_base->group4BitOutputValueText->setFixedSize(LED_BASE_SIZE*2, LED_BASE_SIZE*2); - m_base->group4BitInputLED3->setFixedSize(LED_SIZE); m_base->group4BitInputLED2->setFixedSize(LED_SIZE); m_base->group4BitInputLED1->setFixedSize(LED_SIZE); m_base->group4BitInputLED0->setFixedSize(LED_SIZE); + m_base->group4BitOutputLED3->setFixedSize(LED_SIZE); + m_base->group4BitOutputLED2->setFixedSize(LED_SIZE); + m_base->group4BitOutputLED1->setFixedSize(LED_SIZE); + m_base->group4BitOutputLED0->setFixedSize(LED_SIZE); m_base->group8BitInputLED7->setFixedSize(LED_SIZE); m_base->group8BitInputLED6->setFixedSize(LED_SIZE); m_base->group8BitInputLED5->setFixedSize(LED_SIZE); @@ -667,6 +666,10 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj m_base->group4BitInputLED2->setState(KLed::Off); m_base->group4BitInputLED1->setState(KLed::Off); m_base->group4BitInputLED0->setState(KLed::Off); + m_base->group4BitOutputLED3->setState(KLed::Off); + m_base->group4BitOutputLED2->setState(KLed::Off); + m_base->group4BitOutputLED1->setState(KLed::Off); + m_base->group4BitOutputLED0->setState(KLed::Off); m_base->group8BitInputLED7->setState(KLed::Off); m_base->group8BitInputLED6->setState(KLed::Off); m_base->group8BitInputLED5->setState(KLed::Off); @@ -684,6 +687,10 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj m_base->group8BitOutputLED1->setState(KLed::Off); m_base->group8BitOutputLED0->setState(KLed::Off); + m_base->group4BitOutputLED3->setClickable(false); + m_base->group4BitOutputLED2->setClickable(false); + m_base->group4BitOutputLED1->setClickable(false); + m_base->group4BitOutputLED0->setClickable(false); m_base->group8BitOutputLED7->setClickable(false); m_base->group8BitOutputLED6->setClickable(false); m_base->group8BitOutputLED5->setClickable(false); @@ -693,6 +700,12 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj m_base->group8BitOutputLED1->setClickable(false); m_base->group8BitOutputLED0->setClickable(false); +#if 0 + TQFontMetrics group8BitTextMetrics(m_base->group8BitOutputValueText->font()); + m_base->group8BitInputValueText->setFixedSize(group8BitTextMetrics.width("0000"), group8BitTextMetrics.height()); + m_base->group8BitOutputValueText->setFixedSize(group8BitTextMetrics.width("0000"), group8BitTextMetrics.height()); +#endif + connect(m_base->group4BitInputLED3, SIGNAL(changed()), this, SLOT(process4BitInputChanges())); connect(m_base->group4BitInputLED2, SIGNAL(changed()), this, SLOT(process4BitInputChanges())); connect(m_base->group4BitInputLED1, SIGNAL(changed()), this, SLOT(process4BitInputChanges())); @@ -744,6 +757,7 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj m_base->LCDOutputLabel->setFixedSize(lcdwidth, lcdheight); m_base->frameLCDDisplay->setFrameStyle(TQFrame::Box | TQFrame::Raised); + connect(m_base->groupGlobalControlResetButton, SIGNAL(clicked()), this, SLOT(groupGlobalControlResetButtonClicked())); connect(m_base->batchTestRunButton, SIGNAL(clicked()), this, SLOT(batchTestRunButtonClicked())); connect(m_base->dataProcessingRunButton, SIGNAL(clicked()), this, SLOT(dataProcessingRunButtonClicked())); @@ -815,6 +829,12 @@ void FPGAViewPart::process4BitInputChanges() { } void FPGAViewPart::process4BitOutputChanges() { + // Write m_4bitOutputValue to LEDs + m_base->group4BitOutputLED3->setState((m_4bitOutputValue & 0x08)?KLed::On:KLed::Off); + m_base->group4BitOutputLED2->setState((m_4bitOutputValue & 0x04)?KLed::On:KLed::Off); + m_base->group4BitOutputLED1->setState((m_4bitOutputValue & 0x02)?KLed::On:KLed::Off); + m_base->group4BitOutputLED0->setState((m_4bitOutputValue & 0x01)?KLed::On:KLed::Off); + // Write m_4bitOutputValue to label m_base->group4BitOutputValueText->setText(TQString("0x%1").arg(m_4bitOutputValue, 0, 16)); } @@ -862,13 +882,13 @@ void FPGAViewPart::process8BitInputChanges() { m_base->group8BitInputLED0->setClickable(false); } - m_base->group8BitInputValueText->setText(TQString("0x%1").arg(m_8bitInputValue, 0, 16)); + m_base->group8BitInputValueText->setText(TQString("").sprintf("0x%02x", m_8bitInputValue)); if (m_remoteInputModeEnabled) { - m_base->group8BitInput->setTitle(i18n("8-Bit Input Values") + " [" + i18n("Remote Input Mode") + "]"); + m_base->group8BitInput->setTitle(i18n("8-Bit Input (Switches)") + " [" + i18n("Remote Input Mode") + "]"); } else { - m_base->group8BitInput->setTitle(i18n("8-Bit Input Values") + " [" + i18n("Local Input Mode") + "]"); + m_base->group8BitInput->setTitle(i18n("8-Bit Input (Switches)") + " [" + i18n("Local Input Mode") + "]"); } } @@ -895,7 +915,7 @@ void FPGAViewPart::process8BitOutputChanges() { m_base->group8BitOutputLED1->setState((m_8bitOutputValue & 0x02)?KLed::On:KLed::Off); m_base->group8BitOutputLED0->setState((m_8bitOutputValue & 0x01)?KLed::On:KLed::Off); - m_base->group8BitOutputValueText->setText(TQString("0x%1").arg(m_8bitOutputValue, 0, 16)); + m_base->group8BitOutputValueText->setText(TQString("").sprintf("0x%02x", m_8bitOutputValue)); } void FPGAViewPart::process16BitInputChanges() { @@ -905,7 +925,7 @@ void FPGAViewPart::process16BitInputChanges() { void FPGAViewPart::process16BitOutputChanges() { // Write m_16bitOutputValue to label - m_base->group16BitOutputValue->setText(TQString("0x%1").arg(m_16bitOutputValue, 0, 16)); + m_base->group16BitOutputValue->setText(TQString("").sprintf("0x%04x", m_16bitOutputValue)); } void FPGAViewPart::processLCDOutputChanges() { @@ -1012,6 +1032,7 @@ void FPGAViewPart::processLockouts() { m_base->batchTestOutputFile->setEnabled(false); m_base->batchTest16BitCheckBox->setEnabled(false); m_base->batchTestRunButton->setEnabled(false); + m_base->groupGlobalControlResetButton->setEnabled(false); } else { m_base->batchTestInputFile->setEnabled(true); @@ -1035,6 +1056,7 @@ void FPGAViewPart::processLockouts() { m_base->dataProcessingOutputFile->setEnabled(false); m_base->dataProcessingGenerateValidationString->setEnabled(false); m_base->dataProcessingRunButton->setEnabled(false); + m_base->groupGlobalControlResetButton->setEnabled(false); } else { m_base->dataProcessingInputFile->setEnabled(true); @@ -1047,6 +1069,7 @@ void FPGAViewPart::processLockouts() { if ((m_connectionActiveAndValid == true) && (m_commHandlerMode == 0)) { m_base->dataProcessingStatusLabel->setText(i18n("Ready")); + m_base->groupGlobalControlResetButton->setEnabled(!m_sendingUserLogicReset); } } @@ -1125,6 +1148,11 @@ TQPtrList FPGAViewPart::menuActionList() { return m_menuActionList; } +void FPGAViewPart::groupGlobalControlResetButtonClicked() { + m_sendingUserLogicReset = true; + processLockouts(); +} + void FPGAViewPart::batchTestRunButtonClicked() { m_commHandlerNextState = 0; m_commHandlerNextMode = 1; @@ -1166,6 +1194,17 @@ void FPGAViewPart::sendInputStatesToRemoteFPGA() { data[13] = '\r'; m_socket->writeBlock(data, 14); m_socket->writeBufferedData(); + + if (m_sendingUserLogicReset) { + // Send user logic reset request + data[0] = 'R'; + data[1] = '\r'; + m_socket->writeBlock(data, 2); + m_socket->writeBufferedData(); + + m_sendingUserLogicReset = false; + processLockouts(); + } } } diff --git a/clients/tde/src/part/fpgaview/part.h b/clients/tde/src/part/fpgaview/part.h index 8262689..3fb2732 100644 --- a/clients/tde/src/part/fpgaview/part.h +++ b/clients/tde/src/part/fpgaview/part.h @@ -199,6 +199,7 @@ namespace RemoteLab void processLCDOutputChanges(); void process7SegmentLEDOutputChanges(); + void groupGlobalControlResetButtonClicked(); void batchTestRunButtonClicked(); void dataProcessingRunButtonClicked(); @@ -239,6 +240,7 @@ namespace RemoteLab unsigned char m_7segDigit2OutputValue; unsigned char m_7segDigit1OutputValue; unsigned char m_7segDigit0OutputValue; + bool m_sendingUserLogicReset; UnsignedIntegerList m_batchInputValueList; UnsignedIntegerList m_batchOutputValueList; -- cgit v1.2.1