Index: fact/Evidence/Alarm.cc
===================================================================
--- fact/Evidence/Alarm.cc	(revision 10059)
+++ fact/Evidence/Alarm.cc	(revision 10068)
@@ -27,4 +27,5 @@
 
 const char* LevelStr[] = {"OK", "WARN", "ERROR", "FATAL", "UNAVAILABLE"};
+const int MIN_PERIOD = 5;  // Minimum period in seconds for checking servers are alive 
 
 //
@@ -38,5 +39,4 @@
 	char *AlarmText;
 	int MasterAlarm;
-	bool Active;
 
     void infoHandler();
@@ -56,4 +56,5 @@
 	};
 	vector<struct Item> List;
+	bool Active;
 
 	void UpdateAlarmSummary();
@@ -128,4 +129,7 @@
 void AlarmHandler::infoHandler() {
 
+  // Check if alarm server active
+  if (!Active) return;
+
   // Identify status service
   for (int i=0; i<List.size(); i++) if (getInfo() == List[i].Subscription) {
@@ -134,5 +138,5 @@
 	else {
 	  int Severity = atoi(ToString(getInfo()->getFormat(), getInfo()->getData(), getInfo()->getSize()).c_str());
-	  if (Severity > List[i].Level) List[i].Level = Severity;
+	  if ((Severity>List[i].Level) || (List[i].Level==4 && Severity==0)) List[i].Level = Severity;
 	}
   }
@@ -231,7 +235,8 @@
   // Static declaration ensures calling of destructor by exit()
   static AlarmHandler A; 
-  
+
+  // Verify periodically that servers exist (if Alarm is active)  
   while(!A.ExitRequest) {
-    for (int i=0; i<A.List.size(); i++) {
+    for (int i=0; i<A.List.size() && A.Active; i++) {
 	  // Check if server exists
       Exist = false;
@@ -242,10 +247,10 @@
 	  if (!Exist) A.List[i].Level = 4;
 
-	  // Check if standard service available in case server not yet chcked (Level is -1)
+	  // Check if standard service available in case server not yet checked (Level is -1)
 	  if (B.getServices((A.List[i].Server+"/VERSION_NUMBER").c_str())>0 && A.List[i].Level==-1) A.List[i].Level = 0;
-    }
+	}
     
-    A.UpdateAlarmSummary();
-    sleep(atoi(A.GetConfig("period").c_str()));
-  }
-}
+	A.UpdateAlarmSummary();
+	sleep(max(atoi(A.GetConfig("period").c_str()), MIN_PERIOD));
+  }
+}
Index: fact/Evidence/Edd/Edd.cc
===================================================================
--- fact/Evidence/Edd/Edd.cc	(revision 10059)
+++ fact/Evidence/Edd/Edd.cc	(revision 10068)
@@ -956,4 +956,5 @@
 
   Name = "drsdaq/EventData";
+  Active = false;
 
   Tmpfile = tmpfile();
@@ -980,5 +981,5 @@
     printf("Failed connection for %s\n", Name.toAscii().data());
   }
-  Handler->Subscribe(Name);
+  SetActive(true);
 }
 
@@ -986,5 +987,5 @@
 EventScope::~EventScope() {
 
-  Handler->Unsubscribe(Name);
+  SetActive(false);
   while (!List.isEmpty()) DeleteCurve(List.last().Signal);
   delete RD;
@@ -1091,5 +1092,5 @@
   
   // Only process if valid data in RawDataCTX class
-  if (ErrCode != CTX_OK) return;
+  if (!Active || ErrCode != CTX_OK) return;
   
   // Set x axis title
@@ -1161,4 +1162,13 @@
   }
 }
+
+// Set display active (if inactive, disconnect from server)
+void EventScope::SetActive(bool State) {
+
+  if (State && !Active) Handler->Subscribe("drsdaq/EventData");
+  if (!State && Active) Handler->Unsubscribe("drsdaq/EventData");
+  Active = State;
+}
+
 
 //------------------------------------------------------------------
@@ -1209,11 +1219,11 @@
   Plot->setMinimumWidth(400);
   for (int i=0; i<18; i++) {
-    Line = new EddLineDisplay("Bias/VOLT/ID00", i);
+    Line = new EddLineDisplay("Bias/VOLT/ID00", i+64);
     Layout->addWidget(Line, i%9+1, 0+i/9, 1, 1);
-    Plot->AddService("Bias/VOLT/ID00", i);
-
-    Line = new EddLineDisplay("Bias/VOLT/ID00", i+32);
+    Plot->AddService("Bias/VOLT/ID00", i+64);
+
+    Line = new EddLineDisplay("Bias/VOLT/ID00", i+96);
     Layout->addWidget(Line, i%9+1, 2+i/9, 1, 1);
-    Plot->AddService("Bias/VOLT/ID00",i+32);
+    Plot->AddService("Bias/VOLT/ID00",i+96);
   }
 
@@ -1229,4 +1239,31 @@
   Text->setFixedWidth(400);
   Layout->addWidget(Text, 11, 0, 4, 4);
+  
+  QWidget *Button = new QPushButton("Currents");
+  Layout->addWidget(Button, 13, 4, 1, 1);      
+  connect(Button, SIGNAL(pressed()), SLOT(BiasCurrents()));
+}
+
+void TP_Bias::BiasCurrents() {
+
+  QMainWindow *M = new QMainWindow;
+  M->setCentralWidget(new QWidget);
+  M->setStatusBar(new QStatusBar(M));
+  M->setWindowTitle("Edd - Bias currents");
+  M->setAttribute(Qt::WA_DeleteOnClose);
+
+  QGridLayout *Layout = new QGridLayout(M->centralWidget());
+  EddLineDisplay *Line;
+  EddPlot *Plot = new EddPlot();
+
+  for (int i=0; i<36; i++) {
+    Line = new EddLineDisplay("Bias/MICROAMP/ID00", i+64);
+	Line->setMaximumWidth(60);
+    Layout->addWidget(Line, i%9, 0+i/9, 1, 1);
+    Plot->AddService("Bias/MICROAMP/ID00", i+64);	
+  }
+  Layout->addWidget(Plot, 0, 4, 30, 12);
+  
+  M->show();
 }
 
@@ -1263,5 +1300,4 @@
   Layout->addWidget(Button, 12, 0, 1, 1);      
   connect(Button, SIGNAL(pressed()), SLOT(FeedbackDetails()));
-
 }
 
@@ -1341,7 +1377,4 @@
   Layout->addWidget(TabWidget, 1, 1, 5, 5);
 
-  connect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString)));
-  connect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString)));
-
   // Channel number 
   Channel = new QSpinBox;
@@ -1381,4 +1414,17 @@
   connect(Button, SIGNAL(clicked()), SLOT(KeepCurrent()));
 
+  // Stop/start
+  StartStopButton = new QPushButton("Stop");
+  StartStopButton->setToolTip("Start/stop display");
+  StartStopButton->setMaximumWidth(80);
+  StartStopButton->setCheckable(true);
+  QPalette Palette = StartStopButton->palette();
+  Palette.setColor(QPalette::ButtonText, Qt::blue);
+  Palette.setColor(QPalette::Button, Qt::green);
+  StartStopButton->setPalette(Palette);
+  StartStopButton->setFont(QFont("Times", 10, QFont::Bold));
+  Layout->addWidget(StartStopButton, 4, 0);
+  connect(StartStopButton, SIGNAL(toggled(bool)), SLOT(StartStop(bool)));
+
   // Button to show event display
   QPushButton *PixDisplay = new QPushButton("Pixel display");
@@ -1386,5 +1432,5 @@
   PixDisplay->setToolTip("Show event display window");
   PixDisplay->setMaximumWidth(80);
-  Layout->addWidget(PixDisplay, 4, 0);
+  Layout->addWidget(PixDisplay, 5, 0);
   connect(PixDisplay, SIGNAL(clicked()), SLOT(ShowPixelDisplay()));
 
@@ -1411,4 +1457,5 @@
   }
 
+  StartStop(false);
   connect(Scope, SIGNAL(PixelData(QVector<double>)), SLOT(SetPixelData(QVector<double>)));
 }
@@ -1432,8 +1479,23 @@
 }
 
-// Update event scope
+// Keep current trace
 void TP_DAQ::KeepCurrent() {
 
   Scope->AddTrace(Board->value(), Chip->value(), Channel->value());
+}
+
+// Start/stop event acquisition
+void TP_DAQ::StartStop(bool State) {
+
+  Scope->SetActive(!State);
+  StartStopButton->setText(State ? "Start" : "Stop");
+  if (!State) {
+	connect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString)));
+	connect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString)));
+  }
+  else {
+	disconnect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString)));
+	disconnect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString)));
+  }
 }
 
@@ -1477,4 +1539,10 @@
   Line->setMaximumWidth(200);
   Layout->addWidget(Line, 0, 0, 1, 2);      
+
+  QPushButton *Button = new QPushButton();
+  Button->setText("ON/OFF");
+  Button->setCheckable(true);
+  connect(Button, SIGNAL(toggled(bool)), SLOT(ToggleAlarm(bool)));
+  Layout->addWidget(Button, 0, 3, 1, 1);
 
   Line = new EddLineDisplay("Alarm/MasterAlarm");
@@ -1510,5 +1578,5 @@
   Layout->addWidget(Line, 7, 0, 1, 1);
 
-  QPushButton *Button = new QPushButton();
+  Button = new QPushButton();
   Button->setText("eLogBook");
   connect(Button, SIGNAL(released()), SLOT(StartELog()));
@@ -1522,4 +1590,11 @@
   Line = new EddLineDisplay("Edd/Rate_kBSec");
   Layout->addWidget(Line, 8, 0, 1, 1);
+}
+
+// Toggle state of Alarm server
+void TP_Evidence::ToggleAlarm(bool State) {
+
+  if (State) DimClient::sendCommandNB((char *) "Alarm/Switch", (char *) "off");
+  else DimClient::sendCommandNB((char *) "Alarm/Switch", (char *) "on");
 }
  
Index: fact/Evidence/Edd/Edd.h
===================================================================
--- fact/Evidence/Edd/Edd.h	(revision 10059)
+++ fact/Evidence/Edd/Edd.h	(revision 10068)
@@ -276,4 +276,5 @@
 	QAction *PhysPipeAction;
 	FILE *Tmpfile;
+	bool Active;
 
   public:
@@ -283,4 +284,5 @@
 	void UpdateFirst(int, int, int);
 	void AddTrace(int, int, int);
+	void SetActive(bool);
 
   private slots:
@@ -306,4 +308,7 @@
 class TP_Bias: public QWidget {
   Q_OBJECT
+
+  private slots:
+	void BiasCurrents();
 
   public:
@@ -334,4 +339,5 @@
 	QWidget *Display;
 	QPushButton **Pixel;
+	QPushButton *StartStopButton;
 
   private slots:
@@ -339,4 +345,5 @@
 	void UpdateScope(int);
 	void KeepCurrent();
+	void StartStop(bool);
 	void ShowPixelDisplay();
 	void SetPixelData(QVector<double>);
@@ -351,4 +358,5 @@
 
   private slots:
+	void ToggleAlarm(bool);
 	void StartDIMBrowser();
 	void StartELog();
Index: fact/Evidence/readme.txt
===================================================================
--- fact/Evidence/readme.txt	(revision 10059)
+++ fact/Evidence/readme.txt	(revision 10068)
@@ -46,2 +46,3 @@
 			is checked in GetConfig() and also from this thread it will make blocking requests.
 12/8/2010	Added command to switch alarm server on/off (command 'Alarm/Switch').
+9/12/2010	Minimum period for checking server status in Alarm set to 5 seconds.
