X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fturn_indicator.cxx;h=1edb0bb4d3e09a4771c2b4788180f85b22aaf743;hb=a739fad66484506ebb71fc802bf8f1a0c2ab4c6c;hp=5e052397452e7b59f98922f185b2f5869b01c0d6;hpb=677c3e3e9ab9598c40a23cc89f99235d618b3a6f;p=flightgear.git diff --git a/src/Instrumentation/turn_indicator.cxx b/src/Instrumentation/turn_indicator.cxx index 5e0523974..1edb0bb4d 100644 --- a/src/Instrumentation/turn_indicator.cxx +++ b/src/Instrumentation/turn_indicator.cxx @@ -8,7 +8,13 @@ #include
-TurnIndicator::TurnIndicator () +// Use a bigger number to be more responsive, or a smaller number +// to be more sluggish. +#define RESPONSIVENESS 0.5 + + +TurnIndicator::TurnIndicator () : + _last_rate(0) { } @@ -31,7 +37,7 @@ void TurnIndicator::bind () { fgTie("/instrumentation/turn-indicator/serviceable", - &_gyro, &Gyro::is_serviceable); + &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable); fgTie("/instrumentation/turn-indicator/spin", &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm); } @@ -62,8 +68,9 @@ TurnIndicator::update (double dt) else if (rate > 2.5) rate = 2.5; - // Add a lag, based on gyro spin - rate = fgGetLowPass(_last_rate, rate, dt/(factor*3)); + // Lag left, based on gyro spin + rate = -2.5 + (factor * (rate + 2.5)); + rate = fgGetLowPass(_last_rate, rate, dt*RESPONSIVENESS); _last_rate = rate; // Publish the indicated rate