Skip to content

Commit c3a8a1d

Browse files
Fixed restarting detector from TrikStudio
1 parent d5486f2 commit c3a8a1d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

trikControl/src/cameraLineDetectorSensorWorker.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,12 @@ void CameraLineDetectorSensorWorker::openFifos()
213213
{
214214
qDebug() << "opening" << mOutputFile.fileName();
215215

216-
if (mOutputFileDescriptor == -1) {
217-
mOutputFileDescriptor = open(mOutputFile.fileName().toStdString().c_str(), O_SYNC | O_NONBLOCK, O_RDONLY);
216+
if (mInputFile.isOpen()) {
217+
mInputFile.close();
218218
}
219219

220+
mOutputFileDescriptor = open(mOutputFile.fileName().toStdString().c_str(), O_SYNC | O_NONBLOCK, O_RDONLY);
221+
220222
if (mOutputFileDescriptor == -1) {
221223
qDebug() << "Cannot open sensor output file " << mOutputFile.fileName();
222224
return;
@@ -264,4 +266,7 @@ void CameraLineDetectorSensorWorker::deinitialize()
264266
if (::close(mOutputFileDescriptor) != 0) {
265267
qDebug() << mOutputFile.fileName() << ": fifo close failed: " << errno;
266268
}
269+
270+
mOutputFileDescriptor = -1;
271+
mInputFile.close();
267272
}

0 commit comments

Comments
 (0)