Skip to content
Snippets Groups Projects
Commit cb1a424d authored by Sebastien Leport's avatar Sebastien Leport
Browse files

- add OS sleep between reading and writing command in write_read() method

- some changes in DevState() method
parent e0391a70
Branches
Tags
No related merge requests found
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000.cpp,v 1.11 2007-04-17 10:09:15 sebleport Exp $";
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000.cpp,v 1.12 2007-05-15 13:00:22 sebleport Exp $";
//+=============================================================================
//
// file : CYBERSTARx1000.cpp
......@@ -13,9 +13,12 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
//
// $Author: sebleport $
//
// $Revision: 1.11 $
// $Revision: 1.12 $
//
// $Log: not supported by cvs2svn $
// Revision 1.11 2007/04/17 10:09:15 sebleport
// further conditions to set the StandBy state
//
// Revision 1.10 2007/04/13 17:25:02 sebleport
// some changes in devstate() due to the interraction with the scan server device
//
......@@ -307,6 +310,8 @@ void CYBERSTARx1000::write_windowCenterPosition(Tango::WAttribute &attr)
{
// high threshold updating
attr_scaUpperThreshold_write = attr_windowCenterPosition_write + attr_windowWidth_write/2;
// converting
high_level = XString<double>::convertToString(attr_scaUpperThreshold_write);
if(attr_scaUpperThreshold_write<=10)
......@@ -732,11 +737,15 @@ void CYBERSTARx1000::write_windowCenterPosition(Tango::WAttribute &attr)
//- send command
mySerial->command_inout("DevSerWriteString", cmd_to_send.c_str(),nb_char_written);
omni_thread::sleep(0,250000000); // in nanoseconds -> 250 ms
mySerial->command_inout("DevSerWriteChar",LF,nb_char_written);
//- response expected
if (read_required)
{
omni_thread::sleep(0,250000000); // in nanoseconds -> 250 ms
long readMode = 2; //- SL_LINE : waits for LF (newline set in device Serial)
mySerial->command_inout("DevSerReadString", readMode, response);
}
......@@ -965,30 +974,46 @@ Tango::DevState CYBERSTARx1000::dev_state()
this->read_scaLowerThreshold(low_threshold);
this->read_scaUpperThreshold(high_threshold);
double borneLowerPlus = (this->attr_windowCenterPosition_write - this->attr_windowWidth_write/2)*(2 - (tolerance/100));
double borneLowerMoins = (this->attr_windowCenterPosition_write - this->attr_windowWidth_write/2)*tolerance/100 ;
double borneUpperPlus = (this->attr_windowCenterPosition_write + this->attr_windowWidth_write/2)*(2 - (tolerance/100));
double borneUpperMoins = (this->attr_windowCenterPosition_write + this->attr_windowWidth_write/2)*tolerance/100;
/*double borneLowerPlus = (this->attr_windowCenterPosition_write - this->attr_windowWidth_write/2) + tolerance ;
double borneLowerMoins = (this->attr_windowCenterPosition_write - this->attr_windowWidth_write/2)- tolerance ;
double borneUpperPlus = (this->attr_windowCenterPosition_write + this->attr_windowWidth_write/2) + tolerance ;
double borneUpperMoins = (this->attr_windowCenterPosition_write + this->attr_windowWidth_write/2)- tolerance ;*/
INFO_STREAM << "borne lower moins = " << XString<double>::convertToString(borneLowerMoins) << endl;
INFO_STREAM << "borne lower plus = " << XString<double>::convertToString(borneLowerPlus) << endl;
INFO_STREAM << "borne upper moins = " << XString<double>::convertToString(borneUpperMoins) << endl;
INFO_STREAM << "borne upper plus = " << XString<double>::convertToString(borneUpperPlus) << endl;
INFO_STREAM << " " << endl;
if(mySerial)
{
if((
*this->attr_scaLowerThreshold_read <= (this->attr_windowCenterPosition_write - this->attr_windowWidth_write/2)*(2 - (tolerance/100))
*this->attr_scaLowerThreshold_read <= borneLowerMoins
)
&&(
*this->attr_scaLowerThreshold_read >= (this->attr_windowCenterPosition_write - this->attr_windowWidth_write/2)*tolerance/100
||(
*this->attr_scaLowerThreshold_read >= borneLowerPlus
)
&&(
*this->attr_scaUpperThreshold_read <= (this->attr_windowCenterPosition_write + this->attr_windowWidth_write/2)*(2 - (tolerance/100))
||(
*this->attr_scaUpperThreshold_read <= borneUpperMoins
)
&&(
*this->attr_scaUpperThreshold_read >= (this->attr_windowCenterPosition_write + this->attr_windowWidth_write/2)*tolerance/100
||(
*this->attr_scaUpperThreshold_read >= borneUpperPlus
))
{
argout=Tango::STANDBY;
set_status("CYBERSTAR is waiting for request");
argout=Tango::RUNNING;
set_status("SCA threshold voltages are changing");
}
else
{
argout=Tango::RUNNING;
set_status("SCA threshold voltages are changing");
argout=Tango::STANDBY;
set_status("CYBERSTAR is waiting for request");
}
}
......
......@@ -8,9 +8,14 @@
//
// $Author: sebleport $
//
// $Revision: 1.9 $
// $Revision: 1.10 $
//
// $Log: not supported by cvs2svn $
// Revision 1.9 2007/04/24 16:22:52 sebleport
// polling attribute set to 10000 ms by default (POGO).
// the concerned attributes are:
// voltage, peakingTime, gain
//
// Revision 1.8 2007/04/13 17:25:02 sebleport
// some changes in devstate() due to the interraction with the scan server device
//
......@@ -56,12 +61,12 @@
#include "Xstring.h"
#include <math.h>
#include "DeviceProxyHelper.h"
#include "omnithread.h"
//using namespace Tango;
/**
* @author $Author: sebleport $
* @version $Revision: 1.9 $
* @version $Revision: 1.10 $
*/
// Add your own constants definitions here.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment