From 4abf04a8c05f5431b768c4e070d66926a9fb5a72 Mon Sep 17 00:00:00 2001
From: Jonathan Redpath <legoboyvdlp@gmail.com>
Date: Sun, 1 May 2022 20:27:03 +0100
Subject: [PATCH] Stby compass

---
 A320-main.xml                         |  1 +
 Models/FlightDeck/a320.flightdeck.xml | 41 +++++++++++++++++++++++++++
 Systems/a320-cockpit.xml              |  5 ++++
 3 files changed, 47 insertions(+)

diff --git a/A320-main.xml b/A320-main.xml
index 2ffcb2bd..713eb889 100644
--- a/A320-main.xml
+++ b/A320-main.xml
@@ -898,6 +898,7 @@
 			<park-brk-translate type="double">0</park-brk-translate>
 			<qnh-cpt-knb-translate type="double">0.0015</qnh-cpt-knb-translate>
 			<qnh-fo-knb-translate type="double">0.0015</qnh-fo-knb-translate>
+			<stby-compass type="bool">false</stby-compass>
 		</cockpit>
 		<CVR>
 			<erase type="bool">0</erase>
diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml
index 21b6e78e..a8f8940c 100644
--- a/Models/FlightDeck/a320.flightdeck.xml
+++ b/Models/FlightDeck/a320.flightdeck.xml
@@ -21848,6 +21848,47 @@
 
 	<!-- Overhead Panel -->
 	
+	<!-- Standby Compass -->
+	<animation>
+		<type>pick</type>
+		<object-name>compass_box</object-name>
+		<action>
+			<button>0</button>
+			<repeatable>false</repeatable>
+			<binding>
+				<command>property-toggle</command>
+				<property>controls/cockpit/stby-compass</property>
+			</binding>
+		</action>
+		<hovered>
+			<binding>
+				<command>set-tooltip</command>
+				<tooltip-id>stby-compass-lbl</tooltip-id>
+				<label>Standby compass</label>
+			</binding>
+		</hovered>
+	</animation>
+	
+	<animation>
+		<type>translate</type>
+		<object-name>compass_box</object-name>
+		<object-name>compass_box.wheel</object-name>
+		<property>controls/cockpit/stby-compass-pos</property>
+		<factor>0.055</factor>
+		<axis>
+			<z>-1</z>
+		</axis>
+	</animation>
+	
+	<animation>
+		<type>rotate</type>
+		<object-name>compass_box.wheel</object-name>
+		<property>/orientation/heading-magnetic-deg</property>
+		<axis>
+			<object-name>compass_box.wheel.axis</object-name>
+		</axis>
+	</animation>
+	
 	<!-- Rain protection -->
 	<animation>
 		<type>pick</type>
diff --git a/Systems/a320-cockpit.xml b/Systems/a320-cockpit.xml
index dadd99af..9d799f18 100644
--- a/Systems/a320-cockpit.xml
+++ b/Systems/a320-cockpit.xml
@@ -529,6 +529,11 @@
 			<input>/controls/radio/rmp[1]/nav-protect</input>
 			<c1>20</c1>
 		</lag_filter>
+		
+		<lag_filter name="/controls/cockpit/stby-compass-pos">
+			<input>/controls/cockpit/stby-compass</input>
+			<c1>5</c1>
+		</lag_filter>
 	
 	</channel>