From c6568ace496fa2e90e14fa98aab612d612014a77 Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Sun, 31 Jan 2021 11:23:33 +0100 Subject: [PATCH] More realisting compass easing --- .../ND/canvas/framework/navdisplay.nas | 28 ++++++++++--------- Models/Instruments/ND/canvas/res/airbusND.svg | 8 +++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index 64527ec1..6acc0dda 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -288,19 +288,21 @@ canvas.NavDisplay.update_sub = func(){ userHdgTrkTru = userTrkTru; me.symbols.hdgTrk.setText("TRK"); } else { - var dist = int(userHdg - me.lastCompassRot); - if (dist>180) dist = dist - 360; - elsif (dist<-180) dist = 360 + dist; - if (dist>0) { - dist = dist * 0.3; - if (dist>20) dist = 20; - me.lastCompassRot = (dist<1) ? userHdg : me.lastCompassRot+dist; - } - elsif (dist<0) { - dist = dist * 0.3; - if (dist<-20) dist = -20; - me.lastCompassRot = (dist>-1) ? userHdg : me.lastCompassRot+dist; - } + var dist = userHdg - me.lastCompassRot; + if (dist != 0) { + if (dist>180) dist = dist - 360; + elsif (dist<-180) dist = 360 + dist; + if (dist>0) { + dist = dist * 0.3; + if (dist>10) dist = 10; + me.lastCompassRot = (dist<0.2) ? userHdg : math.mod(me.lastCompassRot+dist,360); + } + elsif (dist<0) { + dist = dist * 0.3; + if (dist<-10) dist = -10; + me.lastCompassRot = (dist>-0.2) ? userHdg : math.mod(me.lastCompassRot+dist,360); + } + } userHdgTrk = me.lastCompassRot; me.userHdgTrk = me.lastCompassRot; userHdgTrkTru = userHdgTru; diff --git a/Models/Instruments/ND/canvas/res/airbusND.svg b/Models/Instruments/ND/canvas/res/airbusND.svg index 343918c0..7a4cdeb8 100644 --- a/Models/Instruments/ND/canvas/res/airbusND.svg +++ b/Models/Instruments/ND/canvas/res/airbusND.svg @@ -1320,13 +1320,13 @@ style="font-size:36px;line-height:1.25;fill:#179ab7;fill-opacity:1">999999