Changeset 112 for hvcontrol


Ignore:
Timestamp:
09/24/09 11:28:59 (15 years ago)
Author:
ogrimm
Message:
Program is terminated if too many read/write errors are encoutered by the monitor thread
Location:
hvcontrol
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • hvcontrol/History.txt

    r100 r112  
    2424            return OK if no HV boards available.
    2525            Number of HV boards is not limited anymore.
     2624/9/2009   Program is terminated if too many errors are encountered by the
     27            monitor thread
  • hvcontrol/src/ProcessIO.cc

    r111 r112  
    619619    else {
    620620      PrintMessage("Error: Could not set HV of board %d, chain %d, channel %d. Skipping channel\n",fHVBoard[Board]->GetBoardNumber(),Chain,Channel);
    621       //SlowDataClass->NewEntry("Error");
    622       //SlowDataClass->AddToEntry("%s %d %d %d %d %.2f ",fHVBoard[Board]->BoardName,Board, Chain, Channel, Target, calib->DACToHV(Target,Board,Chain,Channel));
     621      SlowDataClass->NewEntry("Error");
     622      SlowDataClass->AddToEntry("%s %d %d %d %d %.2f ",fHVBoard[Board]->BoardName,Board, Chain, Channel, Target, calib->DACToHV(Target,Board,Chain,Channel));
    623623      return false;
    624624    }
    625625  }
    626   //SlowDataClass->NewEntry("Value");
    627   //SlowDataClass->AddToEntry("%s %d %d %d %d %.2f ",fHVBoard[Board]->BoardName,Board, Chain, Channel, Target, calib->DACToHV(Target,Board,Chain,Channel));
     626  SlowDataClass->NewEntry("Value");
     627  SlowDataClass->AddToEntry("%s %d %d %d %d %.2f ",fHVBoard[Board]->BoardName,Board, Chain, Channel, Target, calib->DACToHV(Target,Board,Chain,Channel));
    628628  return true;
    629629}
     
    633633void ProcessIO::Monitor() {
    634634
     635  static unsigned int MismatchCount, ErrorCount;
     636 
    635637  for (int i=0; i<NumHVBoards; i++) {
    636638
    637639    if (fHVBoard[i]->GetStatus() != 1) {
    638       PrintMessage("Error: Monitor, could not read status of board %d\n", fHVBoard[i]->GetBoardNumber());
     640      PrintMessage("Error: Monitor could not read status of board %d\n", fHVBoard[i]->GetBoardNumber());
     641      sleep(1);
     642      if (ErrorCount++ > 10) {
     643        PrintMessage("Too many errors from HV monitor, terminating program after next command\n");
     644        Exit = true;
     645        pthread_kill(SocketThread, SIGUSR1);
     646      }
    639647    }
    640648   
     
    645653   
    646654    if (!fHVBoard[i]->WrapOK) {
    647       PrintMessage("Error: Wrap counter mismatch board %d\n",fHVBoard[i]->GetBoardNumber());
     655      if (MismatchCount++>10) PrintMessage("Error: Wrap counter mismatch board %d\n",fHVBoard[i]->GetBoardNumber());
     656      else PrintMessage("Too many wrap counter mismatches, stopping messages\n");
    648657    }
    649658
  • hvcontrol/src/ProcessIO.h

    r111 r112  
    4545  pthread_t HVMonitor;       // exit function sends signal to these threads
    4646  pthread_t SocketThread;
    47 
     47 
    4848  bool Verbose; 
    4949  int Socket;                // -1 if not connected
Note: See TracChangeset for help on using the changeset viewer.