From 20304e8304a96897068420d94c9153e96301fd3f Mon Sep 17 00:00:00 2001
From: Pieter Donker <donker@astron.nl>
Date: Mon, 18 Jan 2010 16:24:56 +0000
Subject: [PATCH] Bug 335: changed rcu init start order

---
 MAC/APL/PAC/Cal_Server/src/CalServer.cc | 38 ++++++++++++++-----------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/MAC/APL/PAC/Cal_Server/src/CalServer.cc b/MAC/APL/PAC/Cal_Server/src/CalServer.cc
index 7cb3b7cf351..f789b4a2e64 100644
--- a/MAC/APL/PAC/Cal_Server/src/CalServer.cc
+++ b/MAC/APL/PAC/Cal_Server/src/CalServer.cc
@@ -617,19 +617,37 @@ GCFEvent::TResult CalServer::handle_cal_start(GCFEvent& e, GCFPortInterface &por
 
 			m_subarrays.schedule_add(subarray);
 
-			// calibration will start within one second
-
 
 			_enableRCUs(subarray);
 
 
+			bitset<MEPHeader::MAX_N_RCUS> validmask;
+			
+			for (int rcu = 0; rcu < m_n_rcus; ++rcu) {
+				validmask.set(rcu);   // select rcu
+			}
+			
+			// calibration will start within one second
+			// set the spectral inversion right
+			// prepare RSP command
+			RSPSetbypassEvent	specInvCmd;
+			bool				SIon(start.rcumode()(0).getNyquistZone() == 2);// on or off?
+			specInvCmd.timestamp = Timestamp(0,0);
+			specInvCmd.rcumask   = start.subset & validmask;
+			specInvCmd.settings().resize(1);
+			specInvCmd.settings()(0).setXSI(SIon);
+			specInvCmd.settings()(0).setYSI(SIon);
+			LOG_DEBUG_STR("NyquistZone = " << start.rcumode()(0).getNyquistZone() 
+							<< " setting spectral inversion " << ((SIon) ? "ON" : "OFF"));
+			m_rspdriver.send(specInvCmd);
+
+
 			//
 			// set the control register of the RCU's 
 			// if in HBA mode turn on HBAs in groups to prevent resetting of boards
 			// 
+			
 			RSPSetrcuEvent setrcu;
-
-			bitset<MEPHeader::MAX_N_RCUS> validmask;
 			bitset<MEPHeader::MAX_N_RCUS> testmask;
 			Timestamp timeStamp;
 			
@@ -676,18 +694,6 @@ GCFEvent::TResult CalServer::handle_cal_start(GCFEvent& e, GCFPortInterface &por
 				}
 			}
 
-			// set the spectral inversion right
-			// prepare RSP command
-			RSPSetbypassEvent	specInvCmd;
-			bool				SIon(start.rcumode()(0).getNyquistZone() == 2);// on or off?
-			specInvCmd.timestamp = Timestamp(0,0);
-			specInvCmd.rcumask   = setrcu.rcumask;
-			specInvCmd.settings().resize(1);
-			specInvCmd.settings()(0).setXSI(SIon);
-			specInvCmd.settings()(0).setYSI(SIon);
-			LOG_DEBUG_STR("NyquistZone = " << start.rcumode()(0).getNyquistZone() 
-							<< " setting spectral inversion " << ((SIon) ? "ON" : "OFF"));
-			m_rspdriver.send(specInvCmd);
 		}
 	}
 	port.send(ack); // send ack
-- 
GitLab