Ignore:
Timestamp:
12/10/12 19:28:32 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The basic strobe-less RTO handling logic works (#143)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/flight.py

    r348 r349  
    11
    22from soundsched import SoundScheduler, ChecklistScheduler
     3from checks import SpeedChecker
    34
    45import const
     
    4546        self.blockTimeEnd = None
    4647
     48        self._rtoState = None
     49        self._rtoLogEntryID = None
     50
    4751        self._lastDistanceTime = None
    4852        self._previousLatitude = None
     
    229233        return self.aircraft.speedInKnots if self.aircraft is not None \
    230234               else True
     235
     236    @property
     237    def hasRTO(self):
     238        """Determine if we have an RTO state."""
     239        return self._rtoState is not None
     240
     241    @property
     242    def rtoState(self):
     243        """Get the RTO state."""
     244        return self._rtoState
    231245
    232246    def handleState(self, oldState, currentState):
     
    270284
    271285    def handleFault(self, faultID, timestamp, what, score,
    272                     updatePrevious = False):
     286                    updatePrevious = False, updateID = None):
    273287        """Handle the given fault.
    274288
     
    277291        the score is greater than last time. This ID can be, e.g. the checker
    278292        the report comes from."""
    279         self.logger.fault(faultID, timestamp, what, score,
    280                           updatePrevious = updatePrevious)
     293        id = self.logger.fault(faultID, timestamp, what, score,
     294                               updatePrevious = updatePrevious,
     295                               updateID = updateID)
    281296        self._gui.setRating(self.logger.getRating())
     297        return id
    282298
    283299    def handleNoGo(self, faultID, timestamp, what, shortReason):
     
    285301        self.logger.noGo(faultID, timestamp, what)
    286302        self._gui.setNoGo(shortReason)
     303
     304    def setRTOState(self, state):
     305        """Set the state that might be used as the RTO state.
     306
     307        If there has been no RTO state, the GUI is notified that from now on
     308        the user may select to report an RTO."""
     309        hadNoRTOState = self._rtoState is None
     310
     311        self._rtoState = state
     312        self._rtoLogEntryID = \
     313            SpeedChecker.logSpeedFault(self, state,
     314                                       stage = const.STAGE_PUSHANDTAXI)
     315
     316        if hadNoRTOState:
     317            self._gui.updateRTO()
     318
     319    def rtoToggled(self, indicated):
     320        """Called when the user has toggled the RTO indication."""
     321        if self._rtoState is not None:
     322            if indicated:
     323                self.logger.clearFault(self._rtoLogEntryID,
     324                                       "RTO at %d knots" %
     325                                       (self._rtoState.groundSpeed,))
     326                self._gui.setRating(self.logger.getRating())
     327            else:
     328                SpeedChecker.logSpeedFault(self, self._rtoState,
     329                                           stage = const.STAGE_PUSHANDTAXI,
     330                                           updateID = self._rtoLogEntryID)
    287331
    288332    def flareStarted(self, flareStart, flareStartFS):
Note: See TracChangeset for help on using the changeset viewer.