Skip to content

Commit

Permalink
Added ability to abort PIC captures. Reduced buffer sizes to minimize…
Browse files Browse the repository at this point in the history
… frame overrun
  • Loading branch information
simoninns committed Dec 26, 2017
1 parent 358ac37 commit a457eaf
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ bool transferRunning;
// (16 * 16384) = 256Kbytes
//
// Size of transfer queue =
// (256Kbytes) * 16 = 4Mbytes
// (128Kbytes) * 16 = 2Mbytes
//
// Size of each disk buffer =
// 4MBytes * 32 = 128Mbytes
// 2MBytes * 16 = 32Mbytes
//
// Total size of disk buffers =
// 128Mbytes * 4 = 512Mbytes
// 32Mbytes * 4 = 128Mbytes
//
#define REQUEST_SIZE 16
#define PACKET_SIZE 16384
#define QUEUE_DEPTH 16
#define QUEUE_BUFFERS_PER_DISK_BUFFER 16
#define NUMBER_OF_DISK_BUFFERS 4
#define QUEUE_BUFFERS_PER_DISK_BUFFER 32

// FPGA test mode status flag
static bool testModeFlag;
Expand Down
48 changes: 42 additions & 6 deletions Linux-Application/DomesdayDuplicator/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ MainWindow::MainWindow(QWidget *parent) :
clvPicNextState = clvPicCurrentState;

cavPicCaptureActive = false;
cavPicCaptureAbort = false;
cavPicPollTimer = new QTimer(this);
connect(cavPicPollTimer, SIGNAL(timeout()), this, SLOT(cavPicPoll()));
cavPicPollTimer->start(50); // Update 20 times a second

clvPicCaptureActive = false;
clvPicCaptureAbort = false;
clvPicPollTimer = new QTimer(this);
connect(clvPicPollTimer, SIGNAL(timeout()), this, SLOT(clvPicPoll()));
clvPicPollTimer->start(50); // Update 20 times a second
Expand Down Expand Up @@ -742,6 +744,12 @@ void MainWindow::cavPicPoll(void)
qDebug() << "MainWindow::cavPicPoll(): Player command error flagged - aborting";
cavPicNextState = cavState_error;
}

// Check for abort capture flag
if (cavPicCaptureAbort) {
qDebug() << "MainWindow::cavPicPoll(): Abort capture flag is set - stopping capture";
cavPicNextState = cavState_stopCapture;
}
break;

case cavState_stopCapture:
Expand All @@ -756,6 +764,7 @@ void MainWindow::cavPicPoll(void)
// Unlock the physical player controls
playerControl->command(lvdpControl::PlayerCommands::command_keyLockOff, 0);
lvdpPlayerControl->unlockAllPlayerControls();
ui->cavCapturePushButton->setText("Capture");

cavPicNextState = cavState_idle;
cavPicCaptureActive = false;
Expand All @@ -770,6 +779,7 @@ void MainWindow::cavPicPoll(void)
// Unlock the physical player controls
playerControl->command(lvdpControl::PlayerCommands::command_keyLockOff, 0);
lvdpPlayerControl->unlockAllPlayerControls();
ui->cavCapturePushButton->setText("Capture");

cavPicNextState = cavState_idle;
cavPicCaptureActive = false;
Expand Down Expand Up @@ -975,6 +985,12 @@ void MainWindow::clvPicPoll(void)
qDebug() << "MainWindow::clvPicPoll(): Player command error flagged - aborting";
clvPicNextState = clvState_error;
}

// Check for abort capture flag
if (clvPicCaptureAbort) {
qDebug() << "MainWindow::clvPicPoll(): Abort capture flag is set - stopping capture";
clvPicNextState = clvState_stopCapture;
}
break;

case clvState_stopCapture:
Expand All @@ -989,6 +1005,7 @@ void MainWindow::clvPicPoll(void)
// Unlock the physical player controls
playerControl->command(lvdpControl::PlayerCommands::command_keyLockOff, 0);
lvdpPlayerControl->unlockAllPlayerControls();
ui->clvCapturePushButton->setText("Capture");

clvPicNextState = clvState_idle;
clvPicCaptureActive = false;
Expand All @@ -1003,6 +1020,7 @@ void MainWindow::clvPicPoll(void)
// Unlock the physical player controls
playerControl->command(lvdpControl::PlayerCommands::command_keyLockOff, 0);
lvdpPlayerControl->unlockAllPlayerControls();
ui->clvCapturePushButton->setText("Capture");

clvPicNextState = clvState_idle;
clvPicCaptureActive = false;
Expand All @@ -1016,10 +1034,19 @@ void MainWindow::on_cavCapturePushButton_clicked()
// Ensure any command errors are cleared
playerControl->isLastCommandError();

// Start the CAV PIC capture
// Make sure the CLV PIC capture is not running
if (!clvPicCaptureActive) {
qDebug() << "MainWindow::on_cavCapturePushButton_clicked(): Starting CAV PIC capture";
cavPicCaptureActive = true;
if (!cavPicCaptureActive) {
// CAV capture not running... start it
qDebug() << "MainWindow::on_cavCapturePushButton_clicked(): Starting CAV PIC capture";
cavPicCaptureAbort = false;
cavPicCaptureActive = true;
ui->cavCapturePushButton->setText("Abort");
} else {
// CAV capture is running... abort
qDebug() << "MainWindow::on_cavCapturePushButton_clicked(): Aborting CAV PIC capture";
cavPicCaptureAbort = true;
}
} else {
qDebug() << "MainWindow::on_cavCapturePushButton_clicked(): Error - CLV PIC capture in progress";
}
Expand All @@ -1031,10 +1058,19 @@ void MainWindow::on_clvCapturePushButton_clicked()
// Ensure any command errors are cleared
playerControl->isLastCommandError();

// Start the CLV PIC capture
// Make sure the CAV PIC capture is not running
if (!cavPicCaptureActive) {
qDebug() << "MainWindow::on_clvCapturePushButton_clicked(): Starting CLV PIC capture";
clvPicCaptureActive = true;
if (!clvPicCaptureActive) {
// CAV capture not running... start it
qDebug() << "MainWindow::on_clvCapturePushButton_clicked(): Starting CLV PIC capture";
clvPicCaptureAbort = false;
clvPicCaptureActive = true;
ui->clvCapturePushButton->setText("Abort");
} else {
// CAV capture is running... abort
qDebug() << "MainWindow::on_clvCapturePushButton_clicked(): Aborting CLV PIC capture";
clvPicCaptureAbort = true;
}
} else {
qDebug() << "MainWindow::on_clvCapturePushButton_clicked(): Error - CAV PIC capture in progress";
}
Expand Down
2 changes: 2 additions & 0 deletions Linux-Application/DomesdayDuplicator/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private slots:
CavPicStates cavPicCurrentState;
CavPicStates cavPicNextState;
bool cavPicCaptureActive;
bool cavPicCaptureAbort;
QTimer* cavPicPollTimer;

// CLV PIC capture state-machine
Expand All @@ -150,6 +151,7 @@ private slots:
ClvPicStates clvPicCurrentState;
ClvPicStates clvPicNextState;
bool clvPicCaptureActive;
bool clvPicCaptureAbort;
QTimer* clvPicPollTimer;
};

Expand Down

0 comments on commit a457eaf

Please sign in to comment.