Changeset 520:6a09d031f8f0


Ignore:
Timestamp:
06/05/13 15:40:01 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Children:
521:9f6c08020c54, 522:63e057098ed7
Phase:
public
Tags:
version_0.21
Message:

Added a delay to the logging of the flaps state (re #204)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/checks.py

    r519 r520  
    641641#---------------------------------------------------------------------------------------
    642642
    643 class FlapsLogger(StateChangeLogger, SingleValueMixin, SimpleChangeMixin):
     643class FlapsLogger(StateChangeLogger, SingleValueMixin, DelayedChangeMixin):
    644644    """Logger for the flaps setting."""
    645645    def __init__(self):
     
    652652                                    const.STAGE_TAKEOFF])
    653653        SingleValueMixin.__init__(self, "flapsSet")
     654        DelayedChangeMixin.__init__(self)
     655        self._getLogTimestamp = \
     656            lambda state, forced: \
     657            DelayedChangeMixin._getLogTimestamp(self, state, forced)
    654658
    655659    def _getMessage(self, flight, state, forced):
    656660        """Get the message to log on a change."""
    657         speed = state.groundSpeed if state.groundSpeed<80.0 else state.ias
     661        logState = self._lastChangeState if \
     662                   self._lastChangeState is not None else state
     663        speed = logState.groundSpeed if logState.groundSpeed<80.0 \
     664                else logState.ias
    658665        return "Flaps %.0f - %.0f %s" % \
    659                (state.flapsSet, flight.speedFromKnots(speed),
     666               (logState.flapsSet, flight.speedFromKnots(speed),
    660667                flight.getEnglishSpeedUnit())
    661668
Note: See TracChangeset for help on using the changeset viewer.