Changeset 18464
- Timestamp:
- 03/26/16 12:00:52 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/feedback.cc
r18337 r18464 118 118 int HandleBiasNom(const EventImp &evt) 119 119 { 120 if (evt.GetSize()>= 416*sizeof(float))121 { 122 fVoltGapd.assign(evt.Ptr<float>(), evt.Ptr<float>()+ 416);123 fBiasR9.assign(evt.Ptr<float>()+2* 416, evt.Ptr<float>()+3*416);120 if (evt.GetSize()>=BIAS::kNumChannels*sizeof(float)) 121 { 122 fVoltGapd.assign(evt.Ptr<float>(), evt.Ptr<float>()+BIAS::kNumChannels); 123 fBiasR9.assign(evt.Ptr<float>()+2*BIAS::kNumChannels, evt.Ptr<float>()+3*BIAS::kNumChannels); 124 124 125 125 for (int i=0; i<320; i++) … … 134 134 int HandleBiasVoltage(const EventImp &evt) 135 135 { 136 if (evt.GetSize()>= 416*sizeof(float))137 fBiasVolt.assign(evt.Ptr<float>(), evt.Ptr<float>()+ 416);136 if (evt.GetSize()>=BIAS::kNumChannels*sizeof(float)) 137 fBiasVolt.assign(evt.Ptr<float>(), evt.Ptr<float>()+BIAS::kNumChannels); 138 138 return GetCurrentState(); 139 139 } … … 141 141 int HandleBiasDac(const EventImp &evt) 142 142 { 143 if (evt.GetSize()>= 416*sizeof(uint16_t))144 fBiasDac.assign(evt.Ptr<uint16_t>(), evt.Ptr<uint16_t>()+ 416);143 if (evt.GetSize()>=BIAS::kNumChannels*sizeof(uint16_t)) 144 fBiasDac.assign(evt.Ptr<uint16_t>(), evt.Ptr<uint16_t>()+BIAS::kNumChannels); 145 145 return GetCurrentState(); 146 146 } … … 231 231 { 232 232 uint32_t dac; 233 float U[ 416];234 float Iavg[ 416];235 float Irms[ 416];233 float U[BIAS::kNumChannels]; 234 float Iavg[BIAS::kNumChannels]; 235 float Irms[BIAS::kNumChannels]; 236 236 237 237 cal_data() { memset(this, 0, sizeof(cal_data)); } … … 240 240 cal_data cal; 241 241 cal.dac = dac; 242 memcpy(cal.U, fBiasVolt.data(), 416*sizeof(float));243 memcpy(cal.Iavg, avg.data(), 416*sizeof(float));244 memcpy(cal.Irms, rms.data(), 416*sizeof(float));242 memcpy(cal.U, fBiasVolt.data(), BIAS::kNumChannels*sizeof(float)); 243 memcpy(cal.Iavg, avg.data(), BIAS::kNumChannels*sizeof(float)); 244 memcpy(cal.Irms, rms.data(), BIAS::kNumChannels*sizeof(float)); 245 245 246 246 fDimCalibration2.setData(cal); … … 255 255 fCurrentsRms.assign(BIAS::kNumChannels, 0); 256 256 257 Dim::SendCommandNB("BIAS_CONTROL/SET_GLOBAL_DAC", uint 32_t(256+512*fCalibStep));257 Dim::SendCommandNB("BIAS_CONTROL/SET_GLOBAL_DAC", uint16_t(256+512*fCalibStep)); 258 258 259 259 return GetCurrentState(); … … 409 409 Dim::SendCommandNB("FAD_CONTROL/CLOSE_ALL_OPEN_FILES"); 410 410 411 Error("Current limit for shutdown exceeded.... sw tching to standby mode.");411 Error("Current limit for shutdown exceeded.... switching to standby mode."); 412 412 413 413 standby = true; … … 490 490 return GetCurrentState(); 491 491 492 fCurrentsAvg.assign( 416, 0);493 fCurrentsRms.assign( 416, 0);492 fCurrentsAvg.assign(BIAS::kNumChannels, 0); 493 fCurrentsRms.assign(BIAS::kNumChannels, 0); 494 494 fCursorCur = 0; 495 495 … … 528 528 529 529 vector<double> med[3]; 530 med[0].resize( 416);531 med[1].resize( 416);532 med[2].resize( 416);530 med[0].resize(BIAS::kNumChannels); 531 med[1].resize(BIAS::kNumChannels); 532 med[2].resize(BIAS::kNumChannels); 533 533 534 534 struct dim_data 535 535 { 536 float I[ 416];536 float I[BIAS::kNumChannels]; 537 537 float Iavg; 538 538 float Irms; … … 541 541 uint32_t N; 542 542 float Tdiff; 543 float Uov[ 416];543 float Uov[BIAS::kNumChannels]; 544 544 float Unom; 545 545 float dUtemp; … … 555 555 data.dUtemp = fTempOffsetAvg; 556 556 557 vector<float> vec( 416);557 vector<float> vec(BIAS::kNumChannels); 558 558 559 559 // ================================= old ======================= … … 996 996 fTimeCalib = Time(); 997 997 998 Dim::SendCommandNB("BIAS_CONTROL/SET_GLOBAL_DAC", uint 32_t(256+512*fCalibStep));998 Dim::SendCommandNB("BIAS_CONTROL/SET_GLOBAL_DAC", uint16_t(256+512*fCalibStep)); 999 999 1000 1000 return Feedback::State::kCalibrating; … … 1044 1044 bool LoadOffsets(const string &file) 1045 1045 { 1046 vector<double> data( 416);1046 vector<double> data(BIAS::kNumChannels); 1047 1047 1048 1048 ifstream fin(file); … … 1075 1075 int ResetOffset() 1076 1076 { 1077 fVoltOffset.assign( 416, 0);1077 fVoltOffset.assign(BIAS::kNumChannels, 0); 1078 1078 1079 1079 fDimOffsets.Update(fVoltOffset); … … 1201 1201 "Offsets operation voltages" 1202 1202 "|U[V]:Offset per bias channels"), 1203 fVoltOffset( 416),1203 fVoltOffset(BIAS::kNumChannels), 1204 1204 fMoonMode(0), 1205 1205 fCurrentRequestInterval(0),
Note:
See TracChangeset
for help on using the changeset viewer.