Skip to content
Snippets Groups Projects
Commit 2fbc7f47 authored by Alexandre MALFREYT's avatar Alexandre MALFREYT Committed by Florent LANGLOIS
Browse files

feat: deactive ramp functionnality if enableRamps is false (don't create speed...

feat: deactive ramp functionnality if enableRamps is false (don't create speed and initial attributes at init, and set changes instantly)
parent a1e6b1c7
No related branches found
No related tags found
2 merge requests!4develop -> main,!3EnableRamps and OutputMemorizedChannelsAtInit properties
......@@ -361,7 +361,7 @@ void SingleShotAO::init_device()
//--------------------------------------------
try
{
m_manager->init(m_ssao, m_nb_chan, m_frequency);
m_manager->init(m_ssao, m_nb_chan, m_frequency, enableRamps);
}
catch (Tango::DevFailed & df)
{
......@@ -443,6 +443,11 @@ void SingleShotAO::init_device()
l_dynAttrList.push_back(dai_channel);
// if enableRamps if false, skip speed and initial attributes
if (!enableRamps) {
DEBUG_STREAM << "Ramps are disabled. Skipping speed and initial attributes for channel " << l_cpt << std::endl;
continue;
}
// ╔═══════════════╗
// ║ Speed value ║
......@@ -535,12 +540,16 @@ void SingleShotAO::init_device()
};
// Get and set memorized values for speed, initial and channel
if (enableRamps) {
applyMemorizedAttr(kSPEED, &SingleShotAOManager::set_speed);
applyMemorizedAttr(kINITIAL, &SingleShotAOManager::set_initial);
if (writeMemorizedValuesAtInit)
applyMemorizedAttr(kCHANNEL, &SingleShotAOManager::write_channel);
else
applyMemorizedAttr(kCHANNEL, &SingleShotAOManager::set_channel);
}
if (writeMemorizedValuesAtInit) {
applyMemorizedAttr(kCHANNEL, &SingleShotAOManager::write_channel); // write memorized value to board output
} else {
applyMemorizedAttr(kCHANNEL, &SingleShotAOManager::set_channel); // only apply memorized value to the device
}
}
//- GO for task
......
......@@ -128,7 +128,7 @@ void SingleShotAOManager::write_frequency(double p_frequency)
// ============================================================================
// SingleShotAOManager::init ()
// ============================================================================
void SingleShotAOManager::init(asl::SingleShotAO * p_ssao, unsigned short p_nb_chan, double p_frequency)
void SingleShotAOManager::init(asl::SingleShotAO * p_ssao, unsigned short p_nb_chan, double p_frequency, bool p_enable_ramps)
{
m_ssao = p_ssao;
CHECK_SSAO();
......@@ -145,6 +145,8 @@ void SingleShotAOManager::init(asl::SingleShotAO * p_ssao, unsigned short p_nb_c
enable_periodic_msg(true);
}
m_enable_ramps = p_enable_ramps;
// initialize channel indexes (-1 means no ramp in progress)
// and ramp states
for (unsigned int l_cpt = 0; l_cpt < m_nb_chan; l_cpt++)
......@@ -288,7 +290,7 @@ void SingleShotAOManager::write_channel(ChannelId_t p_chIdx, double p_val)
DEBUG_STREAM << "write_channel " << p_chIdx << " : " << p_val << endl;
// if the speed is 0, write the value directly and skip ramp
if (m_speeds[p_chIdx] == 0.0)
if (m_speeds[p_chIdx] == 0.0 || !m_enable_ramps)
{
try
{
......@@ -409,6 +411,12 @@ void SingleShotAOManager::set_initial(ChannelId_t p_chIdx, Intial_t p_initial)
"could not write initial : a ramp is still in progress on this channel",
"SingleShotAOManager::set_initial");
}
else if (!m_enable_ramps)
{
THROW_DEVFAILED("DEVICE_FAILURE",
"could not write initial : ramps are disabled",
"SingleShotAOManager::set_initial");
}
else
{
m_initials[p_chIdx] = p_initial;
......@@ -434,6 +442,12 @@ void SingleShotAOManager::set_speed(ChannelId_t p_chIdx, Intial_t p_speed)
"could not write speed : a ramp is still in progress on this channel",
"SingleShotAOManager::set_speed");
}
else if (!m_enable_ramps)
{
THROW_DEVFAILED("DEVICE_FAILURE",
"could not write speed : ramps are disabled",
"SingleShotAOManager::set_speed");
}
else
{
m_speeds[p_chIdx] = p_speed;
......
......@@ -48,7 +48,7 @@ public:
std::string get_status ();
//- init
void init(asl::SingleShotAO * p_ssao, unsigned short p_nb_chan, double p_frequency);
void init(asl::SingleShotAO *p_ssao, unsigned short p_nb_chan, double p_frequency, bool p_enable_ramps);
//- get current channel value
double get_channel(ChannelId_t p_chIdx);
......@@ -101,6 +101,9 @@ private:
//- frequency
double m_frequency;
//-enable ramps
bool m_enable_ramps;
//- initial buffer for all channels
std::map<ChannelId_t, Intial_t> m_initials;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment