July 12, 200619 yr Well, to control the bank indicator I tried this:double dampening = 0.91;FLOAT64 FSAPI Attitude_Bank_cb(PELEMENT_SPRITE pelement){ FLOAT64 bank_degs; lookup_var(&bank); // MODULE_VAR defined above if(isPowerOn & isGyroPowerOn) { // Battery ON AND Gyro switch ON -track toward var_value bank_degs = bank.var_old.n * dampening + bank.var_value.n * ( 1.0 - dampening ); bank.var_old.n = bank.var_value.n; } else { // Gyro not powered -track toward 28 degrees bank bank_degs = bank.var_old.n * dampening + 28 * ( 1.0 - dampening ); bank.var_old.n = bank.var_value.n; } return bank_degs;}but while the bank indicator moves as desired with both Gyro and Battery off, the second I turn on the Battery, it starts tracking to 0 bank (level) even though the Gyro switch is OFF.Any ideas on why? This seems to be impossible given the code above. Also, I hard coded two returns in the if statement, and they worked as expected. So, must be my formula.Patrick
July 12, 200619 yr Thanks Arne, but even after correcting this mistake it doesn't work.Hmmmm I'll look at it later today, must be something I am missing.Patrick
July 12, 200619 yr After being more awake, correcting the error Arne spotted for me (thanks Arne), and further testing, I have concluded that actually the code was working, only so fast, it syncs up right away, and made me think it was not working.So, I just need to play more with it.Patrick
Create an account or sign in to comment