1
0
Fork 0

Bring M877 clock up to speed ...

This commit is contained in:
sydadams 2009-03-18 03:37:52 +00:00
parent 96992eef67
commit 1b6b77d788
6 changed files with 174 additions and 176 deletions

View file

@ -1,58 +1,101 @@
var davtron=props.globals.getNode("/instrumentation/clock/m877",1); var m877 = {
var set_hour=davtron.getNode("set-hour",1); new : func(prop1){
var set_min=davtron.getNode("set-min",1); m = { parents : [m877]};
var mode=davtron.getNode("mode",1); m.MODE =0;
var modestring =davtron.getNode("mode-string",1); m.modetext =["GMT","LT","FT","ET"];
var modetext =["GMT","LT","FT","ET"]; m.M877 = props.globals.getNode(prop1,1);
var HR=davtron.getNode("indicated-hour",1); m.set_hour=m.M877.getNode("set-hour",1);
var MN=davtron.getNode("indicated-min",1); m.set_hour.setBoolValue(0);
var MODE = 0; m.set_min=m.M877.getNode("set-min",1);
m.set_min.setBoolValue(0);
m.mode=m.M877.getNode("mode",1);
m.mode.setIntValue(m.MODE);
m.tenths=m.M877.getNode("display-tenths",1);
m.tenths.setBoolValue(0);
m.modestring=m.M877.getNode("mode-string",1);
m.modestring.setValue(m.modetext[m.MODE]);
m.HR=m.M877.getNode("indicated-hour",1);
m.HR.setIntValue(0);
m.MN=m.M877.getNode("indicated-min",1);
m.MN.setIntValue(0);
m.ET_HR=m.M877.getNode("ET-hr",1);
m.ET_HR.setIntValue(0);
m.ET_MN=m.M877.getNode("ET-min",1);
m.ET_MN.setIntValue(0);
m.ET_string=m.M877.getNode("ET-string",1);
m.ET_string.setValue("00:00");
return m;
},
#### next mode ####
set_clock : func(){
var cmode = me.mode.getValue();
cmode +=1;
if(cmode>3)cmode -=4;
me.mode.setValue(cmode);
},
#### elapsed time ####
update_ET : func(){
var fmeter = getprop("/instrumentation/clock/m877/ET-sec");
var fhour = fmeter/3600;
var inthour =int(fhour);
me.ET_HR.setValue(inthour);
var fmin = (fhour - inthour);
if(me.tenths.getBoolValue()){
fmin *=100;
}else{
fmin *=60;
}
me.ET_MN.setValue(fmin);
var str = sprintf("%02.0f:%02.0f",inthour,fmin);
me.ET_string.setValue(str);
},
#### update clock ####
update_clock : func{
me.update_ET();
var cm = me.mode.getValue();
if(cm ==0){
me.HR.setValue(getprop("/instrumentation/clock/indicated-hour"));
me.MN.setValue(getprop("/instrumentation/clock/indicated-min"));
}elsif(cm == 1) {
me.HR.setValue(getprop("/instrumentation/clock/local-hour"));
me.MN.setValue(getprop("/instrumentation/clock/indicated-min"));
}elsif(cm == 2) {
var FTH = getprop("instrumentation/clock/flight-meter-sec");
if(FTH != nil){
me.HR.setValue(getprop("instrumentation/clock/flight-meter-hour"));
me.MN.setValue(getprop("instrumentation/clock/flight-meter-min"));
}
}elsif(cm == 3) {
var ETH = me.ET_HR.getValue();
if(ETH != nil){
me.HR.setValue(me.ET_HR.getValue());
me.MN.setValue(me.ET_MN.getValue());
}
}
},
};
var davtron=m877.new("instrumentation/clock/m877");
var ETmeter = aircraft.timer.new("/instrumentation/clock/m877/ET-sec", 10);
##################################
setlistener("/sim/signals/fdm-initialized", func { setlistener("/sim/signals/fdm-initialized", func {
set_hour.setBoolValue(0); ETmeter.reset();
set_min.setBoolValue(0); settimer(update,2);
mode.setIntValue(MODE);
modestring.setValue(modetext[MODE]);
HR.setIntValue(0);
MN.setIntValue(0);
print("Chronometer ... Check"); print("Chronometer ... Check");
settimer(update_clock,2);
}); });
setlistener("/instrumentation/clock/m877/mode", func(md) { setlistener("/gear/gear[1]/wow", func(gr){
MODE = md.getValue(); if(gr.getBoolValue()){
modestring.setValue(modetext[MODE]); ETmeter.stop();
}else{
ETmeter.start();
}
},0,0); },0,0);
var update_clock = func{ var update = func{
var FThr =getprop("/instrumentation/clock/flight-meter-hour"); davtron.update_clock();
settimer(update,1);
var FM =0;
if (MODE == 0) {
setprop("/instrumentation/clock/m877/indicated-hour",getprop("/instrumentation/clock/indicated-hour"));
setprop("/instrumentation/clock/m877/indicated-min",getprop("/instrumentation/clock/indicated-min"));
}
if (MODE == 1) {
setprop("/instrumentation/clock/m877/indicated-hour",getprop("/instrumentation/clock/local-hour"));
setprop("/instrumentation/clock/m877/indicated-min",getprop("/instrumentation/clock/indicated-min"));
}
if (MODE == 2) {
setprop("/instrumentation/clock/m877/indicated-hour",FThr);
FH = getprop("/instrumentation/clock/m877/indicated-hour");
FM = FThr - FH;
FM = FM * 60;
setprop("/instrumentation/clock/m877/indicated-min",FM);
}
if (MODE == 3) {
var ETH = getprop("/instrumentation/clock/ET-hr");
if(ETH != nil){
setprop("/instrumentation/clock/m877/indicated-hour",getprop("/instrumentation/clock/ET-hr"));
setprop("/instrumentation/clock/m877/indicated-min",getprop("/instrumentation/clock/ET-min"));
}
}
settimer(update_clock,0);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -1,67 +0,0 @@
<?xml version="1.0"?>
<!--Davtron M877 Chronometer-->
<PropertyList>
<name>M877 hotspots</name>
<w-base>60</w-base>
<h-base>60</h-base>
<w>60</w>
<h>60</h>
<layers>
</layers>
<actions>
<!--
<action>
<name>outline</name>
<button>0</button>
<x>-30</x>
<y>-30</y>
<w>60</w>
<h>60</h>
</action>
-->
<action>
<name>mode increment</name>
<button>0</button>
<x>-18</x>
<y>-20</y>
<w>12</w>
<h>8</h>
<binding>
<command>property-adjust</command>
<property>instrumentation/clock/m877/mode</property>
<step>1</step>
<min>0</min>
<max>4</max>
<wrap>true</wrap>
</binding>
</action>
<action>
<name>set time</name>
<button>0</button>
<x>-5</x>
<y>-20</y>
<w>9</w>
<h>8</h>
<binding>
</binding>
</action>
<action>
<name>increment time</name>
<button>0</button>
<x>5</x>
<y>-20</y>
<w>12</w>
<h>8</h>
<binding>
</binding>
</action>
</actions>
</PropertyList>

View file

@ -10,8 +10,8 @@ name "CTL.btn"
kids 2 kids 2
OBJECT poly OBJECT poly
name "CTL.btn_0" name "CTL.btn_0"
data 8 data 4
Cube.118 Cube
crease 30.000000 crease 30.000000
numvert 8 numvert 8
0.002006 -0.012743 -0.016302 0.002006 -0.012743 -0.016302
@ -26,37 +26,37 @@ numsurf 4
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
0 0.753019213676 0.490330994129 0 0.751193165779 0.486213296652
4 0.753019213676 0.490330904722 4 0.751193165779 0.486213296652
5 0.753019094467 0.398960709572 5 0.751193165779 0.402652829885
1 0.753019213676 0.398960709572 1 0.751193165779 0.402652829885
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
1 0.753019213676 0.398960709572 1 0.751193165779 0.402652829885
5 0.753019094467 0.398960709572 5 0.751193165779 0.402652829885
6 0.662776589394 0.398960769176 6 0.664250850677 0.402652829885
2 0.662776589394 0.398960709572 2 0.664250850677 0.402652829885
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
2 0.662776589394 0.398960709572 2 0.664250850677 0.402652829885
6 0.662776589394 0.398960769176 6 0.664250850677 0.402652829885
7 0.662776589394 0.490330994129 7 0.664250850677 0.486213296652
3 0.662776589394 0.490330994129 3 0.664250850677 0.486213296652
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
4 0.753019213676 0.490330904722 4 0.751193165779 0.486213296652
0 0.753019213676 0.490330994129 0 0.751193165779 0.486213296652
3 0.662776589394 0.490330994129 3 0.664250850677 0.486213296652
7 0.662776589394 0.490330994129 7 0.664250850677 0.486213296652
kids 0 kids 0
OBJECT poly OBJECT poly
name "CTL.btn_1" name "CTL.btn_1"
data 8 data 4
Cube.118 Cube
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -68,16 +68,16 @@ numsurf 1
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
0 0.753019213676 0.490330904722 0 0.751193165779 0.486213296652
3 0.662776589394 0.490330994129 3 0.664250850677 0.486213296652
2 0.662776589394 0.398960769176 2 0.664250850677 0.402652829885
1 0.753019094467 0.398960709572 1 0.751193165779 0.402652829885
kids 0 kids 0
OBJECT poly OBJECT poly
name "HR.001" name "HR.001"
data 9 data 9
Plane.472 Plane.472
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -98,7 +98,7 @@ OBJECT poly
name "HR.002" name "HR.002"
data 9 data 9
Plane.477 Plane.477
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -119,7 +119,7 @@ OBJECT poly
name "M877" name "M877"
data 10 data 10
Circle.050 Circle.050
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 102 numvert 102
@ -798,7 +798,7 @@ OBJECT poly
name "M877.002" name "M877.002"
data 10 data 10
Circle.054 Circle.054
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 32 numvert 32
@ -952,7 +952,7 @@ OBJECT poly
name "M877.display" name "M877.display"
data 9 data 9
Plane.469 Plane.469
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 8 numvert 8
@ -984,7 +984,7 @@ OBJECT poly
name "MN.001" name "MN.001"
data 9 data 9
Plane.479 Plane.479
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -1005,7 +1005,7 @@ OBJECT poly
name "MN.002" name "MN.002"
data 9 data 9
Plane.478 Plane.478
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -1028,7 +1028,7 @@ kids 2
OBJECT poly OBJECT poly
name "SEL.btn_0" name "SEL.btn_0"
data 8 data 8
Cube.111 Cube.001
crease 30.000000 crease 30.000000
numvert 8 numvert 8
0.002006 -0.012743 0.006863 0.002006 -0.012743 0.006863
@ -1043,37 +1043,37 @@ numsurf 4
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
0 0.753685772419 0.799804747105 0 0.75237852335 0.796478271484
4 0.753685772419 0.7998046875 4 0.75237852335 0.796478271484
5 0.753685712814 0.704666018486 5 0.75237852335 0.708643317223
1 0.753685772419 0.704666018486 1 0.75237852335 0.708643317223
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
1 0.753685772419 0.704666018486 1 0.75237852335 0.708643317223
5 0.753685712814 0.704666018486 5 0.75237852335 0.708643317223
6 0.661955595016 0.704666078091 6 0.66299623251 0.708643317223
2 0.661955595016 0.704666018486 2 0.66299623251 0.708643317223
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
2 0.661955595016 0.704666018486 2 0.66299623251 0.708643317223
6 0.661955595016 0.704666078091 6 0.66299623251 0.708643317223
7 0.661955595016 0.799804747105 7 0.66299623251 0.796478271484
3 0.661955595016 0.799804747105 3 0.66299623251 0.796478271484
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
4 0.753685772419 0.7998046875 4 0.75237852335 0.796478271484
0 0.753685772419 0.799804747105 0 0.75237852335 0.796478271484
3 0.661955595016 0.799804747105 3 0.66299623251 0.796478271484
7 0.661955595016 0.799804747105 7 0.66299623251 0.796478271484
kids 0 kids 0
OBJECT poly OBJECT poly
name "SEL.btn_1" name "SEL.btn_1"
data 8 data 8
Cube.111 Cube.001
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -1085,16 +1085,16 @@ numsurf 1
SURF 0x00 SURF 0x00
mat 1 mat 1
refs 4 refs 4
0 0.753685772419 0.7998046875 0 0.75237852335 0.796478271484
3 0.661955595016 0.799804747105 3 0.66299623251 0.796478271484
2 0.661955595016 0.704666078091 2 0.66299623251 0.708643317223
1 0.753685712814 0.704666018486 1 0.75237852335 0.708643317223
kids 0 kids 0
OBJECT poly OBJECT poly
name "et" name "et"
data 9 data 9
Plane.485 Plane.485
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -1115,7 +1115,7 @@ OBJECT poly
name "ft" name "ft"
data 9 data 9
Plane.484 Plane.484
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -1136,7 +1136,7 @@ OBJECT poly
name "gmt" name "gmt"
data 9 data 9
Plane.482 Plane.482
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4
@ -1157,7 +1157,7 @@ OBJECT poly
name "lt" name "lt"
data 9 data 9
Plane.483 Plane.483
texture "M877.rgb" texture "M877.png"
texrep 1 1 texrep 1 1
crease 30.000000 crease 30.000000
numvert 4 numvert 4

View file

@ -99,4 +99,20 @@
</axis> </axis>
</animation> </animation>
<!-- -hotspots -->
<animation>
<type>pick</type>
<object-name>CTL.btn</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>m877.davtron.set_clock();</script>
</binding>
</action>
</animation>
</PropertyList> </PropertyList>

View file

@ -0,0 +1,6 @@
The M877.nas must be loaded in the set file like this ...
<nasal>
<m877>
<file>Aircraft/Instruments-3d/clock/m877/M877.nas</file>
</m877>
</nasal>