1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#thread d'actualisation des données
class thread(threading.Thread):
def __init__(self, nom = ''):
threading.Thread.__init__(self)
self.nom = nom
self._stopevent = threading.Event( )
self.elapsed_time = 1
def run(self):
self._stopevent.clear()
time_to_elapse = 0
start_global = 0
end_global = 0
while not self._stopevent.isSet():
start_global = time.clock()
_nsis_instance_handle.mfd_inputs_1.ahrs_pitch_angle_value = _nsis_instance_handle.ac_model.pitch
_nsis_instance_handle.mfd_inputs_1.ahrs_true_heading_value = _nsis_instance_handle.ac_model.true_heading
_nsis_instance_handle.mfd_inputs_1.ahrs_true_air_speed_value = _nsis_instance_handle.ac_model.true_airspeed
_nsis_instance_handle.mfd_inputs_1.ahrs_roll_angle_value = _nsis_instance_handle.ac_model.roll
end_global = time.clock()
time_to_elapse = self.elapsed_time - end_global + start_global
if time_to_elapse > 0:
self._stopevent.wait(time_to_elapse)
def stop(self):
self._stopevent.set( ) |
Partager