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

Add try/catch for stop possible error (TANGODEVIC-787)

parent ebee51ce
Branches
Tags
No related merge requests found
......@@ -2227,6 +2227,7 @@ void PulseGeneration::stop()
this->set_internal_state()
);
}
_NI660XSL_TRY_ACTION
(
pulses->stop(),
......@@ -2236,9 +2237,18 @@ void PulseGeneration::stop()
);
// reconfigure everything here because when using a start trigger
// the start trigger in taken into account only when executing the first Start.
// the start trigger is taken into account only when executing the first Start.
try
{
this->init_counters();
}
catch(...)
{
// DAQmx 9.x abort pb workaround
ERROR_STREAM << "PulseGeneration::stop() - Releasing pulse object generates error, nothing to do..." << std::endl;
this->set_internal_state();
}
}
//+------------------------------------------------------------------
/**
......@@ -2254,13 +2264,16 @@ void PulseGeneration::abort()
{
DEBUG_STREAM << "PulseGeneration::abort(): entering... !" << endl;
_NI660XSL_TRY_ACTION
(
pulses->abort(),
"abort",
"PulseGeneration::abort",
this->set_internal_state()
);
try
{
pulses->abort();
}
catch(...)
{
// DAQmx 9.x abort pb workaround
ERROR_STREAM << "PulseGeneration::abort() - Aborting pulse object generates error, nothing to do..." << std::endl;
this->set_internal_state();
}
}
......@@ -2427,7 +2440,8 @@ void PulseGeneration::init_counters(void)
start_trigger->release();
}
previous_generation_type = generation_type;
}catch(...)
}
catch(...)
{
//ignore
INFO_STREAM << "FAILED to release start trigger" << endl;
......@@ -2550,14 +2564,17 @@ void PulseGeneration::init_counters(void)
{
if(delay[i]<MIN_VALUE_MSECS)
delay[i] = MIN_VALUE_MSECS;
if(pulse_width[i]<MIN_VALUE_MSECS)
pulse_width[i] = MIN_VALUE_MSECS;
string ctr = XString<int>::convertToString(i);
chan.chan_name = "/" + boardName + "/ctr" + ctr;
chan.initial_delay = initial_delay[i] / 1000.0;//secs
chan.low_time = delay[i] / 1000.0;//secs
chan.high_time = pulse_width[i] / 1000.0;//secs
pulses->add_time_channel(chan);
INFO_STREAM<<"configuring "<<chan.chan_name<<" with: ";
INFO_STREAM<<"delay"<<ctr<<": "<<delay[i]<<", ";
INFO_STREAM<<"pulse_width"<<ctr<<": "<<pulse_width[i]<<endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment