diff --git a/Aircraft/Instruments-3d/clock/M877/M877.nas b/Aircraft/Instruments-3d/clock/M877/M877.nas index e79a7bce1..42d989b21 100644 --- a/Aircraft/Instruments-3d/clock/M877/M877.nas +++ b/Aircraft/Instruments-3d/clock/M877/M877.nas @@ -1,58 +1,101 @@ -var davtron=props.globals.getNode("/instrumentation/clock/m877",1); -var set_hour=davtron.getNode("set-hour",1); -var set_min=davtron.getNode("set-min",1); -var mode=davtron.getNode("mode",1); -var modestring =davtron.getNode("mode-string",1); -var modetext =["GMT","LT","FT","ET"]; -var HR=davtron.getNode("indicated-hour",1); -var MN=davtron.getNode("indicated-min",1); -var MODE = 0; +var m877 = { + new : func(prop1){ + m = { parents : [m877]}; + m.MODE =0; + m.modetext =["GMT","LT","FT","ET"]; + m.M877 = props.globals.getNode(prop1,1); + m.set_hour=m.M877.getNode("set-hour",1); + m.set_hour.setBoolValue(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 { - set_hour.setBoolValue(0); - set_min.setBoolValue(0); - mode.setIntValue(MODE); - modestring.setValue(modetext[MODE]); - HR.setIntValue(0); - MN.setIntValue(0); + ETmeter.reset(); + settimer(update,2); print("Chronometer ... Check"); - settimer(update_clock,2); }); -setlistener("/instrumentation/clock/m877/mode", func(md) { - MODE = md.getValue(); - modestring.setValue(modetext[MODE]); +setlistener("/gear/gear[1]/wow", func(gr){ + if(gr.getBoolValue()){ + ETmeter.stop(); + }else{ + ETmeter.start(); + } },0,0); -var update_clock = func{ - var FThr =getprop("/instrumentation/clock/flight-meter-hour"); - - 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); +var update = func{ +davtron.update_clock(); +settimer(update,1); } \ No newline at end of file diff --git a/Aircraft/Instruments-3d/clock/M877/M877.png b/Aircraft/Instruments-3d/clock/M877/M877.png new file mode 100644 index 000000000..fadf01b15 Binary files /dev/null and b/Aircraft/Instruments-3d/clock/M877/M877.png differ diff --git a/Aircraft/Instruments-3d/clock/M877/m877-hotspots.xml b/Aircraft/Instruments-3d/clock/M877/m877-hotspots.xml deleted file mode 100644 index e332f44eb..000000000 --- a/Aircraft/Instruments-3d/clock/M877/m877-hotspots.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - M877 hotspots - 60 - 60 - 60 - 60 - - - - - - - - mode increment - - -18 - -20 - 12 - 8 - - property-adjust - instrumentation/clock/m877/mode - 1 - 0 - 4 - true - - - - - set time - - -5 - -20 - 9 - 8 - - - - - - increment time - - 5 - -20 - 12 - 8 - - - - - - - \ No newline at end of file diff --git a/Aircraft/Instruments-3d/clock/M877/m877.ac b/Aircraft/Instruments-3d/clock/M877/m877.ac index 21aae95e3..164e1d3f3 100644 --- a/Aircraft/Instruments-3d/clock/M877/m877.ac +++ b/Aircraft/Instruments-3d/clock/M877/m877.ac @@ -10,8 +10,8 @@ name "CTL.btn" kids 2 OBJECT poly name "CTL.btn_0" -data 8 -Cube.118 +data 4 +Cube crease 30.000000 numvert 8 0.002006 -0.012743 -0.016302 @@ -26,37 +26,37 @@ numsurf 4 SURF 0x00 mat 1 refs 4 -0 0.753019213676 0.490330994129 -4 0.753019213676 0.490330904722 -5 0.753019094467 0.398960709572 -1 0.753019213676 0.398960709572 +0 0.751193165779 0.486213296652 +4 0.751193165779 0.486213296652 +5 0.751193165779 0.402652829885 +1 0.751193165779 0.402652829885 SURF 0x00 mat 1 refs 4 -1 0.753019213676 0.398960709572 -5 0.753019094467 0.398960709572 -6 0.662776589394 0.398960769176 -2 0.662776589394 0.398960709572 +1 0.751193165779 0.402652829885 +5 0.751193165779 0.402652829885 +6 0.664250850677 0.402652829885 +2 0.664250850677 0.402652829885 SURF 0x00 mat 1 refs 4 -2 0.662776589394 0.398960709572 -6 0.662776589394 0.398960769176 -7 0.662776589394 0.490330994129 -3 0.662776589394 0.490330994129 +2 0.664250850677 0.402652829885 +6 0.664250850677 0.402652829885 +7 0.664250850677 0.486213296652 +3 0.664250850677 0.486213296652 SURF 0x00 mat 1 refs 4 -4 0.753019213676 0.490330904722 -0 0.753019213676 0.490330994129 -3 0.662776589394 0.490330994129 -7 0.662776589394 0.490330994129 +4 0.751193165779 0.486213296652 +0 0.751193165779 0.486213296652 +3 0.664250850677 0.486213296652 +7 0.664250850677 0.486213296652 kids 0 OBJECT poly name "CTL.btn_1" -data 8 -Cube.118 -texture "M877.rgb" +data 4 +Cube +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -68,16 +68,16 @@ numsurf 1 SURF 0x00 mat 1 refs 4 -0 0.753019213676 0.490330904722 -3 0.662776589394 0.490330994129 -2 0.662776589394 0.398960769176 -1 0.753019094467 0.398960709572 +0 0.751193165779 0.486213296652 +3 0.664250850677 0.486213296652 +2 0.664250850677 0.402652829885 +1 0.751193165779 0.402652829885 kids 0 OBJECT poly name "HR.001" data 9 Plane.472 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -98,7 +98,7 @@ OBJECT poly name "HR.002" data 9 Plane.477 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -119,7 +119,7 @@ OBJECT poly name "M877" data 10 Circle.050 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 102 @@ -798,7 +798,7 @@ OBJECT poly name "M877.002" data 10 Circle.054 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 32 @@ -952,7 +952,7 @@ OBJECT poly name "M877.display" data 9 Plane.469 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 8 @@ -984,7 +984,7 @@ OBJECT poly name "MN.001" data 9 Plane.479 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -1005,7 +1005,7 @@ OBJECT poly name "MN.002" data 9 Plane.478 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -1028,7 +1028,7 @@ kids 2 OBJECT poly name "SEL.btn_0" data 8 -Cube.111 +Cube.001 crease 30.000000 numvert 8 0.002006 -0.012743 0.006863 @@ -1043,37 +1043,37 @@ numsurf 4 SURF 0x00 mat 1 refs 4 -0 0.753685772419 0.799804747105 -4 0.753685772419 0.7998046875 -5 0.753685712814 0.704666018486 -1 0.753685772419 0.704666018486 +0 0.75237852335 0.796478271484 +4 0.75237852335 0.796478271484 +5 0.75237852335 0.708643317223 +1 0.75237852335 0.708643317223 SURF 0x00 mat 1 refs 4 -1 0.753685772419 0.704666018486 -5 0.753685712814 0.704666018486 -6 0.661955595016 0.704666078091 -2 0.661955595016 0.704666018486 +1 0.75237852335 0.708643317223 +5 0.75237852335 0.708643317223 +6 0.66299623251 0.708643317223 +2 0.66299623251 0.708643317223 SURF 0x00 mat 1 refs 4 -2 0.661955595016 0.704666018486 -6 0.661955595016 0.704666078091 -7 0.661955595016 0.799804747105 -3 0.661955595016 0.799804747105 +2 0.66299623251 0.708643317223 +6 0.66299623251 0.708643317223 +7 0.66299623251 0.796478271484 +3 0.66299623251 0.796478271484 SURF 0x00 mat 1 refs 4 -4 0.753685772419 0.7998046875 -0 0.753685772419 0.799804747105 -3 0.661955595016 0.799804747105 -7 0.661955595016 0.799804747105 +4 0.75237852335 0.796478271484 +0 0.75237852335 0.796478271484 +3 0.66299623251 0.796478271484 +7 0.66299623251 0.796478271484 kids 0 OBJECT poly name "SEL.btn_1" data 8 -Cube.111 -texture "M877.rgb" +Cube.001 +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -1085,16 +1085,16 @@ numsurf 1 SURF 0x00 mat 1 refs 4 -0 0.753685772419 0.7998046875 -3 0.661955595016 0.799804747105 -2 0.661955595016 0.704666078091 -1 0.753685712814 0.704666018486 +0 0.75237852335 0.796478271484 +3 0.66299623251 0.796478271484 +2 0.66299623251 0.708643317223 +1 0.75237852335 0.708643317223 kids 0 OBJECT poly name "et" data 9 Plane.485 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -1115,7 +1115,7 @@ OBJECT poly name "ft" data 9 Plane.484 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -1136,7 +1136,7 @@ OBJECT poly name "gmt" data 9 Plane.482 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 @@ -1157,7 +1157,7 @@ OBJECT poly name "lt" data 9 Plane.483 -texture "M877.rgb" +texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 diff --git a/Aircraft/Instruments-3d/clock/M877/m877.xml b/Aircraft/Instruments-3d/clock/M877/m877.xml index 8d95dc898..c050c1336 100644 --- a/Aircraft/Instruments-3d/clock/M877/m877.xml +++ b/Aircraft/Instruments-3d/clock/M877/m877.xml @@ -99,4 +99,20 @@ + + + + pick + CTL.btn + + + false + + nasal + + + + + + \ No newline at end of file diff --git a/Aircraft/Instruments-3d/clock/M877/note.txt b/Aircraft/Instruments-3d/clock/M877/note.txt new file mode 100644 index 000000000..dda6943af --- /dev/null +++ b/Aircraft/Instruments-3d/clock/M877/note.txt @@ -0,0 +1,6 @@ +The M877.nas must be loaded in the set file like this ... + + + Aircraft/Instruments-3d/clock/m877/M877.nas + + \ No newline at end of file