Changeset 18803 for trunk


Ignore:
Timestamp:
04/05/17 15:26:16 (8 years ago)
Author:
tbretz
Message:
Split Errors and Warning into to error states. Allow to park in warning state. Allow to reset in InvalidCoorsinate state.
File:
1 edited

Legend:

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

    r18655 r18803  
    13081308    }
    13091309
    1310     bool HasError() const
     1310    bool HasWarning() const
    13111311    {
    13121312        const uint8_t typ0 = fErrCode[0]>>16;
    13131313        const uint8_t typ1 = fErrCode[1]>>16;
    1314         return typ0==0xe || typ0==0xf || typ1==0xe || typ1==0xf;
     1314        return typ0==0xe || typ1==0xe;
     1315    }
     1316
     1317    bool HasError() const
     1318    {
     1319        const uint8_t typ0 = fErrCode[0]>>16;
     1320        const uint8_t typ1 = fErrCode[1]>>16;
     1321        return typ0==0xf || typ1==0xf;
    13151322    }
    13161323
     
    25112518        // FIXME: This can prevent parking in case e.g.
    25122519        // of e8029 Position limit exceeded
    2513         if (fDrive.HasError())
     2520        if (fDrive.HasWarning() || fDrive.HasError())
    25142521        {
    25152522            if (T::GetCurrentState()==State::kOnTrack  ||
     
    25212528            if (T::GetCurrentState()==State::kStopping && fDrive.IsMoving())
    25222529                return State::kStopping;
     2530
     2531            if (fDrive.HasError())
     2532                return State::kHardwareError;
     2533
     2534            if (fDrive.HasWarning())
     2535                return State::kHardwareWarning;
    25232536
    25242537            return StateMachineImp::kSM_Error;
     
    27282741        T::AddStateName(State::kInvalidCoordinates, "InvalidCoordinates",
    27292742                        "Tracking coordinates out of range");
     2743
     2744        T::AddStateName(State::kHardwareWarning, "HwardwareWarning",
     2745                        "At least one IndraDrive in a warning condition... check carefully!");
     2746        T::AddStateName(State::kHardwareError, "HwardwareError",
     2747                        "At least one IndraDrive in an error condition... this is a serious incident!");
    27302748
    27312749
     
    28172835
    28182836        // FIXME: What to do in error state?
    2819         T::AddEvent("PARK", State::kInitialized, State::kMoving, State::kTracking, State::kOnTrack)
     2837        T::AddEvent("PARK", State::kInitialized, State::kMoving, State::kTracking, State::kOnTrack, State::kHardwareWarning)
    28202838            (bind(&StateMachineDrive::Park, this))
    28212839            ("Park the telescope");
     
    28252843            ("Stop any kind of movement.");
    28262844
    2827         T::AddEvent("RESET", State::kPositioningFailed, State::kAllowedRangeExceeded)
     2845        T::AddEvent("RESET", State::kPositioningFailed, State::kAllowedRangeExceeded, State::kInvalidCoordinates)
    28282846            (bind(&StateMachineDrive::ResetError, this))
    2829             ("Acknoledge an internal error (PositioningFailed, AllowedRangeExceeded)");
     2847            ("Acknowledge an internal drivectrl error (PositioningFailed, AllowedRangeExceeded, InvalidCoordinates)");
    28302848
    28312849        T::AddEvent("TPOINT", State::kOnTrack)
Note: See TracChangeset for help on using the changeset viewer.