From 6ab2bca4efc1d656cc4be6dc7c7d4345e75d8e3c Mon Sep 17 00:00:00 2001
From: curt <curt>
Date: Wed, 22 Apr 2009 18:11:23 +0000
Subject: [PATCH] Add a variant of the high res c172 rpm gauge that includes a
 working LCD hobbs meter (instead of the previous "static" hobbs meter that
 was pretty but didn't ever change.)  This requires some aircraft specific
 nasal support since the hobbs meter isn't implemented in the same way on
 every aircraft:

# initialize the hobbs meter and configure to save every 5 minutes
var hobbs = aircraft.timer.new("/instrumentation/clock/hobbs-meter-sec");
aircraft.data.save(5);
hobbs.stop();

setlistener( "/engines/engine[0]/running",
    func {
	var running = getprop("/engines/engine[0]/running");
	if ( running ) {
	    hobbs.start();
	} else {
	    hobbs.stop();
	}
    }
);
setlistener( "/instrumentation/clock/hobbs-meter-sec",
    func {
	var secs = getprop("/instrumentation/clock/hobbs-meter-sec");
	setprop("/instrumentation/clock/hobbs-meter-hours", secs / 3600);
    },
    1
);
---
 Aircraft/Instruments/rpm-c172s-digi-hobbs.xml | 145 ++++++++++++++++++
 1 file changed, 145 insertions(+)
 create mode 100644 Aircraft/Instruments/rpm-c172s-digi-hobbs.xml

diff --git a/Aircraft/Instruments/rpm-c172s-digi-hobbs.xml b/Aircraft/Instruments/rpm-c172s-digi-hobbs.xml
new file mode 100644
index 000000000..d908e1026
--- /dev/null
+++ b/Aircraft/Instruments/rpm-c172s-digi-hobbs.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+
+<!--
+rpm.xml
+
+RPM indicator from C172-S
+
+Martin Dressler dr@musicabona.cz
+Jan 30 2003
+
+
+-->
+
+<PropertyList>
+
+ <name>C172-S RPM Gauge</name>
+ <w-base>512</w-base>
+ <h-base>512</h-base>
+
+ <params>
+  <rpm-select>/engines/engine[0]/rpm</rpm-select>
+ </params>
+    
+ 
+ <layers>
+ 
+  <layer>
+   <name>Backplate</name>
+   <w>512</w>
+   <h>512</h>
+   <texture>
+    <path>Aircraft/Instruments/Textures/rpm1.rgb</path>
+    <x1>0.0</x1>
+    <x2>1.0</x2>
+    <y1>0.0</y1>
+    <y2>1.0</y2>
+   </texture>
+  </layer>
+				  
+  <layer>
+   <name>Hobbs LCD background</name>
+   <texture>
+    <path>Aircraft/Instruments/Textures/faces-3.rgb</path>
+    <x1>0.6</x1>
+    <y1>0.2</y1>
+    <x2>0.9</x2>
+    <y2>0.3</y2>
+   </texture>
+   <w>190</w>
+   <h>43</h>
+   <transformations>
+    <transformation>
+     <type>x-shift</type>
+     <offset>0</offset>
+    </transformation>
+    <transformation>
+     <type>y-shift</type>
+     <offset>-76</offset>
+    </transformation>
+   </transformations>
+  </layer>
+
+  <layer>
+   <name>Digital Hobbs</name>
+   <type>text</type>
+   <font>led</font>
+   <point-size>14</point-size>
+   <color>
+    <red>0.0</red>
+    <green>0.0</green>
+    <blue>0.0</blue>
+   </color>
+   <chunks>
+    <chunk>
+     <type>number-value</type>
+     <property>/instrumentation/clock/hobbs-meter-hours</property>
+     <format>%07.1f</format>
+    </chunk>
+   </chunks>
+   <transformations>
+    <transformation>
+     <type>x-shift</type>
+     <offset>-55</offset>
+    </transformation>
+    <transformation>
+     <type>y-shift</type>
+     <offset>-90</offset>
+    </transformation>
+   </transformations>
+  </layer>
+
+  <layer>
+   <name>Needle</name>
+   <w>264</w>
+   <h>56</h>
+   <texture>
+    <path>Aircraft/Instruments/Textures/misc2.rgb</path>
+    <x1>0.0</x1>
+    <x2>0.515625</x2>
+    <y1>0.4375</y1>
+    <y2>0.546875</y2>
+   </texture>
+   <transformations>
+    <transformation>
+     <type>rotation</type>
+     <property alias="../../../../../params/rpm-select"/>
+     <offset>90</offset>
+     <min>0.0</min>
+     <max>3500.0</max>
+     <scale>1.0</scale>
+     <interpolation>
+      <entry><ind>  0.0</ind><dep>-128.6 </dep></entry>     
+      <entry><ind>  0.1</ind><dep>-123.85</dep></entry>     
+      <entry><ind>  500.0</ind><dep> -92.85</dep></entry>     
+      <entry><ind> 1000.0</ind><dep> -57.1 </dep></entry>     
+      <entry><ind> 1500.0</ind><dep> -21.1 </dep></entry>     
+      <entry><ind> 2000.0</ind><dep>  15.4 </dep></entry>     
+      <entry><ind> 2500.0</ind><dep>  51.4 </dep></entry>     
+      <entry><ind> 3000.0</ind><dep>  87.4 </dep></entry>     
+      <entry><ind> 3500.0</ind><dep> 123.4 </dep></entry>     
+     </interpolation>
+    </transformation>
+    <transformation>
+     <type>x-shift</type>
+     <offset>-49</offset>
+    </transformation>
+   </transformations>
+  </layer>
+
+  <layer>
+   <name>Needle center</name>
+   <w>24</w>
+   <h>24</h>
+   <texture>
+    <path>Aircraft/Instruments/Textures/misc2.rgb</path>
+    <x1>0.515625</x1>
+    <x2>0.5625</x2>
+    <y1>0.4375</y1>
+    <y2>0.484375</y2>
+   </texture>
+  </layer>
+ 
+ </layers>
+
+</PropertyList>