Changeset 11940 for trunk/FACT++/src


Ignore:
Timestamp:
09/02/11 08:23:04 (13 years ago)
Author:
tbretz
Message:
Implemented three different receive buffers and blocked sending of several commands before an answer is received to avoid that a buffer is written to before the previous handler has finished.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/biasctrl.cc

    r11938 r11940  
    1515
    1616#include "LocalControl.h"
     17#include "HeadersBIAS.h"
    1718
    1819namespace ba    = boost::asio;
     
    2223using namespace std::placeholders;
    2324using namespace std;
     25using namespace BIAS;
    2426
    2527// ------------------------------------------------------------------------
     
    2729class ConnectionBias : public ConnectionUSB
    2830{
    29     enum
    30     {
    31         kNumBoards           = 13,
    32         kNumChannelsPerBoard = 32,
    33         kNumChannels = kNumBoards*kNumChannelsPerBoard
    34     };
    35 
    36     enum Command_t
    37     {
    38         // Communication commands
    39         kCmdReset         =  0,
    40         kCmdRead          =  1,
    41         kCmdGlobalSet     =  2,
    42         kCmdChannelSet    =  3,
    43 
    44         // Internal command names
    45         kResetChannels    = 0x10|kCmdChannelSet,
    46         kUpdate           = 0x10|kCmdRead,
    47         kExpertChannelSet = 0x14|kCmdChannelSet,
    48         kSynchronize      = 0x1e,
    49         //kOverCurReset     = 20,
    50     };
    51 
    52     enum
    53     {
    54         kMaxDac = 0xfff
    55     };
    56 
    5731    boost::asio::deadline_timer fSyncTimer;
    5832    boost::asio::deadline_timer fRampTimer;
     
    6034
    6135    vector<uint8_t> fBuffer;
     36    vector<uint8_t> fBufferRamp;
     37    vector<uint8_t> fBufferUpdate;
    6238
    6339    bool fIsVerbose;
     
    8258    bool fIsInitializing;
    8359    bool fIsRamping;
    84 //    bool fWaitingForAnswer;
     60    bool fWaitingForAnswer;
    8561
    8662protected:
     
    164140    }
    165141
    166     bool EvalAnswer(uint8_t *answer, uint16_t id, int command)
     142    bool EvalAnswer(const uint8_t *answer, uint16_t id, int command)
    167143    {
    168144        answer += id*3;
     
    215191            fSendCounter = wrap;
    216192
     193            msg.str("");
     194            msg << "Setting fSendCounter to " << wrap;
     195            Info(msg);
     196
    217197            return true;
    218198        }
     
    288268
    289269private:
     270    void HandleReceivedData(const vector<uint8_t> &buf, size_t bytes_received, int command, int send_counter)
     271    {
     272        // Now print the received message if requested by the user
     273        if (fIsVerbose/* && command!=kUpdate*/)
     274        {
     275            Out() << endl << kBold << dec << "Data received (size=" << bytes_received << "):" << endl;
     276            Out() << " Command=" << command << " fWrapCounter=" << fWrapCounter << " fSendCounter=" << fSendCounter << " fIsInitializing=" << fIsInitializing << " fIsRamping=" << fIsRamping;
     277            Out() << hex << setfill('0');
     278
     279            for (size_t i=0; i<bytes_received/3; i++)
     280            {
     281                if (i%8==0)
     282                    Out() << '\n' << setw(2) << bytes_received/24 << "| ";
     283
     284                Out() << setw(2) << uint16_t(buf[i*3+2]);
     285                Out() << setw(2) << uint16_t(buf[i*3+1]);
     286                Out() << setw(2) << uint16_t(buf[i*3+0]) << " ";
     287            }
     288            Out() << endl;
     289        }
     290
     291        const int cmd = command&0xf;
     292
     293        // Check the number of received_byted according to the answer expected
     294        if ((cmd==kSynchronize      && !CheckMessageLength(bytes_received, 3,                "Synchronization")) ||
     295            (cmd==kCmdReset         && !CheckMessageLength(bytes_received, 3,                "CmdReset"))        ||
     296            (cmd==kCmdRead          && !CheckMessageLength(bytes_received, 3*kNumChannels,   "CmdRead"))         ||
     297            (cmd==kCmdChannelSet    && !CheckMessageLength(bytes_received, 3*kNumChannels,   "CmdChannelSet"))   ||
     298            (cmd==kExpertChannelSet && !CheckMessageLength(bytes_received, 3,                "CmdExpertChannelSet")))
     299            return;
     300
     301        // Now evaluate the whole bunch of messages
     302        for (size_t i=0; i<bytes_received/3; i++)
     303        {
     304            if (!EvalAnswer(buf.data(), i, command))
     305            {
     306                PostClose(false);
     307                return;
     308            }
     309        }
     310
     311        if (command==kSynchronize)
     312        {
     313            Message("Stream successfully synchronized.");
     314            fIsInitializing = false;
     315
     316            // Cancel sending of the next 0
     317            fSyncTimer.cancel();
     318
     319            // Start continous reading of all channels
     320            ScheduleUpdate(100);
     321            return;
     322        }
     323
     324        if (send_counter%8 != fWrapCounter)
     325        {
     326            ostringstream msg;
     327            msg << "Corrupted answer: received wrap counter " << fWrapCounter  << " is not send counter " << send_counter << "%8.";
     328            Error(msg);
     329            PostClose(false);
     330        }
     331
     332
     333        // Take action depending on what is going on
     334        if (command==kCmdReset)
     335            Message("Reset command successfully answered.");
     336
     337        if (cmd==kCmdRead || cmd==kCmdChannelSet || cmd==kExpertChannelSet)
     338        {
     339            UpdateV();
     340            UpdateA();
     341        }
     342
     343        if (cmd==kCmdReset || command==kResetChannels)
     344        {
     345            // Re-start cyclic reading of values after a short time
     346            // to allow the currents to become stable
     347            fUpdateTimer.cancel();
     348            ScheduleUpdate(100);
     349        }
     350
     351        if (command==kUpdate)
     352            ScheduleUpdate(fUpdateTime);
     353
     354        // If we are ramping, schedule a new ramp step
     355        if (command==kCmdChannelSet && fIsRamping)
     356        {
     357            ScheduleRampStep();
     358            return;
     359        }
     360    }
     361
    290362    void HandleReceivedData(const bs::error_code& err, size_t bytes_received, int command, int send_counter)
    291363    {
     
    319391        }
    320392
    321         // Now print the received message if requested by the user
    322         if (fIsVerbose/* && command!=kUpdate*/)
    323         {
    324             Out() << endl << kBold << dec << "Data received (size=" << bytes_received << "):" << endl;
    325             Out() << " Command=" << command << " fWrapCounter=" << fWrapCounter << " fSendCounter=" << fSendCounter << " fIsInitializing=" << fIsInitializing << " fIsRamping=" << fIsRamping << endl;
    326             Out() << hex << setfill('0');
    327 
    328             vector<uint32_t> vout((bytes_received/3)*4);
    329 
    330             for (size_t i=0; i<bytes_received/3; i++)
    331             {
    332                 vout[i] =
    333                     (uint32_t(fBuffer[i*3+2])<<16) |
    334                     (uint32_t(fBuffer[i*3+1])<< 8) |
    335                     (uint32_t(fBuffer[i*3+0])<< 0);
    336 
    337                 Out() << setw(6) << vout[i] << " ";
    338                 if (i%8==7)
    339                     Out() << endl;
    340             }
    341 
    342             //Out() << Converter::GetHex<uint32_t>(vout, 16) << endl;
    343         }
    344 
    345         const int cmd = command&0xf;
    346 
    347         // Check the number of received_byted according to the answer expected
    348         if ((cmd==kSynchronize      && !CheckMessageLength(bytes_received, 3,                "Synchronization")) ||
    349             (cmd==kCmdReset         && !CheckMessageLength(bytes_received, 3,                "CmdReset"))        ||
    350             (cmd==kCmdRead          && !CheckMessageLength(bytes_received, 3*kNumChannels,   "CmdRead"))         ||
    351             (cmd==kCmdChannelSet    && !CheckMessageLength(bytes_received, 3*kNumChannels,   "CmdChannelSet"))   ||
    352             (cmd==kExpertChannelSet && !CheckMessageLength(bytes_received, 3,                "CmdExpertChannelSet")))
    353             return;
    354 
    355         // Now evaluate the whole bunch of messages
    356         for (size_t i=0; i<bytes_received/3; i++)
    357         {
    358             if (!EvalAnswer(fBuffer.data(), i, command))
    359             {
    360                 PostClose(false);
    361                 return;
    362             }
    363         }
    364 
    365         // Now we are ready to send a new message
    366 //        fWaitingForAnswer = false;
    367 
    368         if (command==kSynchronize)
    369         {
    370             Message("Stream successfully synchronized.");
    371             fIsInitializing = false;
    372 
    373             // Cancel sending of the next 0
    374             fSyncTimer.cancel();
    375 
    376             // Start continous reading of all channels
    377             ScheduleUpdate(100);
    378             return;
    379         }
    380 
    381         if (send_counter%8 != fWrapCounter)
    382         {
    383             ostringstream msg;
    384             msg << "Corrupted answer: received wrap counter " << fWrapCounter  << " is not send counter " << send_counter << "%8.";
    385             Error(msg);
    386             PostClose(false);
    387         }
    388 
    389 
    390         // Take action depending on what is going on
    391         if (command==kCmdReset)
    392             Message("Reset command successfully answered.");
    393 
    394         if (cmd==kCmdRead || cmd==kCmdChannelSet || cmd==kExpertChannelSet)
    395         {
    396             UpdateV();
    397             UpdateA();
    398         }
    399 
    400         if (cmd==kCmdReset || command==kResetChannels)
    401         {
    402             // Re-start cyclic reading of values after a short time
    403             // to allow the currents to become stable
    404             fUpdateTimer.cancel();
    405             ScheduleUpdate(100);
    406         }
    407 
    408         if (command==kUpdate)
    409             ScheduleUpdate(fUpdateTime);
    410 
    411         // If we are ramping, schedule a new ramp step
    412         if (command==kCmdChannelSet && fIsRamping)
    413         {
    414             ScheduleRampStep();
     393        // We have three different parallel streams:
     394        //  1) The setting of voltages due to ramping
     395        //  2) The cynclic request of the currents
     396        //  3) Answers to commands
     397        // For each of these three streams an own buffer is needed, otherwise
     398        // a buffer which is filled in the background might overwrite
     399        // a buffer which is currently evaluated. In all other programs
     400        // this is no problem because the boards don't answer and if
     401        // they do the answer identifies itself. Consequently,
     402        // there is always only one async_read in progress. Here we have
     403        // three streams which need to be connected somehow to the
     404        // commands.
     405
     406        // Maybe a better possibility would be to setup a command
     407        // queue (each command will be queued in a buffer)
     408        // and whenever an answer has been received, a new async_read is
     409        // scheduled.
     410        // Build a command queue<pair<command, vector<char>>>
     411        ///  This replaces the send counter and the command argument
     412        //   in handleReceivedData
     413
     414        switch (command&0xff)
     415        {
     416        case kSynchronize:
     417        case kCmdReset:
     418        case kExpertChannelSet:
     419        case kCmdGlobalSet:
     420        case kResetChannels:
     421        case kCmdRead:
     422            HandleReceivedData(fBuffer, bytes_received, command, send_counter);
     423            fWaitingForAnswer = false;
     424            return;
     425
     426        case kCmdChannelSet:
     427            HandleReceivedData(fBufferRamp, bytes_received, command, send_counter);
     428            return;
     429
     430        case kUpdate:
     431            HandleReceivedData(fBufferUpdate, bytes_received, command, send_counter);
    415432            return;
    416433        }
     
    491508        PostMessage("\0", 1);
    492509        AsyncRead(ba::buffer(fBuffer, 3), kSynchronize, 0);//++fSendCounter);
    493 //        fWaitingForAnswer = true;
     510        fWaitingForAnswer = true;
    494511
    495512        // Wait for some time before sending the next 0
     
    551568
    552569        PostMessage(data);
    553         AsyncRead(ba::buffer(fBuffer, kNumChannels*3),
     570        AsyncRead(ba::buffer(special ? fBuffer : fBufferRamp, kNumChannels*3),
    554571                  special ? kResetChannels : kCmdChannelSet, fSendCounter);
    555 //        fWaitingForAnswer = true;
     572
     573        if (special)
     574            fWaitingForAnswer = true;
    556575    }
    557576
     
    651670        fUpdateTimer(ioservice),
    652671        fBuffer(3*kNumChannels),
     672        fBufferRamp(3*kNumChannels),
     673        fBufferUpdate(3*kNumChannels),
    653674        fIsVerbose(false),
    654675        fVoltCmd(kNumChannels),
     
    658679        fRampStep(-1),
    659680        fRampTime(-1),
     681        fUpdateTime(3000),
    660682        fSyncTime(333),
    661         fUpdateTime(3000),
    662683        fIsRamping(false),
     684        fWaitingForAnswer(false),
    663685        fVolt(kNumChannels),
    664686        fVoltRef(kNumChannels),
     
    670692    void OverCurrentReset()
    671693    {
     694        if (fWaitingForAnswer)
     695        {
     696            Error("Answer on last command not yet received.");
     697            return;
     698        }
     699
    672700        if (fIsRamping)
    673701        {
     
    686714    void ReadAllChannels(bool special = false)
    687715    {
     716        if (!special && fWaitingForAnswer)
     717        {
     718            Error("Answer on last command not yet received.");
     719            return;
     720        }
     721
    688722        vector<char> data;
    689723        data.reserve(kNumChannels*3);
     
    698732
    699733        PostMessage(data);
    700         AsyncRead(ba::buffer(fBuffer, kNumChannels*3),
     734        AsyncRead(ba::buffer(special ? fBufferUpdate : fBuffer, kNumChannels*3),
    701735                  special ? kUpdate : kCmdRead, fSendCounter);
    702 //        fWaitingForAnswer = true;
     736
     737        if (!special)
     738            fWaitingForAnswer = true;
    703739    }
    704740
     
    824860    void ExpertReset()
    825861    {
     862        if (fWaitingForAnswer)
     863        {
     864            Error("Answer on last command not yet received.");
     865            return;
     866        }
     867
    826868        Warn("EXPERT MODE: Sending reset.");
    827869        PostMessage(GetCmd(kCmdReset));
    828         AsyncRead(ba::buffer(fBuffer, 3), kCmdReset);
    829 //        fWaitingForAnswer = true;
     870        AsyncRead(ba::buffer(fBuffer, 3), kCmdReset, ++fSendCounter);
     871        fWaitingForAnswer = true;
    830872    }
    831873
     
    833875    bool ExpertChannelSetDac(uint16_t ch, uint16_t dac)
    834876    {
     877        if (fWaitingForAnswer)
     878        {
     879            Error("Answer on last command not yet received.");
     880            return false;
     881        }
     882
    835883        if (!CheckChDac("ExpertChannelSetDac", dac, ch))
    836884            return false;
     
    844892        PostMessage(GetCmd(kCmdChannelSet, ch, dac));
    845893        AsyncRead(ba::buffer(fBuffer, 3), kExpertChannelSet|(ch<<8), ++fSendCounter);
    846 //        fWaitingForAnswer = true;
     894        fWaitingForAnswer = true;
    847895
    848896        return true;
     
    856904    bool ExpertGlobalSetDac(uint16_t dac)
    857905    {
     906        if (fWaitingForAnswer)
     907        {
     908            Error("Answer on last command not yet received.");
     909            return false;
     910        }
     911
    858912        if (!CheckChDac("ExpertGlobalSetDac", dac))
    859913            return false;
     
    873927        PostMessage(GetCmd(kCmdGlobalSet, 0, dac));
    874928        AsyncRead(ba::buffer(fBuffer, 3), kCmdGlobalSet, ++fSendCounter);
    875 //        fWaitingForAnswer = true;
     929        fWaitingForAnswer = true;
    876930
    877931        return true;
     
    10421096    */
    10431097
    1044     enum States_t
    1045     {
    1046         kDisconnected = StateMachineImp::kSM_UserMode,
    1047         kConnecting,
    1048         kInitializing,
    1049         kConnected,
    1050         kRamping,
    1051         kOverCurrent,
    1052         kAtReference,
    1053         kExpertMode // 'forward' declaration to be used in StateMachineBias
    1054     };
    1055 
    1056     int GetStatus()
     1098    States_t GetStatus()
    10571099    {
    10581100        if (!IsConnected())
    1059             return kDisconnected;
     1101            return BIAS::kDisconnected;
    10601102
    10611103        if (IsConnecting())
    1062             return kConnecting;
     1104            return BIAS::kConnecting;
    10631105
    10641106        if (fIsInitializing)
    1065             return kInitializing;
     1107            return BIAS::kInitializing;
    10661108
    10671109        if (fIsRamping)
    1068             return kRamping;
     1110            return BIAS::kRamping;
    10691111
    10701112        for (int ch=0; ch<kNumChannels; ch++)
    10711113            if (fPresent[ch/kNumChannelsPerBoard] && fCurrent[ch]<0)
    1072                 return kOverCurrent;
     1114                return BIAS::kOverCurrent;
    10731115
    10741116        for (int ch=0; ch<kNumChannels; ch++)
    10751117            if (fPresent[ch/kNumChannelsPerBoard] && fVolt[ch]!=fVoltRef[ch])
    1076                 return kConnected;
    1077 
    1078         return kAtReference;
     1118                return BIAS::kConnected;
     1119
     1120        return BIAS::kAtReference;
    10791121    }
    10801122};
     
    13061348        poll_one();
    13071349
    1308         return fExpertMode && fBias.GetStatus()==ConnectionBias::kConnected ?
    1309             ConnectionBias::kExpertMode : fBias.GetStatus();
     1350        return fExpertMode && fBias.GetStatus()>=kConnected ?
     1351            kExpertMode : fBias.GetStatus();
    13101352    }
    13111353
     
    13231365
    13241366        // State names
    1325         T::AddStateName(ConnectionBias::kDisconnected, "Disconnected",
     1367        T::AddStateName(kDisconnected, "Disconnected",
    13261368                        "Bias-power supply not connected via USB.");
    13271369
    1328         T::AddStateName(ConnectionBias::kConnecting, "Connecting",
     1370        T::AddStateName(kConnecting, "Connecting",
    13291371                        "Trying to establish USB connection to bias-power supply.");
    13301372
    1331         T::AddStateName(ConnectionBias::kInitializing, "Initializing",
     1373        T::AddStateName(kInitializing, "Initializing",
    13321374                        "USB connection to bias-power supply established, synchronizing USB stream.");
    13331375
    1334         T::AddStateName(ConnectionBias::kConnected, "Connected",
     1376        T::AddStateName(kConnected, "Connected",
    13351377                        "USB connection to bias-power supply established.");
    13361378
    1337         T::AddStateName(ConnectionBias::kAtReference, "Referenced",
     1379        T::AddStateName(kAtReference, "Referenced",
    13381380                        "Internal reference voltage matches last sent voltage.");
    13391381
    1340         T::AddStateName(ConnectionBias::kOverCurrent, "OverCurrent",
     1382        T::AddStateName(kOverCurrent, "OverCurrent",
    13411383                        "At least one channel is in over current state.");
    13421384
    1343         T::AddStateName(ConnectionBias::kExpertMode, "ExpertMode",
     1385        T::AddStateName(kExpertMode, "ExpertMode",
    13441386                        "Special (risky!) mode to directly send command to the bias-power supply.");
    13451387
    1346         T::AddStateName(ConnectionBias::kRamping, "Ramping",
     1388        T::AddStateName(kRamping, "Ramping",
    13471389                        "Voltage ramping in progress.");
    13481390
     
    13541396
    13551397        // Conenction commands
    1356         T::AddEvent("DISCONNECT", ConnectionBias::kConnected, ConnectionBias::kAtReference)
     1398        T::AddEvent("DISCONNECT", kConnected, kAtReference)
    13571399            (bind(&StateMachineBias::Disconnect, this))
    13581400            ("disconnect from ethernet");
    13591401
    1360         T::AddEvent("RECONNECT", "O", ConnectionBias::kDisconnected, ConnectionBias::kConnected, ConnectionBias::kAtReference)
     1402        T::AddEvent("RECONNECT", "O", kDisconnected, kConnected, kAtReference)
    13611403            (bind(&StateMachineBias::Reconnect, this, placeholders::_1))
    13621404            ("(Re)connect ethernet connection to FTM, a new address can be given"
     
    13651407
    13661408
    1367         T::AddEvent("REQUEST_STATUS", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1409        T::AddEvent("REQUEST_STATUS", kConnected, kAtReference, kOverCurrent)
    13681410            (Wrapper(bind(&ConnectionBias::ReadAllChannels, &fBias, false)))
    13691411            ("Asynchronously request the status (current) of all channels.");
    13701412
    1371         T::AddEvent("RESET_OVER_CURRENT_STATUS", ConnectionBias::kOverCurrent)
     1413        T::AddEvent("RESET_OVER_CURRENT_STATUS", kOverCurrent)
    13721414            (Wrapper(bind(&ConnectionBias::OverCurrentReset, &fBias)))
    13731415            ("NOT YET TESTED");
     
    13751417
    13761418
    1377         T::AddEvent("SET_GLOBAL_VOLTAGE", "F:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1419        T::AddEvent("SET_GLOBAL_VOLTAGE", "F:1", kConnected, kAtReference, kOverCurrent)
    13781420            (bind(&StateMachineBias::SetGlobalVolt, this, placeholders::_1))
    13791421            ("Set all channels to a new reference voltage. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)");
    13801422
    1381         T::AddEvent("SET_GLOBAL_DAC", "S:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1423        T::AddEvent("SET_GLOBAL_DAC", "S:1", kConnected, kAtReference, kOverCurrent)
    13821424            (bind(&StateMachineBias::SetGlobalDac, this, placeholders::_1))
    13831425            ("Set all channels to a new DAC reference. Starts ramping if necessary. (This command is not realized with the GLOBAL SET command.)");
    13841426
    1385         T::AddEvent("SET_CHANNEL_VOLTAGE", "S:1;F:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1427        T::AddEvent("SET_CHANNEL_VOLTAGE", "S:1;F:1", kConnected, kAtReference, kOverCurrent)
    13861428            (bind(&StateMachineBias::SetChannelVolt, this, placeholders::_1))
    13871429            ("Set a single channel a new reference voltage. Starts ramping if necessary.");
    13881430
    1389         T::AddEvent("SET_CHANNEL_DAC", "S:1;S:1", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1431        T::AddEvent("SET_CHANNEL_DAC", "S:1;S:1", kConnected, kAtReference, kOverCurrent)
    13901432            (bind(&StateMachineBias::SetChannelDac, this, placeholders::_1))
    13911433            ("Set a single channel a new DAC reference value. Starts ramping if necessary.");
    13921434
    1393         T::AddEvent("SET_GAPD_REFERENCE_VOLTAGE", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1435        T::AddEvent("SET_GAPD_REFERENCE_VOLTAGE", kConnected, kAtReference, kOverCurrent)
    13941436            (Wrapper(bind(&ConnectionBias::SetGapdVoltage, &fBias)))
    13951437            ("Set all channels to their G-APD reference voltage. Starts ramping if necessary.");
    13961438
    1397         T::AddEvent("SET_ZERO_VOLTAGE", ConnectionBias::kConnected, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1439        T::AddEvent("SET_ZERO_VOLTAGE", kConnected, kAtReference, kOverCurrent)
    13981440            (Wrapper(bind(&ConnectionBias::SetZero, &fBias)))
    13991441            ("Set all channels to a zero reference voltage. Starts ramping if necessary.");
     
    14011443
    14021444
    1403         T::AddEvent("STOP", ConnectionBias::kConnected, ConnectionBias::kRamping, ConnectionBias::kAtReference, ConnectionBias::kOverCurrent)
     1445        T::AddEvent("STOP", kConnected, kRamping, kAtReference, kOverCurrent)
    14041446            (Wrapper(bind(&ConnectionBias::RampStop, &fBias)))
    14051447            ("");
    14061448
    1407         T::AddEvent("START", ConnectionBias::kConnected, ConnectionBias::kOverCurrent)
     1449        T::AddEvent("START", kConnected, kOverCurrent)
    14081450            (Wrapper(bind(&ConnectionBias::RampStart, &fBias)))
    14091451            ("");
     
    14261468            ("Enable usage of expert commands (note that for safty reasons the are exclusive with the standard commands)");
    14271469
    1428         T::AddEvent("EXPERT_RESET", ConnectionBias::kExpertMode)
     1470        T::AddEvent("EXPERT_RESET", kExpertMode)
    14291471            (Wrapper(bind(&ConnectionBias::ExpertReset, &fBias)))
    14301472            ("Send the RESET command (note that this is possibly harmfull command)");
    14311473
    1432         T::AddEvent("EXPERT_SET_GLOBAL_VOLTAGE", "F:1", ConnectionBias::kExpertMode)
     1474        T::AddEvent("EXPERT_SET_GLOBAL_VOLTAGE", "F:1", kExpertMode)
    14331475            (bind(&StateMachineBias::ExpertSetGlobalVolt, this, placeholders::_1))
    14341476            ("Send the global set command. The given voltage is converted to DAC counts.");
    14351477
    1436         T::AddEvent("EXPERT_SET_GLOBAL_DAC", "S:1", ConnectionBias::kExpertMode)
     1478        T::AddEvent("EXPERT_SET_GLOBAL_DAC", "S:1", kExpertMode)
    14371479            (bind(&StateMachineBias::ExpertSetGlobalDac, this, placeholders::_1))
    14381480            ("Send the global set command.");
    14391481
    1440         T::AddEvent("EXPERT_SET_CHANNEL_VOLTAGE", "S:1;F:1", ConnectionBias::kExpertMode)
     1482        T::AddEvent("EXPERT_SET_CHANNEL_VOLTAGE", "S:1;F:1", kExpertMode)
    14411483            (bind(&StateMachineBias::ExpertSetChannelVolt, this, placeholders::_1))
    14421484            ("Send a single channel set command. The given voltage is converted to DAC commands.");
    14431485
    1444         T::AddEvent("EXPERT_SET_CHANNEL_DAC", "S:1;S:1", ConnectionBias::kExpertMode)
     1486        T::AddEvent("EXPERT_SET_CHANNEL_DAC", "S:1;S:1", kExpertMode)
    14451487            (bind(&StateMachineBias::ExpertSetChannelDac, this, placeholders::_1))
    14461488            ("Send a single channel set command.");
     
    14941536        int l = 0;
    14951537
    1496         vector<float> vec(ConnectionBias::kNumChannels);
     1538        vector<float> vec(kNumChannels);
    14971539
    14981540        string buf;
     
    15171559            str >> fdummy >> fdummy >> fdummy;
    15181560
    1519             if (channel+32*board>=ConnectionBias::kNumChannels)
     1561            if (channel+32*board>=kNumChannels)
    15201562            {
    15211563                T::Error("Invalid board/channel read from FACTmapV5.txt.");
Note: See TracChangeset for help on using the changeset viewer.