Changeset 594:6e7e3e49f5dc for src


Ignore:
Timestamp:
12/23/14 10:17:55 (10 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Made the checking of the Descent stage a bit more clever (re #233)

Location:
src/mlx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/checks.py

    r562 r594  
    7676                aircraft.setStage(state, const.STAGE_LANDING)
    7777        elif stage==const.STAGE_CRUISE:
    78             if (state.altitude+2000) < flight.cruiseAltitude:
     78            if (state.altitude+2000) < flight.cruiseAltitudeForDescent:
    7979                aircraft.setStage(state, const.STAGE_DESCENT)
    8080        elif stage==const.STAGE_DESCENT or stage==const.STAGE_GOAROUND:
  • src/mlx/flight.py

    r564 r594  
    111111        self._checklistScheduler = ChecklistScheduler(self)
    112112
     113        self._maxAltitude = 0
     114
    113115    @property
    114116    def config(self):
     
    180182        """Get the cruise altitude of the flight."""
    181183        return self._gui.cruiseAltitude
     184
     185    @property
     186    def maxAltitude(self):
     187        """Get the maximal altitude ever reached during the flight."""
     188        return self._maxAltitude
     189
     190    @property
     191    def cruiseAltitudeForDescent(self):
     192        """Get the cruise altitude to check for descending.
     193
     194        This is the minimum of current maximal altitude and the cruise
     195        altitude."""
     196        return min(self._maxAltitude, self.cruiseAltitude)
    182197
    183198    @property
     
    353368                                      self._pilotHotkeyPressed)
    354369        self._pilotHotkeyPressed = False
     370
     371        self._maxAltitude = max(currentState.altitude, self._maxAltitude)
    355372
    356373        if self._checklistHotkeyPressed:
Note: See TracChangeset for help on using the changeset viewer.