Changeset 134:9ce031d5d4a9 for src/mlx/checks.py
- Timestamp:
- 04/30/12 14:42:59 (12 years ago)
- Branch:
- default
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/checks.py
r60 r134 3 3 #--------------------------------------------------------------------------------------- 4 4 5 import fs 5 6 import const 7 import util 6 8 7 9 #--------------------------------------------------------------------------------------- … … 143 145 #--------------------------------------------------------------------------------------- 144 146 147 class VisibilityChecker(StateChecker): 148 """Inform the pilot of the visibility once when descending below 2000 ft, 149 then when descending below 1000 ft.""" 150 def __init__(self): 151 """Construct the visibility checker.""" 152 self._informedBelow2000 = False 153 self._informedBelow1000 = False 154 155 def check(self, flight, aircraft, logger, oldState, state): 156 """Check if we need to inform the pilot of the visibility.""" 157 if flight.stage==const.STAGE_DESCENT or \ 158 flight.stage==const.STAGE_LANDING: 159 if (state.radioAltitude<2000 and not self._informedBelow2000) or \ 160 (state.radioAltitude<1000 and not self._informedBelow1000): 161 visibilityString = util.visibility2String(state.visibility) 162 fs.sendMessage(const.MESSAGETYPE_VISIBILITY, 163 "Current visibility: " + visibilityString, 164 5) 165 logger.message(state.timestamp, 166 "Pilot was informed about the visibility: " + 167 visibilityString) 168 self._informedBelow2000 = True 169 self._informedBelow1000 = state.radioAltitude<1000 170 171 #--------------------------------------------------------------------------------------- 172 145 173 class StateChangeLogger(StateChecker): 146 174 """Base class for classes the instances of which check if a specific change has
Note:
See TracChangeset
for help on using the changeset viewer.