From eb96cb6efd59d895e999a3b483cbbabb03ba83a9 Mon Sep 17 00:00:00 2001 From: jsiegle <jsiegle@mit.edu> Date: Wed, 22 Feb 2012 15:52:50 -0500 Subject: [PATCH] Added MessageManagerLock back to DataThread The DataThread shouldn't have a MML all the time, but it does need it when signaling that the data source is not found. Also fixed a line in the FilterViewport that was causing the enabled status of editors to fail to update. --- Source/Processors/DataThreads/DataThread.cpp | 6 ++++-- Source/Processors/DataThreads/IntanThread.cpp | 4 ++++ Source/Processors/SourceNode.cpp | 2 ++ Source/UI/FilterViewport.cpp | 6 +++--- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Source/Processors/DataThreads/DataThread.cpp b/Source/Processors/DataThreads/DataThread.cpp index cfaaf0890..7294f480c 100644 --- a/Source/Processors/DataThreads/DataThread.cpp +++ b/Source/Processors/DataThreads/DataThread.cpp @@ -38,12 +38,14 @@ void DataThread::run() { while (! threadShouldExit()) { - const ScopedLock sl (lock); + // const ScopedLock sl (lock); if (!updateBuffer()) { + + const MessageManagerLock mmLock (Thread::getCurrentThread()); + std::cout << "Aquisition error...stopping thread." << std::endl; signalThreadShouldExit(); - //stopAcquisition(); std::cout << "Notifying source node to stop acqusition." << std::endl; sn->acquisitionStopped(); } diff --git a/Source/Processors/DataThreads/IntanThread.cpp b/Source/Processors/DataThreads/IntanThread.cpp index 9de101002..6a1c88c13 100644 --- a/Source/Processors/DataThreads/IntanThread.cpp +++ b/Source/Processors/DataThreads/IntanThread.cpp @@ -58,6 +58,9 @@ float IntanThread::getSampleRate() bool IntanThread::foundInputSource() { + + //std::cout << "Checking for input source." << std::endl; + if (deviceFound) { int return_value; @@ -189,6 +192,7 @@ bool IntanThread::updateBuffer() if ((bytes_read = ftdi_read_data(&ftdic, buffer, sizeof(buffer))) < 0 && isTransmitting) { std::cout << "NO DATA FOUND!" << std::endl; + deviceFound = false; return false; } diff --git a/Source/Processors/SourceNode.cpp b/Source/Processors/SourceNode.cpp index ccce8bc42..c33752103 100644 --- a/Source/Processors/SourceNode.cpp +++ b/Source/Processors/SourceNode.cpp @@ -155,6 +155,7 @@ void SourceNode::timerCallback() //stopTimer(); // check for input source every two seconds enabledState(true); GenericEditor* ed = (GenericEditor*) getEditor(); + //ed->enable(); viewport->updateVisibleEditors(ed, 4); } } else { @@ -162,6 +163,7 @@ void SourceNode::timerCallback() std::cout << "No input source found." << std::endl; enabledState(false); GenericEditor* ed = (GenericEditor*) getEditor(); + //ed->disable(); viewport->updateVisibleEditors(ed, 4); } } diff --git a/Source/UI/FilterViewport.cpp b/Source/UI/FilterViewport.cpp index e827cba93..1d709f7a0 100644 --- a/Source/UI/FilterViewport.cpp +++ b/Source/UI/FilterViewport.cpp @@ -56,9 +56,9 @@ void FilterViewport::signalChainCanBeEdited(bool t) { canEdit = t; if (!canEdit) - std::cout << "Filter Viewport disabled."; + std::cout << "Filter Viewport disabled." << std::endl; else - std::cout << "Filter Viewport enabled."; + std::cout << "Filter Viewport enabled." << std::endl; } @@ -484,7 +484,7 @@ void FilterViewport::updateVisibleEditors(GenericEditor* activeEditor, int actio //std::cout << "OK1." << std::endl; // Step 5: check the validity of the signal chain - if (action < 4) { + if (action < 5) { bool enable = true; if (editorArray.size() == 1) { -- GitLab