diff --git a/Aircraft/Instruments-3d/clock/M877/M877.nas b/Aircraft/Instruments-3d/clock/M877/M877.nas index 42d989b21..da2a3f13e 100644 --- a/Aircraft/Instruments-3d/clock/M877/M877.nas +++ b/Aircraft/Instruments-3d/clock/M877/M877.nas @@ -1,58 +1,129 @@ -var m877 = { + var m877 = { new : func(prop1){ m = { parents : [m877]}; m.MODE =0; + m.digit_to_set=0; + m.digit=[]; + m.set_mode=0; + m.et_start_time=0; + m.et_countdown=0; + m.et_running=0; + m.et_elapsed=0; + m.ft_start_time=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"); + m.M877 = props.globals.initNode(prop1); + m.tenths=m.M877.initNode("tenths",0,"BOOL"); + m.ET_alarm=m.M877.initNode("et-alarm",0,"BOOL"); + m.FT_alarm=m.M877.initNode("ft-alert",0,"BOOL"); + m.FT_alarm_time=m.M877.initNode("ft-alarm-time",0,"BOOL"); + append(m.digit,m.M877.initNode("digit[0]",1,"BOOL")); + append(m.digit,m.M877.initNode("digit[1]",1,"BOOL")); + append(m.digit,m.M877.initNode("digit[2]",1,"BOOL")); + append(m.digit,m.M877.initNode("digit[3]",1,"BOOL")); + m.modestring=m.M877.initNode("mode-string",m.modetext[m.MODE],"STRING"); + m.power=m.M877.initNode("power",1,"BOOL"); + m.HR=m.M877.initNode("indicated-hour",0,"INT"); + m.MN=m.M877.initNode("indicated-min",0,"INT"); + m.ET_HR=m.M877.initNode("ET-hr",0,"INT"); + m.ET_MN=m.M877.initNode("ET-min",0,"INT"); + m.FT_HR=m.M877.initNode("FT-hr",0,"INT"); + m.FT_MN=m.M877.initNode("FT-min",0,"INT"); return m; }, -#### next mode #### - set_clock : func(){ - var cmode = me.mode.getValue(); - cmode +=1; - if(cmode>3)cmode -=4; - me.mode.setValue(cmode); +#### displayed mode #### + select_display : func(){ + if(me.set_mode==0){ + me.MODE +=1; + if(me.MODE>3)me.MODE -=4; + me.modestring.setValue(me.modetext[me.MODE]); + }else{ + me.digit[me.digit_to_set].setValue(1); + me.digit_to_set+=1; + if(me.digit_to_set>3){ + me.digit_to_set=0; + me.set_mode=0; + } + } }, +#### set displayed mode #### + set_time : func(){ + me.set_mode=1-me.set_mode; + }, +#### CTL button action #### + control_action : func(){ + if(me.set_mode==0){ + if(me.MODE==3){ + if(me.et_running==0){ + me.et_start_time=getprop("/sim/time/elapsed-sec"); + me.et_running=1; + }else{ + me.et_start_time=getprop("/sim/time/elapsed-sec"); + me.et_elapsed=0; + me.et_running=0; + } + } + }else{ + if(me.MODE==0){ + me.set_gmt(); + }elsif(meMODE==1){ + me.set_lt(); + }elsif(meMODE==2){ + me.set_ft(); + }elsif(meMODE==3){ + me.set_et(); + } + } + }, + +#### set GMT #### + set_gmt : func(){ + + }, + +#### set LT #### + set_lt : func(){ + + }, + +#### set FT #### + set_ft : func(){ + + }, + +#### set ET #### + set_et : func(){ + + }, + #### 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; + if(me.et_running!=0){ + me.et_elapsed=getprop("/sim/time/elapsed-sec") - me.et_start_time; + } + var ethour = me.et_elapsed/3600; + var hr= int(ethour); + var etmin=(ethour-hr) * 60; + var min = int(etmin); + var etsec= (etmin- min) *60; + if(ethour <1){ + me.ET_HR.setValue(min); + me.ET_MN.setValue(etsec); + }else{ + me.ET_HR.setValue(hr); + me.ET_MN.setValue(min); } - me.ET_MN.setValue(fmin); - var str = sprintf("%02.0f:%02.0f",inthour,fmin); - me.ET_string.setValue(str); }, #### update clock #### update_clock : func{ + var pwr=me.power.getValue(); + if(me.set_mode==0){ + pwr=1-pwr; + }else{ + pwr=1; + } + me.power.setValue(pwr); me.update_ET(); - var cm = me.mode.getValue(); + var cm = me.MODE; if(cm ==0){ me.HR.setValue(getprop("/instrumentation/clock/indicated-hour")); me.MN.setValue(getprop("/instrumentation/clock/indicated-min")); @@ -72,30 +143,27 @@ var m877 = { me.MN.setValue(me.ET_MN.getValue()); } } + if(me.set_mode==1){ + var flsh=me.digit[me.digit_to_set].getValue(); + flsh=1-flsh; + me.digit[me.digit_to_set].setValue(flsh); + }else{ + me.digit[me.digit_to_set].setValue(1); + } }, }; - +##################################### var davtron=m877.new("instrumentation/clock/m877"); var ETmeter = aircraft.timer.new("/instrumentation/clock/m877/ET-sec", 10); -################################## setlistener("/sim/signals/fdm-initialized", func { - ETmeter.reset(); settimer(update,2); print("Chronometer ... Check"); }); -setlistener("/gear/gear[1]/wow", func(gr){ - if(gr.getBoolValue()){ - ETmeter.stop(); - }else{ - ETmeter.start(); - } -},0,0); - var update = func{ davtron.update_clock(); -settimer(update,1); +settimer(update,0.5); } \ No newline at end of file diff --git a/Aircraft/Instruments-3d/clock/M877/M877.png b/Aircraft/Instruments-3d/clock/M877/M877.png index fadf01b15..7cd6673e1 100644 Binary files a/Aircraft/Instruments-3d/clock/M877/M877.png and b/Aircraft/Instruments-3d/clock/M877/M877.png differ diff --git a/Aircraft/Instruments-3d/clock/M877/M877.rgb b/Aircraft/Instruments-3d/clock/M877/M877.rgb deleted file mode 100644 index c8971b569..000000000 Binary files a/Aircraft/Instruments-3d/clock/M877/M877.rgb and /dev/null differ diff --git a/Aircraft/Instruments-3d/clock/M877/m877.ac b/Aircraft/Instruments-3d/clock/M877/m877.ac index 164e1d3f3..50d27c38e 100644 --- a/Aircraft/Instruments-3d/clock/M877/m877.ac +++ b/Aircraft/Instruments-3d/clock/M877/m877.ac @@ -4,16 +4,19 @@ MATERIAL "glow2" rgb 0.829458 0.829458 0.829458 amb 0.5 0.5 0.5 emis 0.6 0.6 0.6 MATERIAL "glow" rgb 1 1 1 amb 0.5 0.5 0.5 emis 1 1 1 spec 0 0 0 shi 32 trans 0 MATERIAL "glosswhite" rgb 0.8 0.8 0.8 amb 0 0 0 emis 0 0 0 spec 1 1 1 shi 64 trans 0 OBJECT world -kids 13 -OBJECT group -name "CTL.btn" -kids 2 +kids 15 OBJECT poly -name "CTL.btn_0" -data 4 -Cube +name "CTL.btn" +data 8 +Cube.001 +texture "M877.png" +texrep 1 1 crease 30.000000 -numvert 8 +numvert 12 +0.004398 -0.012743 -0.016302 +0.004398 -0.018403 -0.016302 +0.004398 -0.018403 -0.005646 +0.004398 -0.012743 -0.005646 0.002006 -0.012743 -0.016302 0.002006 -0.018403 -0.016302 0.002006 -0.018403 -0.005646 @@ -22,56 +25,42 @@ numvert 8 0.004398 -0.018403 -0.016302 0.004398 -0.018403 -0.005646 0.004398 -0.012743 -0.005646 -numsurf 4 +numsurf 5 SURF 0x00 mat 1 refs 4 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.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.664250850677 0.402652829885 -6 0.664250850677 0.402652829885 -7 0.664250850677 0.486213296652 3 0.664250850677 0.486213296652 +2 0.664250850677 0.402652829885 +1 0.751193165779 0.402652829885 SURF 0x00 mat 1 refs 4 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 4 -Cube -texture "M877.png" -texrep 1 1 -crease 30.000000 -numvert 4 -0.004398 -0.012743 -0.016302 -0.004398 -0.018403 -0.016302 -0.004398 -0.018403 -0.005646 -0.004398 -0.012743 -0.005646 -numsurf 1 +8 0.751193165779 0.486213296652 +9 0.751193165779 0.402652829885 +5 0.751193165779 0.402652829885 SURF 0x00 mat 1 refs 4 -0 0.751193165779 0.486213296652 -3 0.664250850677 0.486213296652 -2 0.664250850677 0.402652829885 -1 0.751193165779 0.402652829885 +5 0.751193165779 0.402652829885 +9 0.751193165779 0.402652829885 +10 0.664250850677 0.402652829885 +6 0.664250850677 0.402652829885 +SURF 0x00 +mat 1 +refs 4 +6 0.664250850677 0.402652829885 +10 0.664250850677 0.402652829885 +11 0.664250850677 0.486213296652 +7 0.664250850677 0.486213296652 +SURF 0x00 +mat 1 +refs 4 +8 0.751193165779 0.486213296652 +4 0.751193165779 0.486213296652 +7 0.664250850677 0.486213296652 +11 0.664250850677 0.486213296652 kids 0 OBJECT poly name "HR.001" @@ -949,36 +938,46 @@ refs 4 15 0.553054749966 0.963210463524 kids 0 OBJECT poly +name "M877.colon" +data 5 +Plane +texture "M877.png" +texrep 1 1 +crease 30.000000 +numvert 4 +0.000961 0.010318 0.000855 +0.000961 0.000885 0.000855 +0.000961 0.000885 -0.001969 +0.000961 0.010318 -0.001969 +numsurf 1 +SURF 0x00 +mat 2 +refs 4 +3 0.957149386406 0.984786868095 +0 0.924547255039 0.984786868095 +1 0.924547195435 0.693980753422 +2 0.957149386406 0.693980753422 +kids 0 +OBJECT poly name "M877.display" data 9 Plane.469 texture "M877.png" texrep 1 1 crease 30.000000 -numvert 8 -0.000961 0.010318 -0.001969 -0.000961 0.000885 -0.001969 -0.000961 0.000885 0.000855 -0.000961 0.010318 0.000855 +numvert 4 0.000579 0.0142 -0.022098 0.000579 -0.004183 -0.022098 0.000579 -0.004183 0.022112 0.000579 0.0142 0.022112 -numsurf 2 +numsurf 1 SURF 0x00 mat 2 refs 4 -0 0.957149386406 0.984786868095 -3 0.924547255039 0.984786868095 -2 0.924547195435 0.693980753422 -1 0.957149386406 0.693980753422 -SURF 0x00 -mat 2 -refs 4 -4 0.976998031139 0.596293568611 -7 0.902328789234 0.596293568611 -6 0.902328789234 0.480971485376 -5 0.976998031139 0.480971485376 +0 0.976998031139 0.596293568611 +3 0.902328789234 0.596293568611 +2 0.902328789234 0.480971485376 +1 0.976998031139 0.480971485376 kids 0 OBJECT poly name "MN.001" @@ -1022,15 +1021,18 @@ refs 4 2 0.0181855931878 0.00866907835007 1 0.0918634906411 0.00866907835007 kids 0 -OBJECT group -name "SEL.btn" -kids 2 OBJECT poly -name "SEL.btn_0" +name "SEL.btn" data 8 -Cube.001 +Cube.002 +texture "M877.png" +texrep 1 1 crease 30.000000 -numvert 8 +numvert 12 +0.004398 -0.012743 0.006863 +0.004398 -0.018403 0.006863 +0.004398 -0.018403 0.01752 +0.004398 -0.012743 0.01752 0.002006 -0.012743 0.006863 0.002006 -0.018403 0.006863 0.002006 -0.018403 0.01752 @@ -1039,56 +1041,63 @@ numvert 8 0.004398 -0.018403 0.006863 0.004398 -0.018403 0.01752 0.004398 -0.012743 0.01752 -numsurf 4 +numsurf 5 SURF 0x00 mat 1 refs 4 0 0.75237852335 0.796478271484 -4 0.75237852335 0.796478271484 -5 0.75237852335 0.708643317223 +3 0.66299623251 0.796478271484 +2 0.66299623251 0.708643317223 1 0.75237852335 0.708643317223 SURF 0x00 mat 1 refs 4 -1 0.75237852335 0.708643317223 -5 0.75237852335 0.708643317223 -6 0.66299623251 0.708643317223 -2 0.66299623251 0.708643317223 +4 0.750929892063 0.795054674149 +8 0.750929892063 0.795054674149 +9 0.750929892063 0.710066914558 +5 0.750929892063 0.710066914558 SURF 0x00 mat 1 refs 4 -2 0.66299623251 0.708643317223 -6 0.66299623251 0.708643317223 -7 0.66299623251 0.796478271484 -3 0.66299623251 0.796478271484 +5 0.750929892063 0.710066914558 +9 0.750929892063 0.710066914558 +10 0.664444863796 0.710066914558 +6 0.664444863796 0.710066914558 SURF 0x00 mat 1 refs 4 -4 0.75237852335 0.796478271484 -0 0.75237852335 0.796478271484 -3 0.66299623251 0.796478271484 -7 0.66299623251 0.796478271484 +6 0.664444863796 0.710066914558 +10 0.664444863796 0.710066914558 +11 0.664444863796 0.795054674149 +7 0.664444863796 0.795054674149 +SURF 0x00 +mat 1 +refs 4 +8 0.750929892063 0.795054674149 +4 0.750929892063 0.795054674149 +7 0.664444863796 0.795054674149 +11 0.664444863796 0.795054674149 kids 0 OBJECT poly -name "SEL.btn_1" +name "SET.btn" data 8 -Cube.001 +Cube.004 texture "M877.png" texrep 1 1 crease 30.000000 numvert 4 -0.004398 -0.012743 0.006863 -0.004398 -0.018403 0.006863 -0.004398 -0.018403 0.01752 -0.004398 -0.012743 0.01752 +0.0019 -0.012311 0.005884 +0.0019 -0.019511 0.005884 +0.0019 -0.019511 -0.004815 +0.0019 -0.012311 -0.004815 numsurf 1 SURF 0x00 -mat 1 +mat 3 refs 4 -0 0.75237852335 0.796478271484 -3 0.66299623251 0.796478271484 -2 0.66299623251 0.708643317223 -1 0.75237852335 0.708643317223 +3 0.838916540146 0.523605704308 +0 0.791258811951 0.523605704308 +1 0.791258811951 0.466369539499 +2 0.838916540146 0.466369539499 kids 0 OBJECT poly name "et" diff --git a/Aircraft/Instruments-3d/clock/M877/m877.xml b/Aircraft/Instruments-3d/clock/M877/m877.xml index c050c1336..2e56ab932 100644 --- a/Aircraft/Instruments-3d/clock/M877/m877.xml +++ b/Aircraft/Instruments-3d/clock/M877/m877.xml @@ -3,13 +3,21 @@ m877.ac + + select + M877.colon + + instrumentation/clock/m877/power + + + select gmt - instrumentation/clock/m877/mode - 0 + instrumentation/clock/m877/mode-string + GMT @@ -19,8 +27,8 @@ lt - instrumentation/clock/m877/mode - 1 + instrumentation/clock/m877/mode-string + LT @@ -30,8 +38,8 @@ ft - instrumentation/clock/m877/mode - 2 + instrumentation/clock/m877/mode-string + FT @@ -41,12 +49,44 @@ et - instrumentation/clock/m877/mode - 3 + instrumentation/clock/m877/mode-string + ET + + select + HR.001 + + instrumentation/clock/m877/digit[3] + + + + + select + HR.002 + + instrumentation/clock/m877/digit[2] + + + + + select + MN.001 + + instrumentation/clock/m877/digit[1] + + + + + select + MN.002 + + instrumentation/clock/m877/digit[0] + + + textranslate HR.001 @@ -101,6 +141,19 @@ + + pick + SEL.btn + + + false + + nasal + + + + + pick CTL.btn @@ -109,10 +162,22 @@ false nasal - + + + pick + SET.btn + + + false + + nasal + + + + \ No newline at end of file