1
0
Fork 0

Delay pilot_view_limiter.start after reinit to prevent using wrong heading-offset

This commit is contained in:
Thomas Geymayer 2013-06-22 17:10:17 +02:00
parent aacd7945b9
commit 44050c8011

View file

@ -432,6 +432,7 @@ var pilot_view_limiter = {
me.xoffsetN = props.globals.getNode("/sim/current-view/x-offset-m");
me.xoffset_lowpass = aircraft.lowpass.new(0.1);
me.last_offset = 0;
me.needs_start = 0;
},
start : func {
var limits = current.getNode("config/limits", 1);
@ -449,11 +450,21 @@ var pilot_view_limiter = {
me.right.scale = me.right.xoffset_max / (me.right.heading_max - me.right.threshold);
me.last_hdg = normdeg(me.hdgN.getValue());
me.enable_xoffset = me.right.xoffset_max > 0.001 or me.left.xoffset_max > 0.001;
me.needs_start = 0;
},
update : func {
if (getprop("/devices/status/keyboard/ctrl"))
return;
if( getprop("/sim/signals/reinit") )
{
me.needs_start = 1;
return;
}
else if( me.needs_start )
me.start();
var hdg = normdeg(me.hdgN.getValue());
if (abs(me.last_hdg - hdg) > 180) # avoid wrap-around skips
me.hdgN.setDoubleValue(hdg = me.last_hdg);