diff --git a/src/ContinuousAO.cpp b/src/ContinuousAO.cpp index 498402a188e020d7c1426c2076aacb417b644cf5..4181dcffb48c4eeeb328da21d84c1eaacb0f4456 100644 --- a/src/ContinuousAO.cpp +++ b/src/ContinuousAO.cpp @@ -1,4 +1,4 @@ -static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/ContinuousAO/src/ContinuousAO.cpp,v 1.3 2004-12-09 16:50:47 abeilleg Exp $"; +static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/ContinuousAO/src/ContinuousAO.cpp,v 1.4 2004-12-21 13:06:59 abeilleg Exp $"; //+============================================================================= // // file : ContinuousAO.cpp @@ -13,15 +13,9 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/AD // // $Author: abeilleg $ // -// $Revision: 1.3 $ +// $Revision: 1.4 $ // // $Log: not supported by cvs2svn $ -// Revision 1.2 2004/12/09 16:40:28 abeilleg -// minor changes -// -// Revision 1.1.1.1 2004/12/06 10:20:44 syldup -// initial import -// // // copyleft : Synchrotron SOLEIL // L'Orme des Merisiers @@ -282,7 +276,7 @@ void ContinuousAO::init_device() } } //- active/config. channel 1 - if(channel1Enable) + if(channel1Enable) { ac.id = 1; if(aORefSource == adl::external_reference) @@ -386,13 +380,13 @@ void ContinuousAO::init_device() if(channel4Waveform.empty()) { WARN_STREAM<<"No waveform is saved in database for channel 4, using a default one"<<endl; - config.set_channel_periodic_data(4, default_waveformA); + config.set_channel_periodic_data(4, default_waveformB); } else if(channel4Waveform.size() != bufferDepth) { WARN_STREAM<<"The waveform saved in database for channel 4 has a different size from property BufferDepth, "<< "using default waveform"<<endl; - config.set_channel_periodic_data(4, default_waveformA); + config.set_channel_periodic_data(4, default_waveformB); } else //put waveform of the Tango database in ch4 { @@ -413,7 +407,29 @@ void ContinuousAO::init_device() if(aORefSource == adl::external_reference) ac.volt_ref = aORefB; config.add_active_channel(ac); - config.set_channel_periodic_data(5, default_waveformB); + + if(channel5Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 5, using a default one"<<endl; + config.set_channel_periodic_data(5, default_waveformB); + } + else if(channel5Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 5 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + config.set_channel_periodic_data(5, default_waveformB); + } + else //put waveform of the Tango database in ch5 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel5Waveform[i]; + // put the waveform in the configuration + config.set_channel_periodic_data(5, data); + //cpy data in the attribute of the device + ::memcpy(ch5, data.base(), data.size()); + } } //- active/config. channel 6 if(channel6Enable) @@ -426,13 +442,13 @@ void ContinuousAO::init_device() if(channel6Waveform.empty()) { WARN_STREAM<<"No waveform is saved in database for channel 6, using a default one"<<endl; - config.set_channel_periodic_data(6, default_waveformA); + config.set_channel_periodic_data(6, default_waveformB); } else if(channel6Waveform.size() != bufferDepth) { WARN_STREAM<<"The waveform saved in database for channel 6 has a different size from property BufferDepth, "<< "using default waveform"<<endl; - config.set_channel_periodic_data(6, default_waveformA); + config.set_channel_periodic_data(6, default_waveformB); } else //put waveform of the Tango database in ch6 { @@ -457,13 +473,13 @@ void ContinuousAO::init_device() if(channel7Waveform.empty()) { WARN_STREAM<<"No waveform is saved in database for channel 7, using a default one"<<endl; - config.set_channel_periodic_data(7, default_waveformA); + config.set_channel_periodic_data(7, default_waveformB); } else if(channel7Waveform.size() != bufferDepth) { WARN_STREAM<<"The waveform saved in database for channel 7 has a different size from property BufferDepth, "<< "using default waveform"<<endl; - config.set_channel_periodic_data(7, default_waveformA); + config.set_channel_periodic_data(7, default_waveformB); } else //put waveform of the Tango database in ch7 { @@ -510,21 +526,23 @@ void ContinuousAO::init_device() config.set_output_rate(frequency); DEBUG_STREAM<<"ContinuousAO::init_device : init acq"<<std::endl; - _ASL_TRY_ACTION + _ASL_TRY //_ACTION ( ao->init(adl::DAQ2502, boardNum), "init", - "ContinuousAO::init_device", - this->set_internal_state() + "ContinuousAO::init_device" //, + // this->set_internal_state() ); + + //ao->configure(config); DEBUG_STREAM<<"ContinuousAO::init_device : config acq"<<std::endl; - _ASL_TRY_ACTION + _ASL_TRY //_ACTION ( ao->configure(config), "configure", - "ContinuousAO::init_device", - this->set_internal_state() + "ContinuousAO::init_device" //, + //this->set_internal_state() ); @@ -984,16 +1002,6 @@ void ContinuousAO::get_device_property() WARN_STREAM<<"BufferDepth property is not set in database, loading default value in database:" <<bufferDepth<<endl; } - - if (data[22].is_empty()==false) data[21] >> channel0Waveform; - if (data[23].is_empty()==false) data[22] >> channel1Waveform; - if (data[24].is_empty()==false) data[23] >> channel2Waveform; - if (data[25].is_empty()==false) data[24] >> channel3Waveform; - if (data[26].is_empty()==false) data[25] >> channel4Waveform; - if (data[27].is_empty()==false) data[26] >> channel5Waveform; - if (data[28].is_empty()==false) data[27] >> channel6Waveform; - if (data[29].is_empty()==false) data[28] >> channel7Waveform; - //update database for not initiliazed properties get_db_device()->put_property(data_put); } @@ -1314,12 +1322,13 @@ void ContinuousAO::set_internal_state(void) this->set_status("The acquisition is stopped"); break; case asl::ContinuousAO::RUNNING: - case asl::ContinuousAO::RESTARTING: + // case asl::ContinuousAO::RESTARTING: case asl::ContinuousAO::ABORTING: this->set_state(Tango::RUNNING); this->set_status("The acquisition is running"); break; case asl::ContinuousAO::UNKNOWN: + case asl::ContinuousAO::FAULT: default: this->set_state(Tango::UNKNOWN); this->set_status("The acquisition is in an unknown state");