From 1085d8888f3e1935e49ac54ab85630cf9c67c76f Mon Sep 17 00:00:00 2001 From: MALFREYT <alexandre.malfreyt@synchrotron-soleil.fr> Date: Fri, 21 Feb 2025 16:58:02 +0100 Subject: [PATCH] feat: add EnableRamps and WriteMemorizedValuesAtInit properties with default values (do nothing so far) --- doc/doc_html/Properties.html | 34 ++++++++- src/SingleShotAO.cpp | 31 ++++++++ src/SingleShotAO.h | 8 ++ src/SingleShotAOClass.cpp | 144 ++++++++++------------------------- 4 files changed, 109 insertions(+), 108 deletions(-) diff --git a/doc/doc_html/Properties.html b/doc/doc_html/Properties.html index 388a562..b0ca154 100755 --- a/doc/doc_html/Properties.html +++ b/doc/doc_html/Properties.html @@ -56,16 +56,34 @@ <Font Size=-1>Tango::DEV_STRING</Font> </Td> <Td> - <Font Size=-1>The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no - default value]</Font> + <Font Size=-1>The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]</Font> </Td> </Tr> - </Table> + <Tr> + <Td><b><a href=#Dev_DefaultValues>EnableRamps </a></b></Td> + <Td> + <Font Size=-1>Tango::DEV_BOOLEAN</Font> + </Td> + <Td> + <Font Size=-1>Whether to enable or disable the ramp generation on the board output channels. If false, the speedX and initialX dynamic attributes will not be created for every channel, and the changes will happen instantly. [true/false - default value is true]</Font> + </Td> + + </Tr> + <Tr> + <Td><b><a href=#Dev_DefaultValues>WriteMemorizedValuesAtInit </a></b></Td> + <Td> + <Font Size=-1>Tango::DEV_BOOLEAN</Font> + </Td> + <Td> + <Font Size=-1>Whether to write the memorized values to the board at the device initialization. [true/false - default value is false]</Font> + </Td> + </Tr> + </Table> + </Center> - <A name=Dev_DefaultValues><!--- ---></a> <Font Size=+1>Device Properties Default Values:</Font><Br> <Table Border=2 Cellpadding=2 CELLSPACING=2> <tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> @@ -80,6 +98,14 @@ <Td>BoardType</Td> <td>No default value</td> </Tr> + <Tr> + <Td>EnableRamps</Td> + <td>true</td> + </Tr> + <Tr> + <Td>WriteMemorizedValuesAtInit</Td> + <td>false</td> + </Tr> </Table> <Br><Br><Br> diff --git a/src/SingleShotAO.cpp b/src/SingleShotAO.cpp index 96a72ba..56cb44d 100755 --- a/src/SingleShotAO.cpp +++ b/src/SingleShotAO.cpp @@ -582,6 +582,8 @@ void SingleShotAO::get_device_property() Tango::DbData dev_prop; dev_prop.push_back(Tango::DbDatum("BoardNum")); dev_prop.push_back(Tango::DbDatum("BoardType")); + dev_prop.push_back(Tango::DbDatum("EnableRamps")); + dev_prop.push_back(Tango::DbDatum("WriteMemorizedValuesAtInit")); // Call database and extract values //-------------------------------------------- @@ -592,6 +594,7 @@ void SingleShotAO::get_device_property() SingleShotAOClass *ds_class = (static_cast<SingleShotAOClass *>(get_device_class())); int i = -1; + //- <BoardNum> ----------------------- // Try to initialize BoardNum from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> boardNum; @@ -603,6 +606,7 @@ void SingleShotAO::get_device_property() // And try to extract BoardNum value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardNum; + //- <BoardType> ----------------------- // Try to initialize BoardType from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> boardType; @@ -614,6 +618,33 @@ void SingleShotAO::get_device_property() // And try to extract BoardType value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardType; + //- <EnableRamps> ----------------------- + // Try to initialize EnableRamps from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty() == false) cl_prop >> enableRamps; + else + { + // Try to initialize EnableRamps from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty() == false) def_prop >> enableRamps; + } + // And try to extract EnableRamps value from database + if (dev_prop[i].is_empty() == false) dev_prop[i] >> enableRamps; + + //- <WriteMemorizedValuesAtInit> ----------------------- + // Try to initialize WriteMemorizedValuesAtInit from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty() == false) cl_prop >> writeMemorizedValuesAtInit; + else + { + // Try to initialize WriteMemorizedValuesAtInit from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty() == false) def_prop >> writeMemorizedValuesAtInit; + } + // And try to extract WriteMemorizedValuesAtInit value from database + if (dev_prop[i].is_empty() == false) dev_prop[i] >> writeMemorizedValuesAtInit; + + // Check critical properties being present //-------------------------------------------- diff --git a/src/SingleShotAO.h b/src/SingleShotAO.h index 7faa182..f77367e 100755 --- a/src/SingleShotAO.h +++ b/src/SingleShotAO.h @@ -110,6 +110,14 @@ public : * The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value] */ string boardType; +/** + * Whether to enable or disable the ramp generation on the board output channels. If false, the speedX and initialX dynamic attributes will not be created for every channel, and the changes will happen instantly. [true/false - default value is true] + */ + Tango::DevBoolean enableRamps; +/** + * Whether to write the memorized values to the board at the device initialization. [true/false - default value is false] + */ + Tango::DevBoolean writeMemorizedValuesAtInit; //@} /** diff --git a/src/SingleShotAOClass.cpp b/src/SingleShotAOClass.cpp index e93187a..87816eb 100755 --- a/src/SingleShotAOClass.cpp +++ b/src/SingleShotAOClass.cpp @@ -369,10 +369,14 @@ void SingleShotAOClass::set_default_property() string prop_def; vector<string> vect_data; + // Set Default Class Properties + // ... + // Set Default Device Properties + //- <BoardNum> ----------------------- prop_name = "BoardNum"; - prop_desc = "The the board identifier in the cPCI crate [valid range is 0...7 - no default value] ."; + prop_desc = "The board identifier in the cPCI crate [valid range is 0...7 - no default value]."; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -385,6 +389,7 @@ void SingleShotAOClass::set_default_property() else add_wiz_dev_prop(prop_name, prop_desc); + //- <BoardType> ----------------------- prop_name = "BoardType"; prop_desc = "The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]"; prop_def = ""; @@ -399,7 +404,40 @@ void SingleShotAOClass::set_default_property() else add_wiz_dev_prop(prop_name, prop_desc); + //- <EnableRamps> ----------------------- + prop_name = "EnableRamps"; + prop_desc = "Whether to enable or disable the ramp generation on the board output channels. If false, the speedX and initialX dynamic attributes will not be created for every channel, and the changes will happen instantly. [true/false - default value is true]"; + prop_def = "true"; + vect_data.clear(); + vect_data.push_back("true"); + if (prop_def.length() > 0) + { + Tango::DbDatum data(prop_name); + data << vect_data; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + //- <WriteMemorizedValuesAt> ----------------------- + prop_name = "WriteMemorizedValuesAtInit"; + prop_desc = "Whether to write the memorized values to the board at the device initialization. [true/false - default value is false]"; + prop_def = "false"; + vect_data.clear(); + vect_data.push_back("false"); + if (prop_def.length() > 0) + { + Tango::DbDatum data(prop_name); + data << vect_data; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); } + + //+---------------------------------------------------------------------------- // // method : SingleShotAOClass::write_class_property @@ -431,107 +469,6 @@ void SingleShotAOClass::write_class_property() str_desc.push_back("ADLink boards support for single shot AO operations [PCI-6208 and compatible boards]"); description << str_desc; data.push_back(description); - - // put cvs or svn location - string filename(classname); - filename += "Class.cpp"; - - // Create a string with the class ID to - // get the string into the binary - string class_id(ClassId); - - // check for cvs information - string src_path(CvsPath); - start = src_path.find("/"); - if (start!=string::npos) - { - end = src_path.find(filename); - if (end>start) - { - string strloc = src_path.substr(start, end-start); - // Check if specific repository - start = strloc.find("/cvsroot/"); - if (start!=string::npos && start>0) - { - string repository = strloc.substr(0, start); - if (repository.find("/segfs/")!=string::npos) - strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); - } - Tango::DbDatum cvs_loc("cvs_location"); - cvs_loc << strloc; - data.push_back(cvs_loc); - } - } - // check for svn information - else - { - string src_path(SvnPath); - start = src_path.find("://"); - if (start!=string::npos) - { - end = src_path.find(filename); - if (end>start) - { - header = "$HeadURL: "; - start = header.length(); - string strloc = src_path.substr(start, (end-start)); - - Tango::DbDatum svn_loc("svn_location"); - svn_loc << strloc; - data.push_back(svn_loc); - } - } - } - - // Get CVS or SVN revision tag - - // CVS tag - string tagname(TagName); - header = "$Name: "; - start = header.length(); - string endstr(" $"); - - end = tagname.find(endstr); - if (end!=string::npos && end>start) - { - string strtag = tagname.substr(start, end-start); - Tango::DbDatum cvs_tag("cvs_tag"); - cvs_tag << strtag; - data.push_back(cvs_tag); - } - - // SVN tag - string svnpath(SvnPath); - header = "$HeadURL: "; - start = header.length(); - - end = svnpath.find(endstr); - if (end!=string::npos && end>start) - { - string strloc = svnpath.substr(start, end-start); - - string tagstr ("/tags/"); - start = strloc.find(tagstr); - if ( start!=string::npos ) - { - start = start + tagstr.length(); - end = strloc.find(filename); - string strtag = strloc.substr(start, end-start-1); - - Tango::DbDatum svn_tag("svn_tag"); - svn_tag << strtag; - data.push_back(svn_tag); - } - } - - // Get URL location - string httpServ(HttpServer); - if (httpServ.length()>0) - { - Tango::DbDatum db_doc_url("doc_url"); - db_doc_url << httpServ; - data.push_back(db_doc_url); - } // Put inheritance Tango::DbDatum inher_datum("InheritedFrom"); @@ -540,8 +477,7 @@ void SingleShotAOClass::write_class_property() inher_datum << inheritance; data.push_back(inher_datum); - // Call database and and values - //-------------------------------------------- + // Call database and add values get_db_class()->put_property(data); } -- GitLab