Commit effe13a7 authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

Add property ReferenceSwitch to change homing behavior

parent 62ce8d9a
...@@ -704,7 +704,7 @@ void PiMercury::get_device_property() ...@@ -704,7 +704,7 @@ void PiMercury::get_device_property()
dev_prop.push_back(Tango::DbDatum("UseGCS")); dev_prop.push_back(Tango::DbDatum("UseGCS"));
dev_prop.push_back(Tango::DbDatum("AxisConfFile")); dev_prop.push_back(Tango::DbDatum("AxisConfFile"));
dev_prop.push_back(Tango::DbDatum("C_863_10_new")); dev_prop.push_back(Tango::DbDatum("C_863_10_new"));
dev_prop.push_back(Tango::DbDatum("NoReferenceSwitch")); dev_prop.push_back(Tango::DbDatum("ReferenceSwitch"));
// Call database and extract values // Call database and extract values
//-------------------------------------------- //--------------------------------------------
...@@ -946,16 +946,16 @@ void PiMercury::get_device_property() ...@@ -946,16 +946,16 @@ void PiMercury::get_device_property()
// And try to extract C_863_10_new value from database // And try to extract C_863_10_new value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> c_863_10_new; if (dev_prop[i].is_empty()==false) dev_prop[i] >> c_863_10_new;
// Try to initialize NoReferenceSwitch from class property // Try to initialize ReferenceSwitch from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name); cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> noReferenceSwitch; if (cl_prop.is_empty()==false) cl_prop >> referenceSwitch;
else { else {
// Try to initialize NoReferenceSwitch from default device value // Try to initialize ReferenceSwitch from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name); def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty()==false) def_prop >> noReferenceSwitch; if (def_prop.is_empty()==false) def_prop >> referenceSwitch;
} }
// And try to extract NoReferenceSwitch value from database // And try to extract ReferenceSwitch value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> noReferenceSwitch; if (dev_prop[i].is_empty()==false) dev_prop[i] >> referenceSwitch;
...@@ -2677,7 +2677,7 @@ void PiMercury::go_home() ...@@ -2677,7 +2677,7 @@ void PiMercury::go_home()
char temp_c[32]; char temp_c[32];
if(!noReferenceSwitch) if(referenceSwitch == -1)
{ {
//look for reference switch //look for reference switch
if(c_86x_type != C_863_11) if(c_86x_type != C_863_11)
...@@ -2692,7 +2692,33 @@ void PiMercury::go_home() ...@@ -2692,7 +2692,33 @@ void PiMercury::go_home()
(const char *) "PiMercury::go_home()", Tango::ERR); (const char *) "PiMercury::go_home()", Tango::ERR);
} }
} }
else else if(referenceSwitch == 0)
{
if(c_86x_type != C_863_11)
{
//find edge with argument 0: positive switch
sprintf(temp_c,"%d",0);
if(WriteReadMercury(CMD_FIND_EDGE,temp_c,resp, false) < 0)
{
Tango::Except::throw_exception(
(const char *) "Command failed",
resp,
(const char *) "PiMercury::go_home()", Tango::ERR);
}
}
else
{
//look for positive switch
if(WriteReadMercury(CMD_11_FIND_EDGE_POS,"",resp, false) < 0)
{
Tango::Except::throw_exception(
(const char *) "Command failed",
resp,
(const char *) "PiMercury::go_home()", Tango::ERR);
}
}
}
else //if(referenceSwitch == 1)
{ {
if(c_86x_type != C_863_11) if(c_86x_type != C_863_11)
{ {
......
...@@ -393,9 +393,11 @@ public : ...@@ -393,9 +393,11 @@ public :
*/ */
Tango::DevBoolean c_863_10_new; Tango::DevBoolean c_863_10_new;
/** /**
* No Reference Switch present for homing * -1: use Reference Switch for homing
* 0: no Reference Switch, find edge in positive dir
* 1: no Reference Switch, find edge in negative dir
*/ */
Tango::DevBoolean noReferenceSwitch; Tango::DevLong referenceSwitch;
//@} //@}
/**@name Constructors /**@name Constructors
......
...@@ -1146,9 +1146,9 @@ void PiMercuryClass::set_default_property() ...@@ -1146,9 +1146,9 @@ void PiMercuryClass::set_default_property()
else else
add_wiz_dev_prop(prop_name, prop_desc); add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "NoReferenceSwitch"; prop_name = "ReferenceSwitch";
prop_desc = "No Reference Switch present for homing"; prop_desc = "-1: use Reference Switch for homing\n0: no Reference Switch, find edge in positive dir\n1: no Reference Switch, find edge in negative dir";
prop_def = "false"; prop_def = "-1";
if (prop_def.length()>0) if (prop_def.length()>0)
{ {
Tango::DbDatum data(prop_name); Tango::DbDatum data(prop_name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment