1
0
Fork 0

switch from getNode to initNode

This commit is contained in:
sydadams 2010-02-28 22:48:21 +00:00
parent 4ddd8a8934
commit e41cd335b4

View file

@ -21,123 +21,71 @@ var P1000 = {
m.primus = props.globals.getNode("instrumentation/"~prop,1); m.primus = props.globals.getNode("instrumentation/"~prop,1);
m.PFD = m.primus.getNode("pfd",1); m.PFD = m.primus.getNode("pfd",1);
m.PFD_serv = m.PFD.getNode("serviceable",1); m.PFD_serv = m.PFD.initNode("serviceable",1,"BOOL");
m.PFD_serv.setBoolValue(1); m.PFD_bright = m.PFD.initNode("dimmer",0.8,"DOUBLE");
m.PFD_bright = m.PFD.getNode("dimmer",1); m.PFD_ptr1_src = m.PFD.initNode("nav1-ptr-source",m.NAV_PTR_SRC[0],"STRING");
m.PFD_bright.setDoubleValue(0.8); m.PFD_ptr2_src = m.PFD.initNode("nav2-ptr-source",m.NAV_PTR_SRC[0],"STRING");
m.PFD_ptr1_src = m.PFD.getNode("nav1-ptr-source",1); m.PFD_timer_msg1 = m.PFD.initNode("timer-label",m.TIMER_MSG1[0],"STRING");
m.PFD_ptr1_src.setValue(m.NAV_PTR_SRC[0]); m.PFD_timer_msg2 = m.PFD.initNode("timer-units",m.TIMER_MSG2[0],"STRING");
m.PFD_ptr2_src = m.PFD.getNode("nav2-ptr-source",1);
m.PFD_ptr2_src.setValue(m.NAV_PTR_SRC[0]);
m.PFD_timer_msg1 = m.PFD.getNode("timer-label",1);
m.PFD_timer_msg1.setValue(m.TIMER_MSG1[0]);
m.PFD_timer_msg2 = m.PFD.getNode("timer-units",1);
m.PFD_timer_msg2.setValue(m.TIMER_MSG2[0]);
m.MFD = m.primus.getNode("mfd",1); m.MFD = m.primus.initNode("mfd",1);
m.MFD_serv = m.MFD.getNode("serviceable",1); m.MFD_serv = m.MFD.initNode("serviceable",1,"BOOL");
m.MFD_serv.setBoolValue(1); m.MFD_bright = m.MFD.initNode("dimmer",0.8,"DOUBLE");
m.MFD_serv.setBoolValue(1); m.MFD_menu_num = m.MFD.initNode("menu-num",0,"INT");
m.MFD_bright = m.MFD.getNode("dimmer",1); m.MFD_menu_line1 = m.MFD.initNode("menu-text",m.MFD_MENU1[0],"STRING");
m.MFD_bright.setDoubleValue(0.8); m.MFD_menu_col1 = m.MFD.initNode("menu-val[0]"," ","STRING");
m.MFD_menu_num = m.MFD.getNode("menu-num",1); m.MFD_menu_col2 = m.MFD.initNode("menu-val[1]"," ","STRING");
m.MFD_menu_num.setIntValue(0); m.MFD_menu_col3 = m.MFD.initNode("menu-val[2]"," ","STRING");
m.MFD_menu_line1 = m.MFD.getNode("menu-text",1); m.MFD_menu_col4 = m.MFD.initNode("menu-val[3]"," ","STRING");
m.MFD_menu_line1.setValue(m.MFD_MENU1[0]); m.MFD_settings = m.MFD.initNode("settings",1);
m.MFD_menu_col1 = m.MFD.getNode("menu-val[0]",1); m.MFD_to = m.MFD_settings.initNode("to",0.0);
m.MFD_menu_col1.setValue(" "); m.MFD_st_el = m.MFD_settings.initNode("st-el",0.0);
m.MFD_menu_col2 = m.MFD.getNode("menu-val[1]",1); m.MFD_vang = m.MFD_settings.initNode("vang",0.0);
m.MFD_menu_col2.setValue(" "); m.MFD_vs = m.MFD_settings.initNode("vs",0.0);
m.MFD_menu_col3 = m.MFD.getNode("menu-val[2]",1); m.MFD_v1 = m.MFD_settings.initNode("v1",0.0);
m.MFD_menu_col3.setValue(" "); m.MFD_vr = m.MFD_settings.initNode("vr",0.0);
m.MFD_menu_col4 = m.MFD.getNode("menu-val[3]",1); m.MFD_v2 = m.MFD_settings.initNode("v2",0.0);
m.MFD_menu_col4.setValue(" "); m.MFD_vref = m.MFD_settings.initNode("vref",0.0);
m.MFD_settings = m.MFD.getNode("settings",1); m.MFD_vapp = m.MFD_settings.initNode("vapp",0.0);
m.MFD_to = m.MFD_settings.getNode("to",1);
m.MFD_to.setDoubleValue(0);
m.MFD_st_el = m.MFD_settings.getNode("st-el",1);
m.MFD_st_el.setDoubleValue(0);
m.MFD_vang = m.MFD_settings.getNode("vang",1);
m.MFD_vang.setDoubleValue(0);
m.MFD_vs = m.MFD_settings.getNode("vs",1);
m.MFD_vs.setDoubleValue(0);
m.MFD_v1 = m.MFD_settings.getNode("v1",1);
m.MFD_v1.setDoubleValue(0);
m.MFD_vr = m.MFD_settings.getNode("vr",1);
m.MFD_vr.setDoubleValue(0);
m.MFD_v2 = m.MFD_settings.getNode("v2",1);
m.MFD_v2.setDoubleValue(0);
m.MFD_vref = m.MFD_settings.getNode("vref",1);
m.MFD_vref.setDoubleValue(0);
m.MFD_vapp = m.MFD_settings.getNode("vapp",1);
m.MFD_vapp.setDoubleValue(0);
m.EICAS = m.primus.getNode("eicas",1); m.EICAS = m.primus.initNode("eicas");
m.EICAS_serv = m.EICAS.getNode("serviceable",1); m.EICAS_serv = m.EICAS.initNode("serviceable",1,"BOOL");
m.EICAS_serv.setBoolValue(1);
m.Control = m.primus.getNode("control",1); m.Control = m.primus.initNode("control");
m.ctl_tcas = m.Control.getNode("tcas",1); m.ctl_tcas = m.Control.initNode("tcas",0,"BOOL");
m.ctl_tcas.setBoolValue(0); m.ctl_hsi = m.Control.initNode("hsi",0,"BOOL");
m.ctl_hsi = m.Control.getNode("hsi",1); m.ctl_cp = m.Control.initNode("cp",0,"BOOL");
m.ctl_hsi.setBoolValue(0); m.ctl_hpa = m.Control.initNode("hpa",0,"BOOL");
m.ctl_cp = m.Control.getNode("cp",1); m.ctl_gspd = m.Control.initNode("timer",0,"INT");
m.ctl_cp.setBoolValue(0); m.ctl_nav = m.Control.initNode("nav",0,"INT");
m.ctl_hpa = m.Control.getNode("hpa",1); m.ctl_fms = m.Control.initNode("fms",0,"BOOL");
m.ctl_hpa.setBoolValue(0); m.ctl_RA = m.Control.initNode("RA-alert",1,"BOOL");
m.ctl_gspd = m.Control.getNode("timer",1); m.ctl_rng = m.Control.initNode("rng-switch",0.0);
m.ctl_gspd.setIntValue(0); m.DH = m.Control.initNode("decision-height",m.dh,"DOUBLE");
m.ctl_nav = m.Control.getNode("nav",1);
m.ctl_nav.setIntValue(0);
m.ctl_fms = m.Control.getNode("fms",1);
m.ctl_fms.setBoolValue(0);
m.ctl_RA = m.Control.getNode("RA-alert",1);
m.ctl_RA.setBoolValue(1);
m.ctl_rng = m.Control.getNode("rng-switch",1);
m.ctl_rng.setDoubleValue(0);
m.DH = m.Control.getNode("decision-height",1);
m.DH.setDoubleValue(m.dh);
setprop("instrumentation/mk-viii/inputs/arinc429/decision-height",m.dh); setprop("instrumentation/mk-viii/inputs/arinc429/decision-height",m.dh);
setprop("autopilot/route-manager/min-lock-altitude-agl-ft",m.dh); setprop("autopilot/route-manager/min-lock-altitude-agl-ft",m.dh);
m.NavPtr1 =m.Control.getNode("nav1ptr",1); m.NavPtr1 =m.Control.initNode("nav1ptr",0.0);
m.NavPtr1.setDoubleValue(0); m.NavPtr2 =m.Control.initNode("nav2ptr",0.0);
m.NavPtr2 =m.Control.getNode("nav2ptr",1); m.NavPtr1_offset =m.PFD.initNode("nav1ptr-hdg-offset",0.0);
m.NavPtr2.setDoubleValue(0); m.NavPtr2_offset =m.PFD.initNode("nav2ptr-hdg-offset",0.0);
m.NavPtr1_offset =m.PFD.getNode("nav1ptr-hdg-offset",1);
m.NavPtr1_offset.setDoubleValue(0);
m.NavPtr2_offset =m.PFD.getNode("nav2ptr-hdg-offset",1);
m.NavPtr2_offset.setDoubleValue(0);
m.CRStype =m.primus.getNode("course-string",1); m.CRStype =m.primus.initNode("course-string","CRS");
m.CRStype.setValue("CRS"); m.CRSheading =m.primus.initNode("course-heading",0.0);
m.CRSheading =m.primus.getNode("course-heading",1); m.GS_inrange =m.primus.initNode("GS-in-range",0,"BOOL");
m.CRSheading.setDoubleValue(0); m.GS_deflection =m.primus.initNode("GS-deflection",0.0);
m.GS_inrange =m.primus.getNode("GS-in-range",1); m.CRSdeflection =m.primus.initNode("course-deflection",0.0);
m.GS_inrange.setBoolValue(0); m.NavDist =m.primus.initNode("nav-dist-nm",0.0);
m.GS_deflection =m.primus.getNode("GS-deflection",1); m.NavType =m.primus.initNode("nav-type",0,"INT");
m.GS_deflection.setDoubleValue(0); m.NavString =m.primus.initNode("nav-string","VOR1");
m.CRSdeflection =m.primus.getNode("course-deflection",1); m.NavTime =m.primus.initNode("nav-time","- - : - -");
m.CRSdeflection.setDoubleValue(0); m.NavID =m.primus.initNode("nav-id"," ");
m.NavDist =m.primus.getNode("nav-dist-nm",1); m.fms_mode=m.primus.initNode("fms-mode",m.FMS_VNAV[0],"STRING");
m.NavDist.setDoubleValue(0); m.FDmode = m.primus.initNode("fdmode",1,"BOOL");
m.NavType =m.primus.getNode("nav-type",1); m.baro_mode=m.primus.initNode("baro-mode",1,"BOOL");
m.NavType.setIntValue(0); m.baro_kpa = m.primus.initNode("baro-kpa"," ");
m.NavString =m.primus.getNode("nav-string",1);
m.NavString.setValue("VOR1");
m.NavTime =m.primus.getNode("nav-time",1);
m.NavTime.setValue("- - : - -");
m.NavID =m.primus.getNode("nav-id",1);
m.NavID.setValue("");
m.fms_mode=m.primus.getNode("fms-mode",1);
m.fms_mode.setValue(m.FMS_VNAV[0]);
m.FDmode = m.primus.getNode("fdmode",1);
m.FDmode.setBoolValue(1);
m.baro_mode=m.primus.getNode("baro-mode",1);
m.baro_mode.setBoolValue(1);
m.baro_kpa = m.primus.getNode("baro-kpa",1);
m.baro_kpa.setValue(" ");
m.IAS = props.globals.getNode("instrumentation/airspeed-indicator/indicated-speed-kt",1); m.IAS = props.globals.getNode("instrumentation/airspeed-indicator/indicated-speed-kt",1);
m.ALT = props.globals.getNode("instrumentation/altimeter/indicated-altitude-ft",1); m.ALT = props.globals.getNode("instrumentation/altimeter/indicated-altitude-ft",1);
setprop("/instrumentation/kr-87/inputs/adf-btn",1);
return m; return m;
}, },
#### pointer needle update #### #### pointer needle update ####
@ -145,8 +93,7 @@ var P1000 = {
var hdg = getprop("/orientation/heading-magnetic-deg"); var hdg = getprop("/orientation/heading-magnetic-deg");
if(test==0 or test == nil)return 0.0; if(test==0 or test == nil)return 0.0;
if(test == 1){ if(test == 1){
offset=getprop("/instrumentation/nav["~src~"]/heading-deg"); offset=getprop("/instrumentation/nav["~src~"]/heading-deg") or 0;
if(offset == nil)offset=0.0;
offset -= hdg; offset -= hdg;
if(offset < -180){offset += 360;} if(offset < -180){offset += 360;}
elsif(offset > 180){offset -= 360;} elsif(offset > 180){offset -= 360;}
@ -457,9 +404,7 @@ var update_p1000 = func {
setlistener("/sim/signals/fdm-initialized", func { setlistener("/sim/signals/fdm-initialized", func {
APoff.setBoolValue(1); APoff.setBoolValue(1);
props.globals.getNode("instrumentation/primus1000/pfd/serviceable",1).setBoolValue(1); #props.globals.getNode("instrumentation/primus1000/mfd/mode",1).setValue("normal");
props.globals.getNode("instrumentation/primus1000/mfd/serviceable",1).setBoolValue(1);
props.globals.getNode("instrumentation/primus1000/mfd/mode",1).setValue("normal");
print("Primus 1000 systems ... check"); print("Primus 1000 systems ... check");
settimer(update_p1000,1); settimer(update_p1000,1);
}); });