Changeset 201 for tools


Ignore:
Timestamp:
04/22/10 15:32:57 (15 years ago)
Author:
ogrimm
Message:
New command 'test'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/vchvtest/vchvtest.cc

    r200 r201  
    3737void cmd_help();        void cmd_repeat();
    3838void cmd_config();      void cmd_rate();
     39void cmd_test();
    3940
    4041int ParseInput(char*, const char *Param[]);
     
    6364   {"rate", &cmd_rate, 1, "<n>", "Make n 'rd 0 0' cycles and measure time", false},
    6465   {"repeat", &cmd_repeat, 1, "<on|off>", "Command repetition (ENTER to stop)", false},
     66   {"test", &cmd_test, 1, "<Voltage>", "Set all channels consecutively", false},   
    6567   {"exit", &cmd_exit, 0, "", "Exit program", false},
    6668   {"help", &cmd_help, 0, "", "Print help", false}};
     
    221223}
    222224
     225// Switch on all channels consecutively for cabling test
     226void cmd_test() {
     227
     228  for (int i=FirstCrate; i<=LastCrate; i++) {
     229    printf("Testing board %d  (Enter to continue, any key plus enter to stop)\n", fHVBoard[i]->BoardNumber);
     230    if (fHVBoard[i]->GlobalSet(0) != 1) {
     231      printf("Error: Could not global set board to zero\n");
     232          return;
     233    }   
     234
     235        for (int k=0; k<MAX_NUM_BOARDS; k++) for (int j=0; j<NUM_CHANNELS; j++) {
     236          printf("\rBoard %d, channel %d", k, j);
     237          fflush(stdout);
     238          Verbose = false;
     239          if (fHVBoard[i]->ChannelSet(k, j, atoi(Param[1])) != 1) {
     240        printf("Error setting voltage\n");
     241                return;
     242          }
     243          Verbose = true;
     244          if (getchar() != '\n') return;
     245        }
     246  }
     247}
     248
    223249// Send bytes and wait for response
    224250void cmd_send() {
Note: See TracChangeset for help on using the changeset viewer.