Skip to content
Snippets Groups Projects
Commit d1c1098e authored by Sonia Minolli's avatar Sonia Minolli
Browse files

Input buffer size update for callback mode (CPPAPIS-18)

parent 03887fa8
No related branches found
No related tags found
No related merge requests found
...@@ -163,10 +163,21 @@ void BufferedEventCounting::configure(void) ...@@ -163,10 +163,21 @@ void BufferedEventCounting::configure(void)
//-------------------------configure acquisition buffer------------------------------------------- //-------------------------configure acquisition buffer-------------------------------------------
if (this->use_callback_) if (this->use_callback_)
{
// In DMA mode, if samples number = total number of points, configure
// input buffer size with 2 * total_nb_pts_, because input buffer size
// should be strictly above total_nb_pts_ in callback mode
if ((this->data_transfer_ == ni::dma) &&
(this->nb_samples_ == this->total_nb_pts_))
{
err = DAQmxCfgInputBuffer(this->task_handle_, 2 * this->total_nb_pts_);
}
else
{ {
// Configure the input buffer size with the total number of point to be received // Configure the input buffer size with the total number of point to be received
err = DAQmxCfgInputBuffer(this->task_handle_, this->total_nb_pts_); err = DAQmxCfgInputBuffer(this->task_handle_, this->total_nb_pts_);
} }
}
else else
{ {
err = DAQmxCfgInputBuffer(this->task_handle_, this->nb_samples_); err = DAQmxCfgInputBuffer(this->task_handle_, this->nb_samples_);
......
...@@ -162,10 +162,21 @@ void BufferedPositionMeasurement::configure (void) ...@@ -162,10 +162,21 @@ void BufferedPositionMeasurement::configure (void)
//-------------------------configure buffer------------------------------------------- //-------------------------configure buffer-------------------------------------------
//std::cout<<<<"BufferedPositionMeasurement::config buffer"<<std::endl; //std::cout<<<<"BufferedPositionMeasurement::config buffer"<<std::endl;
if (this->use_callback_) if (this->use_callback_)
{
// In DMA mode, if samples number = total number of points, configure
// input buffer size with 2 * total_nb_pts_, because input buffer size
// should be strictly above total_nb_pts_ in callback mode
if ((this->data_transfer_ == ni::dma) &&
(this->nb_samples_ == this->total_nb_pts_))
{
err = DAQmxCfgInputBuffer(this->task_handle_, 2 * this->total_nb_pts_);
}
else
{ {
// Configure the input buffer size with the total number of point to be received // Configure the input buffer size with the total number of point to be received
err = DAQmxCfgInputBuffer(this->task_handle_, this->total_nb_pts_); err = DAQmxCfgInputBuffer(this->task_handle_, this->total_nb_pts_);
} }
}
else else
{ {
err = DAQmxCfgInputBuffer(this->task_handle_, this->nb_samples_); err = DAQmxCfgInputBuffer(this->task_handle_, this->nb_samples_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment