KAPTEJNLN Posted July 17, 2011 Author Report Posted July 17, 2011 about: What "your device also light up whit out driver by pressing APP button (the led + led at A/T would light up)? yes it does seems wired that it does it, just want to know if it is my new device as then i might be a problem whit the device. ------------------------------------------------------------------------------------------------------------------------------------------- For the Captainsim 757 i am able to run whit out the driver, for the airbus X i have to use the goflight software for VS only. ________________________________________________________________________________________________________________________________________________ What i mean was i would like to be able to get the Airbus X working so the speed display could switch between Mach and speed but havent found a way as when i try press the button in the plane or by the lua file for the buton nothing happens on the GFdisplay only inside the Airbus X. and i asked if there was a special way of doeing as i would like that to work whit Captainsim. for the Captainsim i found to variables : L:MCP_IAS_Disp, L:MCP_Mach_Disp so it seems it in some way have to switch between them. ----------------------------------------------------------------------------------------------------------------------------------------------------- About Captainsim i Could find a Lvar that could be used for increase or decrease of speed, heading, altitude, vertical speed. but by using the code i showed before i was able to decrease or increase the variable shown on the display, as it is the Lvar for the display so i just take that variable and let it ad 100 ft. so i am missing a kind of maximum limit and a Minimum. if ipcPARAM == 0 then LVarSet = "L:MCP_Altitude_Disp" LVarGet = ipc.readLvar(LVarSet) ipc.writeLvar(LVarSet, LVarGet-100) as this is for the display: L:MCP_Altitude_Disp. so is it posible to create such limit as it was a lua file for the rotatin button then then i havea noter that would increase 1000ft, as that seems to be the only solution i can find now. hope that was better, and SRY pete
KAPTEJNLN Posted July 17, 2011 Author Report Posted July 17, 2011 according to the captainsim is tere any othere set up for the display as becaus now i just tested it like this but the display just say 000 where it should say 0.40 ? so think thats the reason of why i could get it working by inserting both codes. after eatch othere and speed works but bach dident. there for i ask if there is anothere way it should be set to work. prevMACH = -1 while 1 do MACH = ipc.readLvar("L:MCP_Mach_Disp") if (MACH ~= prevMACH) then stringMACH = string.format("%03d", MACH) gfd.setDisplay(GFMCPPRO,0,1,stringMACH) prevMACH = MACH end
Pete Dowson Posted July 17, 2011 Report Posted July 17, 2011 about: What "your device also light up whit out driver by pressing APP button (the led + led at A/T would light up)? yes it does seems wired that it does it, just want to know if it is my new device as then i might be a problem whit the device. Okay. Please remind me during the week and I'll try to hook it back up. What i mean was i would like to be able to get the Airbus X working so the speed display could switch between Mach and speed but havent found a way as when i try press the button in the plane or by the lua file for the buton nothing happens on the GFdisplay only inside the Airbus X. and i asked if there was a special way of doeing as i would like that to work whit Captainsim. Unfortunately I do not have either Airbus X or CaptainSim 757, so I just don't know. If you have a question on driving the GoFlight gear I can maybe answer, but I don't know what the aircraft are doing. Sorry. for the Captainsim i found to variables : L:MCP_IAS_Disp, L:MCP_Mach_Disp so it seems it in some way have to switch between them. so, have you experimented with those? Can you read them as well? About Captainsim i Could find a Lvar that could be used for increase or decrease of speed, heading, altitude, vertical speed. but by using the code i showed beforei was able to decrease or increase the variable shown on the display, as it is the Lvar for the display so i just take that variable and let it ad 100 ft. so i am missing a kind of maximum limit and a Minimum. Why not just choose the correct minimum and maximum values and checking those? Or simply never turn the dial beyond what is reasonable? ipc.writeLvar(LVarSet, LVarGet-100) as this is for the display: L:MCP_Altitude_Disp. so is it posible to create such limit as it was a lua file for the rotatin button then then i havea noter that would increase 1000ft, as that seems to be the only solution i can find now. I don't know what you mean by "have a noter that would increase 1000ft", but if you want to stoop "LVarSet" going below zero, whay not just check for it. In other words: if LVarGet >= 100 then ipc.writeLvar(LVarSet, LVarGet-100) end Regards Pete
KAPTEJNLN Posted July 17, 2011 Author Report Posted July 17, 2011 thanks for the code. it worked for alt, vs and speed. but realy having some problems whit the HDG button whit the limits. i could get it working if only slow funktio was in use but when combinating fast and slow for the slow funktion and fast on the GFMCP-PRO. the files i have been tweaking look like this for slow increase: if ipcPARAM == 0 then LVarSet = "L:MCP_HDG_Disp" LVarGet = ipc.readLvar(LVarSet) if LVarGet <= 359 then ipc.writeLvar(LVarSet, LVarGet+1) else if LVarGet <= 359 then ipc.writeLvar(LVarSet, LVarGet-359) ipc.readLvar("L:MCP_HDG_Disp") end end ipc.sleep(50) end fast increase: if ipcPARAM == 0 then LVarSet = "L:MCP_HDG_Disp" LVarGet = ipc.readLvar(LVarSet) if LVarGet <= 359 then ipc.writeLvar(LVarSet, LVarGet+10) else if LVarGet <= 359 then ipc.writeLvar(LVarSet, LVarGet-359) ipc.readLvar("L:MCP_HDG_Disp") end end ipc.sleep(50) end
Pete Dowson Posted July 17, 2011 Report Posted July 17, 2011 the files i have been tweaking look like this for slow increase: I'll annotate the code to show where you are going wrong. [bTW, why, in all your examples, do you have "if ipcPARAM == 0 then"? What about other parameter values? If you aren't using the parameter, why bother to test it? if ipcPARAM == 0 then LVarSet = "L:MCP_HDG_Disp" LVarGet = ipc.readLvar(LVarSet) if LVarGet <= 359 then ipc.writeLvar(LVarSet, LVarGet+1) else if LVarGet <= 359 then -- This will NEVER be true, because if it was you'd be doing the part above instead, don't you see? ipc.writeLvar(LVarSet, LVarGet-359) -- So this code is never used ipc.readLvar("L:MCP_HDG_Disp")-- Nor this (and why read it again here when you've just written it? Makes no sense! end end ipc.sleep(50) -- Why this sleep? end Surely you ALWAYS want to add 1, and then simply see if the result is >= 360 and if set subtract 360. so LVarSet = "L:MCP_HDG_Disp" LVarGet = ipc.readLvar(LVarSet) + 1 if LVarGet >= 360 then LVarGet = LVarGet -360 end ipc.writeLvar(LVarSet, LVarGet) The "fast increase" version is exactly the same except adding 10. With a decrease you'd check for < 0 and if so add 360. This is simple logic more than programming. To check your work just pretend you are the computer and see what happens to values line by line. This is called "dry running". Pete
KAPTEJNLN Posted July 18, 2011 Author Report Posted July 18, 2011 Thanks pete, about the mach i think i have to use the IAS display and by tweaking it in some way to convert it on the display. as the L:MCP_Mach_Disp shows up but only 000. do you think that is posible to use the IAS and con vert it to show in mach on the display? and yes i know you dont have the 757 just if you have seen or done something identical. as this was all i could find about it in the MDL.file (L:MachIASSelect,bool) if{ (L:MCP_Mach_Disp,number) 300 * 100 % 3.6 * s0 } els{ (L:MCP_IAS_Disp,number) 100 % 3.6 * s0 }
Pete Dowson Posted July 18, 2011 Report Posted July 18, 2011 do you think that is posible to use the IAS and con vert it to show in mach on the display? and yes i know you dont have the 757 just if you have seen or done something identical. You can convert but it isn't easy. you need the air temperature and the true air speed (TAS). Googling will find you some formulae, like http://williams.best.vwh.net/avform.htm#Mach Regards Pete
KAPTEJNLN Posted July 18, 2011 Author Report Posted July 18, 2011 yes that seems hard. It just seems wired about the L:MCP_MACH_DSP because i am able to get it increase/decrease by 0.01 or what you set it to whit this code, by using a push button so it have an effect. but when i try use another code to read it as a display nothing happens, i was refering to the ipcReady.lua like for the other displays. LVarSet = "L:MCP_MACH_DSP" LVarGet = ipc.readLvar(LVarSet) + 0.01 end ipc.writeLvar(LVarSet, LVarGet) when i look insede the lvar.log file i can see that there are more than 1 that contain Mach at start up but by set them they only show the number on the display as shown at the top of the codes. (3-9-8) but L:MCP_MACH_DSP just type 000 on the display 32245 LUA: L:Airspeed_INOPFlag=0 32354 LUA: L:AirspeedMach10=3 32354 LUA: L:AirspeedMach100=9 32448 LUA: L:AirspeedMach1000=8.3286235575967 32557 LUA: L:AirspeedSelect1=2 32557 LUA: L:AirspeedSelect10=4 32557 LUA: L:AirspeedSelect100=8.8572387695313 32557 LUA: L:LP_S003_SPDMARK=275 32651 LUA: L:StandbyBusAC=1 32651 LUA: L:IRS_DATA=1 32760 LUA: L:LP_S004_RDMI_NEEDLE_1_POS=1.6750972393612 32760 LUA: L:LP_S004_RDMI_NEEDLE_2_POS=3.0714638140562 32853 LUA: L:LP_S004Pos_L=0 32853 LUA: L:VOR1_DME=4.1606816927368 32963 LUA: L:LP_S004Pos_R=0 33056 LUA: L:VOR2_DME=21.603836168315 33056 LUA: L:LP_S004_RDMI_BG_Flag1=0 33056 LUA: L:LP_S004_RDMI_BG_Flag2=0 33165 LUA: L:iSndPl=104 33165 LUA: L:LP005sw2On=0 33259 LUA: L:LP006sw2On=0 33275 LUA: L:IndicatedAltitude1=0 33368 LUA: L:IndicatedAltitude2=4 33368 LUA: L:IndicatedAltitude3=0.0350244140625 33477 LUA: L:KohlsmanSetting1=1 33477 LUA: L:KohlsmanSetting2=0 33477 LUA: L:KohlsmanSetting3=1 33571 LUA: L:KohlsmanSetting4=3.0999682530673 33571 LUA: L:KSetting1=2 33680 LUA: L:KSetting2=9 33680 LUA: L:KSetting3=9 33680 LUA: L:KSetting4=1.6912078857422 33774 LUA: L:StandbyBusDC=1 33774 LUA: L:LP_S010_ANALOG_ALTIMETER_POS=4005.150390625 33774 LUA: L:RedBugPos=0 33883 LUA: L:LP011kn0On=0 33883 LUA: L:RedBugOn=0 33977 LUA: L:LMainBusAC=1 33977 LUA: L:Clock DAT Depressed=0 34086 LUA: L:Clock Run Hold=0 34086 LUA: L:Clock Stopwatch Reset=0 34179 LUA: L:Clock DAT Function=0 34179 LUA: L:Clock Chronograph Mode=0 34179 LUA: L:Clock Chronograph Accumulated=0 34289 LUA: L:Clock Chronograph Start=0 34289 LUA: L:Clock Absolute Seconds=63446469663 34382 LUA: L:Clock Stopwatch Seconds=0 34382 LUA: L:Clock Sim Rate=0 34491 LUA: L:AttitudeInd=4.1465745479425 34491 LUA: L:AttitudeIndB=0.016200615663955 34491 LUA: L:AttitudeIndR=0.016200615663955 34585 LUA: L:LP022kn2Pos=0 34585 LUA: L:CP_S003_STBY_IND_POWER=0 34694 LUA: L:LPS002A=0 34694 LUA: L:TestLamps=0 34788 LUA: L:LPS002B=0 34788 LUA: L:LPS002D=0 34897 LUA: L:LPS002F=0 34897 LUA: L:LPS002H=0 34991 LUA: L:LP_S003lvr_1=0 35006 LUA: L:LP_S003lvr_2=0 35100 LUA: L:LP_S003lvr_3=0 35100 LUA: L:LP_S003lvr_4=0 35100 LUA: L:LP_S003lvr_1_startpos=0 35193 LUA: L:LP_S003lvr_1_old=0 35209 LUA: L:LP_S003lvr_1_pos=0 35303 LUA: L:LP_S003lvr_2_startpos=0 35303 LUA: L:LP_S003lvr_2_old=0 35303 LUA: L:LP_S003lvr_2_pos=0 35412 LUA: L:LP_S003lvr_3_startpos=0 35412 LUA: L:LP_S003lvr_3_old=0 35505 LUA: L:LP_S003lvr_3_pos=0 35505 LUA: L:LP_S003lvr_4_startpos=0 35615 LUA: L:LP_S003lvr_4_old=0 35615 LUA: L:LP_S003lvr_4_pos=0 35708 LUA: L:Autoland_id_1=0 35708 LUA: L:Autoland_id_2=0 35817 LUA: L:CG_S001_MAST_LT=0 35817 LUA: L:CG_S001_CAU_LT=0 35911 LUA: L:CG_S001_MAST_LT_ON=0 35911 LUA: L:EICAS_BUT_PUSH=0 36020 LUA: L:CaptTransfBus=1 36020 LUA: L:LP_S019_A=0 36114 LUA: L:LP_S019_B=0 36114 LUA: L:HD_PRSLT_OD005=0 36223 LUA: L:LTransfBusAC=1 36223 LUA: L:VOR1_FREQUENCY=112.5 36223 LUA: L:VOR1_OBS=0 36317 LUA: L:CP_S002_FIRE_LIGHT=0 36317 LUA: L:CP_S002_Config_LIGHT=0 36426 LUA: L:CP_S002_D_LIGHT=0 36426 LUA: L:CP_S002_E_LIGHT=0 36519 LUA: L:CP_S002_F_LIGHT=0 36519 LUA: L:CP_S002_H_LIGHT=0 36629 LUA: L:CP_S002_I_LIGHT=0 36629 LUA: L:CP_S002_K_LIGHT=0 36722 LUA: L:CP_S002_L_LIGHT=0 36722 LUA: L:CP_S002_J_LIGHT=0 36831 LUA: L:CP_S004_A_LIGHT=0 36925 LUA: L:CP_S004_B_LIGHT=0 36925 LUA: L:AB_Light=0 36941 LUA: L:CP_S009_A_LIGHT=0 37034 LUA: L:CP_S009_LIGHT=0 37034 LUA: L:CPS012A_LIGHT=0 37143 LUA: L:CP_S012C_LIGHT=0 37143 LUA: L:CP_S012C_ON=0 37237 LUA: L:FlapsEventOn=0 37237 LUA: L:CPS012B_LIGHT=0 37346 LUA: L:CP_S012D_LIGHT=0 37346 LUA: L:CP_S012D_ON=0 37440 LUA: L:CP_S013_B_LIGHT=0 37440 LUA: L:CP_S013_C_LIGHT=0 37440 LUA: L:CP_S014_A_LIGHT=1 37549 LUA: L:CP_S014_B_LIGHT=1 37549 LUA: L:CP_S014_C_LIGHT=1 37643 LUA: L:CP_S015_GearTransit_LIGHT=0 37643 LUA: L:ADI_FastSlow=-26.59375 37643 LUA: L:BrightCRT1=50 37752 LUA: L:LP012kn0Pos=0 37752 LUA: L:DH_RST_BUT_ON=0 37752 LUA: L:CG020On=0 37845 LUA: L:AP_LocHold=0 37845 LUA: L:ElecGenrtsSw=0 37955 LUA: L:AT_Status=0 38048 LUA: L:AT_ModeXML=0 38048 LUA: L:AT_PtchMdArm=0 38048 LUA: L:AT_PtchMdAct=0 38157 LUA: L:AFDS_RollMdArm=0 38157 LUA: L:AFDS_RollMdAct=0 38251 LUA: L:AFDS_Status=0 38251 LUA: L:AFDS_FD_active=0 38360 LUA: L:AFDS_FD_pitch=0 38360 LUA: L:AFDS_FD_roll=0 38360 LUA: L:EfisWXRSw2Pos=0 38454 LUA: L:EfisWXRSw2Light=1 38454 LUA: L:EFISMAP1_SWPOS=0 38563 LUA: L:EFISMAP2_SWPOS=0 38563 LUA: L:EFISMAP3_SWPOS=0 38657 LUA: L:EFISMAP4_SWPOS=0 38657 LUA: L:EFISMAP5_SWPOS=0 38672 LUA: L:EFISMAP1_SW2LT=0 38766 LUA: L:EFISMAP2_SW2LT=0 38766 LUA: L:EFISMAP3_SW2LT=0 38766 LUA: L:EFISMAP4_SW2LT=0 38859 LUA: L:EFISMAP5_SW2LT=0 38875 LUA: L:TFCButOn=0 38969 LUA: L:EFISHSIRangePos=0 38969 LUA: L:EFISHSIModePos=4 39078 LUA: L:CG003Light_MAN=0 39078 LUA: L:CG003Light2_MAN=0 39078 LUA: L:CG009kn6Pos=0 39171 LUA: L:MachIASSelect=0 39171 LUA: L:VS_012_isBlank=1 39171 LUA: L:AS_006_isBlank=0 39281 LUA: L:AP_Dis=0 39281 LUA: L:MCP_EPR_FLG=0 39281 LUA: L:MCP_SPD_FLG=0 39374 LUA: L:MCP_LNAV_FLG=0 39374 LUA: L:MCP_VNAV_FLG=0 39483 LUA: L:MCP_FLCH_FLG=0 39483 LUA: L:MCP_HDG_HLD_FLG=0 39483 LUA: L:MCP_HDG_SEL_FLG=0 39577 LUA: L:MCP_VS_FLG=0 39577 LUA: L:MCP_ALT_HLD_FLG=0 39686 LUA: L:MCP_LOC_FLG=0 39686 LUA: L:MCP_APP_FLG=0 39686 LUA: L:MCP_CMD_L_FLG=0 39780 LUA: L:MCP_CMD_C_FLG=0 39780 LUA: L:MCP_CMD_R_FLG=0 39780 LUA: L:MCP_IAS_M_FLG=0 39889 LUA: L:MCP_SPDSEL_FLG=0 39889 LUA: L:MCP_EPR_LT=0 39983 LUA: L:MCP_SPD_LT=0 39983 LUA: L:MCP_LNAV_LT=0 40092 LUA: L:MCP_VNAV_LT=0 40092 LUA: L:MCP_FLCH_LT=0 40185 LUA: L:MCP_HDG_HOLD_LT=0 40295 LUA: L:MCP_VS_LT=0 40295 LUA: L:MCP_ALT_HOLD_LT=0 40295 LUA: L:MCP_LOC_LT=0 40388 LUA: L:MCP_APP_LT=0 40404 LUA: L:MCP_CMD_L_LT=0 40404 LUA: L:MCP_CMD_C_LT=0 40591 LUA: L:MCP_CMD_R_LT=0 40591 LUA: L:MCP_FD_switch=0 40685 LUA: L:MCP_AT_SW=0 40685 LUA: L:MCP_HDG_DSP=121 40794 LUA: L:MCP_IAS_DSP=274 40794 LUA: L:MCP_MACH_DSP=0.43000000715256 40887 LUA: L:MCP_ALT_DSP=11800 40903 LUA: L:MCP_VS_DSP=1900 So isen´t there a way that the display in some way could run from the push button lua, like internal write the result of the "L:MCP_MACH_DSP" to the goflight device whit the code above or some thing els? as you se at the botum here of the code it seems like it writes it directly L:MCP_MACH_DSP=0.43000000715256 which in side the plane would show = 0.43
Pete Dowson Posted July 18, 2011 Report Posted July 18, 2011 So isen´t there a way that the display in some way could run from the push button lua, like internal write the result of the "L:MCP_MACH_DSP" to the goflight device whit the code above or some thing els? as you se at the botum here of the code it seems like it writes it directly L:MCP_MACH_DSP=0.43000000715256 which in side the plane would show = 0.43 Sorry, I have no idea what their code is doing. Maybe they only update the value when another action is taken, like the mouse click on screen. Just because you write to an L:Var doesn't mean the panel will see that it needs to redisplay the value if it detects that by some other way. There have been lots of cases like that with other aircraft. Can't you get any help at all from the people who wrote this aircraft code? You are really asking the wrong person. Regards Pete
KAPTEJNLN Posted July 19, 2011 Author Report Posted July 19, 2011 well yes about the codes i found out that there is only the L:MCP_MACH_DSP as the other by using a test buttons i mean AirspeedMach10, 100 and 1000 was for the airspeed indicator. what i ment was if it was posible to read the variable for the L:MCP_MACH_DSP and write it to the plane mcp + proces that info to the gfd.setDisplay(GFMCPPRO,0,1,0.50) by some limits like the rotation buttons so as an EX. if L:MCP_MACH_DSP = 0.50 then a limit so when it read 0.50 it would wride it on the goflight device. as then i should say gfd.setDisplay(GFMCPPRO,0,1,0.50) then create anothere when it read 0.51 the wride (GFMCPPRO,0,1,0.51) i know i then would have to create 1 for each mach number but if it is that there is required i would try it. but it should run in the ipcReady i think, like the rest of the displays. below is a code i test whit and it wrides what it should 0.51 on the display i know i miss the line like string = string.format("%03d", 0.51) to lock the display. so ofcause the file here should be edit as the first part is not required for a display but it was only a test) LVarSet = "L:MCP_MACH_DSP" LVarGet = ipc.readLvar(LVarSet) + 0.01 ipc.writeLvar(LVarSet, LVarGet) if (LVarSet ~= LVarGet) then gfd.setDisplay(GFMCPPRO,0,1,0.51) end but how to start if we say it is for the ipcready. file we should do like above to read the Lvar and give the limits as this is the codes we used for the others as EX. in shorter version: prevCRS1 = -1 prevalt = -1 while 1 do CRS1 = ipc.readLvar("L:VOR1_OBS") if (CRS1 ~= prevCRS1) then stringCRS1 = string.format("%03d", CRS1) gfd.setDisplay(GFMCPPRO,0,0,stringCRS1) prevCRS1 = CRS1 end alt = ipc.readLvar("L:MCP_ALT_DSP") if (alt ~= prevalt) then stringalt = string.format("%05d", alt) gfd.setDisplay(GFMCPPRO,0,3,stringalt) prevalt = alt end ipc.sleep(50) end should it then look like this: prevCRS1 = -1 prevalt = -1 prevMACH = -1 ----------------------------------------------------is this stil required while 1 do CRS1 = ipc.readLvar("L:VOR1_OBS") if (CRS1 ~= prevCRS1) then stringCRS1 = string.format("%03d", CRS1) gfd.setDisplay(GFMCPPRO,0,0,stringCRS1) prevCRS1 = CRS1 end alt = ipc.readLvar("L:MCP_ALT_DSP") if (alt ~= prevalt) then stringalt = string.format("%05d", alt) gfd.setDisplay(GFMCPPRO,0,3,stringalt) prevalt = alt end MACH = ipc.readLvar("L:MCP_MACH_DSP") if () then ---------------------------------------should this be there or the limits in som way stringMACH = string.format("%05d", 0.50) gfd.setDisplay(GFMCPPRO,0,3,stringMACH) if () then -------------------------------- then another limit like 0.51 stringMACH = string.format("%05d", 0.51) gfd.setDisplay(GFMCPPRO,0,3,stringMACH) prevalt = alt -------------------------------what about this line end ipc.sleep(50) end thats where im lost how to get the limits in there. or is it posible that to start it i might let it search for the variable 0.43 for the L:MCP_MACH_DSP as thats where it starts, when you push the mach/ias sel button. as then it would be in the memory
Pete Dowson Posted July 19, 2011 Report Posted July 19, 2011 what i ment was if it was posible to read the variable for the L:MCP_MACH_DSP and write it to the plane mcp + proces that info to the gfd.setDisplay(GFMCPPRO,0,1,0.50) by some limits like the rotation buttons so as an EX. if L:MCP_MACH_DSP = 0.50 then a limit so when it read 0.50 it would wride it on the goflight device. as then i should say gfd.setDisplay(GFMCPPRO,0,1,0.50) then create anothere when it read 0.51 the wride (GFMCPPRO,0,1,0.51) i know i then would have to create 1 for each mach number but if it is that there is required i would try it. Er, this is confusing for me, sorry. You mix too many questions in one paragraph. Yes, of course it is passible to write a value to the GF displays. That is what part of the Lua gfd library is for. But what is all that about "creating 1 for each mach number"? You just write the variable you read to the display in the correct format! What is driving the GFMCP -- do you have a complete Lua program for it, or are you mainly using the GoFlight driver for it? Because I doubt whether you can mix them successfully. but it should run in the ipcReady i think, like the rest of the displays. below is a code i test whit and it wrides what it should 0.51 on the display i know i miss the line like string = string.format("%03d", 0.51) to lock the display. Er, I'm not understanding any of this. Why only write 0.51? Why not write the value you read, call it "machval" or something? It seems totally inexplicable to me that you'd want to only write specific numbers. And it is a total waste doing "string.format("%03d", 0.51)" because all that does is give you "000" as a result, because the integer part of 0.51 is 0! If yu want the display to read 051 you'd write "051", or, if you have a "machval" variable you'd use string.format("%03d", machval * 100) You need to multiply by 100 to get mach x 100 for display. However, doesn't the GFMCP display decimal points too? If so you could use string.format("%01.2f", machval) or something like that. LVarSet = "L:MCP_MACH_DSP" LVarGet = ipc.readLvar(LVarSet) + 0.01 ipc.writeLvar(LVarSet, LVarGet) if (LVarSet ~= LVarGet) then gfd.setDisplay(GFMCPPRO,0,1,0.51) <<<<<<<<<< ??????????????? WHY? end but how to start if we say it is for the ipcready. file we should do like above to read the Lvar and give the limits as this is the codes we used for the others as EX. in shorter version: Sorry, I don't understand a word of that bit. If you mean how do you add code into the latter, just add it in a logical place -- near the end, before the 'sleep'. thats where im lost how to get the limits in there Sorry, what limits for what? You've lost me again. or is it posible that to start it i might let it search for the variable 0.43 for the L:MCP_MACH_DSP as thats where it starts, when you push the mach/ias sel button. as then it would be in the memory I don't understand this either. If you want to apply limits to your mach changes, why not use the same methods as for the VS we already covered. just different values, that's all. Pete
KAPTEJNLN Posted July 19, 2011 Author Report Posted July 19, 2011 pete thank you so much by using the code you gave the display works whit out any fancy modification in the ipc ready.lua ("%01.2f") was what i was missing and also what i was thinking of if there was a special code for the mach numbers and you had the awenser thank you again. so now i just have to modify the rotation buttons so it can be used for both IAS and mach numbers then it is done i hope:-) Mach = ipc.readLvar("L:MCP_MACH_DSP") if (Mach ~= prevMach) then stringMach = string.format("%01.2f", Mach) gfd.setDisplay(GFMCPPRO,0,1,stringMach) prevMach = Mach end
Pete Dowson Posted July 19, 2011 Report Posted July 19, 2011 pete thank you so much by using the code you gave the display works whit out any fancy modification in the ipc ready.lua ("%01.2f") was what i was missing and also what i was thinking of if there was a special code for the mach numbers The format %01.2f means this: % means this is a value placeholder 0 means for any padding use the 0 character. You could have a space instead for spacing. 1 means include at least 1 character, even if 0. (Normally a number like 0000234 would be shown "234", but you can force "0000234" by %07 to say 7 digits. A format % 7, with a space, would give " 234" where there are 4 spaces in front of the 234. . shows you want the fraction part too 2 says show the fraction to 2 places f says the number is in floating point form (all numbers in Lua are floating point, but can be uses as integers too, losing the fraction). Regards Pete
KAPTEJNLN Posted July 19, 2011 Author Report Posted July 19, 2011 well i know you might mean it is easy, but when i try think logic about getting it working i am wrong. i just think how to get those 2 in to 1 dokument as that is needed to use the rotation buttons for IAS/MACH i had a look on some data for the airbus X by guenseli. just as get some info about how it might look but the airbus X is different as there is a button here we write to the displays. this is the 2 codes for increase (mach and IAS) on the captainsim 757 then i tryeid to create a limit for mach as well but how to get them combinated so they work for the same button. becaus how to get it first identify which is in use. becaus i was thinking about start whit: if ipc.readLvar(L:MCP_IAS_DSP) then i dont know. Because then some of the lines would be required as it then already stay in the memory so LVarSet would it then be double work ? but then i think about why not jump direct to ipc.readLvar(LVarSet) + 1 and skip the above but how to continue. if LVarGet >= 400 then LVarGet = 400 might stil be in use but then we stil miss where it identify when it is mach or ias + how to use the final resault that would be send in the end: ipc.writeLvar(LVarSet, LVarGet) LVarSet = "L:MCP_IAS_DSP" LVarGet = ipc.readLvar(LVarSet) + 1 if LVarGet >= 400 then LVarGet = 400 LVarSet = "L:MCP_MACH_DSP" LVarGet = ipc.readLvar(LVarSet) + 0.01 if LVarGet >= 0.90 then LVarGet = 0.90 end ipc.writeLvar(LVarSet, LVarGet)
Pete Dowson Posted July 19, 2011 Report Posted July 19, 2011 we stil miss where it identify when it is mach or ias + how to use the final resault that would be send in the end: ipc.writeLvar(LVarSet, LVarGet) Surely one of the L:Vars you can read will tell you which is to be used? If not, sorry, I can't help. You need support from the aircraft writer. Pete
KAPTEJNLN Posted July 19, 2011 Author Report Posted July 19, 2011 Surely one of the L:Vars you can read will tell you which is to be used? If not, sorry, I can't help. You need support from the aircraft writer. Pete The button for the (SEL) which is used to switch between mach and IAS: L:MCP_SPDSEL_FLG. this line tels by L:MCP_SPDSEL_FLG =0 or 1 to identify which is in use as i could se in the lvar.log
Pete Dowson Posted July 19, 2011 Report Posted July 19, 2011 The button for the (SEL) which is used to switch between mach and IAS: L:MCP_SPDSEL_FLG. this line tels by L:MCP_SPDSEL_FLG =0 or 1 to identify which is in use as i could se in the lvar.log So, you are okay then! You only need to read that and test it to decide which to increment or decrement and display. Pete
KAPTEJNLN Posted July 19, 2011 Author Report Posted July 19, 2011 something like this, it works but i know i might do some mistakes, and yes not a fault that i use L:MachIASSelect as the other seems to be for a start up script(L:MCP_SPDSEL_FLG) DES = ipc.readLvar("L:MachIASSelect") if (DES == 1) then LVarSet = "L:MCP_MACH_DSP" LVarGet = ipc.readLvar(LVarSet) - 0.05 else LVarSet = "L:MCP_IAS_DSP" LVarGet = ipc.readLvar(LVarSet) - 10 end ipc.writeLvar(LVarSet, LVarGet)
KAPTEJNLN Posted July 20, 2011 Author Report Posted July 20, 2011 was it corect above or did you mean like for the displays where prevDES = -1 while 1 do DES = ipc.readLvar("L:MachIASSelect") (DES ~= prevDES) LVarSet = "L:MCP_MACH_DSP" LVarGet = ipc.readLvar(LVarSet) - 0.05 else LVarSet = "L:MCP_IAS_DSP" LVarGet = ipc.readLvar(LVarSet) - 10 end prevDES = DES ipc.writeLvar(LVarSet, LVarGet) ---------------------------------------------------------------------------- well isent there a way inside the ipcready.lua to identify which display is in use by reading L:MachIASSelect is that the same way as the mach / ias sel button? prevCRS1 = -1 prevalt = -1 prevhdg = -1 prevspeed = -1 prevMach = -1 prevCRS2 = -1 prevVS = -1 prevVNAV = -1 prevLNAV = -1 prevAP1 = -1 prevAP2 = -1 prevAP3 = -1 prevTHR = -1 prevLOC = -1 prevFD = -1 prevN1 = -1 prevSPDN = -1 prevFLCH = -1 prevHDGN = -1 prevAPPR = -1 prevALTN = -1 prevVS = -1 while 1 do CRS1 = ipc.readLvar("L:VOR1_OBS") if (CRS1 ~= prevCRS1) then stringCRS1 = string.format("%03d", CRS1) gfd.setDisplay(GFMCPPRO,0,0,stringCRS1) prevCRS1 = CRS1 end ipc.sleep(50) alt = ipc.readLvar("L:MCP_ALT_DSP") if (alt ~= prevalt) then stringalt = string.format("%05d", alt) gfd.setDisplay(GFMCPPRO,0,3,stringalt) prevalt = alt end ipc.sleep(50) VS = ipc.readLvar("L:MCP_VS_DSP") if (VS ~= prevVS) then stringalt = string.format("%05d", VS) gfd.setDisplay(GFMCPPRO,0,4,stringalt) prevVS = VS end ipc.sleep(50) hdg = ipc.readLvar("L:MCP_HDG_DSP") if (hdg ~= prevhdg) then stringhdg = string.format("%03d", hdg) gfd.setDisplay(GFMCPPRO,0,2,stringhdg) prevhdg = hdg end ipc.sleep(50) speed = ipc.readLvar("L:MCP_IAS_DSP") if (speed ~= prevspeed) then stringspeed = string.format("%03d", speed) gfd.setDisplay(GFMCPPRO,0,1,stringspeed) prevspeed = speed end ipc.sleep(50) Mach = ipc.readLvar("L:MCP_MACH_DSP") if (Mach ~= prevMach) then stringMach = string.format("%01.2f", Mach) gfd.setDisplay(GFMCPPRO,0,1,stringMach) prevMach = Mach end ipc.sleep(50) CRS2 = ipc.readLvar("L:VOR2_OBS") if (CRS2 ~= prevCRS2) then stringCRS2 = string.format("%03d", CRS2) gfd.setDisplay(GFMCPPRO,0,5,stringCRS2) prevCRS2 = CRS2 end ipc.sleep(50) VNAV = ipc.readLvar("L:MCP_VNAV_LT") if (VNAV ~= prevVNAV ) then if VNAV == 1 then gfd.SetLight(GFMCPPRO,0,0) else gfd.ClearLight(GFMCPPRO,0,0) end prevVNAV = VNAV end LNAV = ipc.readLvar("L:MCP_LNAV_LT") if (LNAV ~= prevLNAV ) then if LNAV == 1 then gfd.SetLight(GFMCPPRO,0,1) else gfd.ClearLight(GFMCPPRO,0,1) end prevLNAV = LNAV end AP1 = ipc.readLvar("L:MCP_CMD_L_LT") if (AP1 ~= prevAP1) then if AP1 == 1 then gfd.SetLight(GFMCPPRO,0,2) else gfd.ClearLight(GFMCPPRO,0,2) end prevAP1 = AP1 end AP2 = ipc.readLvar("L:MCP_CMD_R_LT") if (AP2 ~= prevAP2) then if AP2 == 1 then gfd.SetLight(GFMCPPRO,0,3) else gfd.ClearLight(GFMCPPRO,0,3) end prevAP2 = AP2 end AP3 = ipc.readLvar("L:MCP_CMD_C_LT") if (AP3 ~= prevAP3) then if AP3 == 1 then gfd.SetLight(GFMCPPRO,0,9) else gfd.ClearLight(GFMCPPRO,0,9) end prevAP3 = AP3 end THR = ipc.readLvar("L:MCP_AT_SW") if (THR ~= prevTHR) then if THR == 1 then gfd.SetLight(GFMCPPRO,0,100) else gfd.ClearLight(GFMCPPRO,0,100) end prevTHR = ATHR end LOC = ipc.readLvar("L:MCP_LOC_LT") if (LOC ~= prevLOC) then if LOC == 1 then gfd.SetLight(GFMCPPRO,0,7) else gfd.ClearLight(GFMCPPRO,0,7) end prevLOC = LOC end FD = ipc.readLvar("L:MCP_FD_switch") if (FD ~= prevFD) then if FD == 1 then gfd.SetLight(GFMCPPRO,0,14) gfd.SetLight(GFMCPPRO,0,23) else gfd.ClearLight(GFMCPPRO,0,14) gfd.ClearLight(GFMCPPRO,0,23) end prevFD = FD end N1 = ipc.readLvar("L:MCP_EPR_LT") if (N1 ~= prevN1) then if N1 == 1 then gfd.SetLight(GFMCPPRO,0,15) else gfd.ClearLight(GFMCPPRO,0,15) end prevN1 = N1 end SPDN = ipc.readLvar("L:MCP_SPD_LT") if (SPDN ~= prevSPDN) then if SPDN == 1 then gfd.SetLight(GFMCPPRO,0,16) else gfd.ClearLight(GFMCPPRO,0,16) end prevSPDN = SPDN end FLCH = ipc.readLvar("L:MCP_FLCH_LT") if (FLCH ~= prevFLCH) then if FLCH == 1 then gfd.SetLight(GFMCPPRO,0,17) else gfd.ClearLight(GFMCPPRO,0,17) end prevFLCH = FLCH end HDGN = ipc.readLvar("L:MCP_HDG_HOLD_LT") if (HDGN ~= prevHDGN) then if HDGN == 1 then gfd.SetLight(GFMCPPRO,0,18) else gfd.ClearLight(GFMCPPRO,0,18) end prevHDGN = HDGN end APPR = ipc.readLvar("L:MCP_APP_LT") if (APPR ~= prevAPPR) then if APPR == 1 then gfd.SetLight(GFMCPPRO,0,19) else gfd.ClearLight(GFMCPPRO,0,19) end prevAPPR = APPR end ALTN = ipc.readLvar("L:MCP_ALT_HOLD_LT") if (ALTN ~= prevALTN) then if ALTN == 1 then gfd.SetLight(GFMCPPRO,0,20) else gfd.ClearLight(GFMCPPRO,0,20) end prevALTN = ALTN end VS = ipc.readLvar("L:MCP_VS_LT") if (VS ~= prevVS) then if VS == 1 then gfd.SetLight(GFMCPPRO,0,21) else gfd.ClearLight(GFMCPPRO,0,21) gfd.ClearLight(GFMCPPRO,0,10) end prevVS = VS end ipc.sleep(50) end
Pete Dowson Posted July 20, 2011 Report Posted July 20, 2011 was it corect above or did you mean like for the displays where Sorry, I thought as you said it worked you needed no further comment. You could incorporate these parts: prevDES = -1 ... DES = ipc.readLvar("L:MachIASSelect") if (DES ~= prevDES) ... prevDES = DES end into your main code, so getting this. note that on an IA/Mach change I reset the prevspeed and prevMach values to -1 so that the correct one then gets displayed even if it hadn't changed: prevDES = -1 -- ########### ADDED! prevCRS1 = -1 prevalt = -1 prevhdg = -1 prevspeed = -1 prevMach = -1 prevCRS2 = -1 prevVS = -1 prevVNAV = -1 prevLNAV = -1 prevAP1 = -1 prevAP2 = -1 prevAP3 = -1 prevTHR = -1 prevLOC = -1 prevFD = -1 prevN1 = -1 prevSPDN = -1 prevFLCH = -1 prevHDGN = -1 prevAPPR = -1 prevALTN = -1 prevVS = -1 while 1 do CRS1 = ipc.readLvar("L:VOR1_OBS") if (CRS1 ~= prevCRS1) then stringCRS1 = string.format("%03d", CRS1) gfd.setDisplay(GFMCPPRO,0,0,stringCRS1) prevCRS1 = CRS1 end ipc.sleep(50) alt = ipc.readLvar("L:MCP_ALT_DSP") if (alt ~= prevalt) then stringalt = string.format("%05d", alt) gfd.setDisplay(GFMCPPRO,0,3,stringalt) prevalt = alt end ipc.sleep(50) VS = ipc.readLvar("L:MCP_VS_DSP") if (VS ~= prevVS) then stringalt = string.format("%05d", VS) gfd.setDisplay(GFMCPPRO,0,4,stringalt) prevVS = VS end ipc.sleep(50) hdg = ipc.readLvar("L:MCP_HDG_DSP") if (hdg ~= prevhdg) then stringhdg = string.format("%03d", hdg) gfd.setDisplay(GFMCPPRO,0,2,stringhdg) prevhdg = hdg end ipc.sleep(50) -- CHANGES ################################### DES = ipc.readLvar("L:MachIASSelect") if (DES ~= prevDES) then prevDES = DES prevspeed = -1 prevMach = -1 end if DES == 1 then Mach = ipc.readLvar("L:MCP_MACH_DSP") if (Mach ~= prevMach) then stringMach = string.format("%01.2f", Mach) gfd.setDisplay(GFMCPPRO,0,1,stringMach) prevMach = Mach end else speed = ipc.readLvar("L:MCP_IAS_DSP") if (speed ~= prevspeed) then stringspeed = string.format("%03d", speed) gfd.setDisplay(GFMCPPRO,0,1,stringspeed) prevspeed = speed end end -- ####################################### ipc.sleep(50) CRS2 = ipc.readLvar("L:VOR2_OBS") if (CRS2 ~= prevCRS2) then stringCRS2 = string.format("%03d", CRS2) gfd.setDisplay(GFMCPPRO,0,5,stringCRS2) prevCRS2 = CRS2 end ipc.sleep(50) VNAV = ipc.readLvar("L:MCP_VNAV_LT") if (VNAV ~= prevVNAV ) then if VNAV == 1 then gfd.SetLight(GFMCPPRO,0,0) else gfd.ClearLight(GFMCPPRO,0,0) end prevVNAV = VNAV end LNAV = ipc.readLvar("L:MCP_LNAV_LT") if (LNAV ~= prevLNAV ) then if LNAV == 1 then gfd.SetLight(GFMCPPRO,0,1) else gfd.ClearLight(GFMCPPRO,0,1) end prevLNAV = LNAV end AP1 = ipc.readLvar("L:MCP_CMD_L_LT") if (AP1 ~= prevAP1) then if AP1 == 1 then gfd.SetLight(GFMCPPRO,0,2) else gfd.ClearLight(GFMCPPRO,0,2) end prevAP1 = AP1 end AP2 = ipc.readLvar("L:MCP_CMD_R_LT") if (AP2 ~= prevAP2) then if AP2 == 1 then gfd.SetLight(GFMCPPRO,0,3) else gfd.ClearLight(GFMCPPRO,0,3) end prevAP2 = AP2 end AP3 = ipc.readLvar("L:MCP_CMD_C_LT") if (AP3 ~= prevAP3) then if AP3 == 1 then gfd.SetLight(GFMCPPRO,0,9) else gfd.ClearLight(GFMCPPRO,0,9) end prevAP3 = AP3 end THR = ipc.readLvar("L:MCP_AT_SW") if (THR ~= prevTHR) then if THR == 1 then gfd.SetLight(GFMCPPRO,0,100) else gfd.ClearLight(GFMCPPRO,0,100) end prevTHR = ATHR end LOC = ipc.readLvar("L:MCP_LOC_LT") if (LOC ~= prevLOC) then if LOC == 1 then gfd.SetLight(GFMCPPRO,0,7) else gfd.ClearLight(GFMCPPRO,0,7) end prevLOC = LOC end FD = ipc.readLvar("L:MCP_FD_switch") if (FD ~= prevFD) then if FD == 1 then gfd.SetLight(GFMCPPRO,0,14) gfd.SetLight(GFMCPPRO,0,23) else gfd.ClearLight(GFMCPPRO,0,14) gfd.ClearLight(GFMCPPRO,0,23) end prevFD = FD end N1 = ipc.readLvar("L:MCP_EPR_LT") if (N1 ~= prevN1) then if N1 == 1 then gfd.SetLight(GFMCPPRO,0,15) else gfd.ClearLight(GFMCPPRO,0,15) end prevN1 = N1 end SPDN = ipc.readLvar("L:MCP_SPD_LT") if (SPDN ~= prevSPDN) then if SPDN == 1 then gfd.SetLight(GFMCPPRO,0,16) else gfd.ClearLight(GFMCPPRO,0,16) end prevSPDN = SPDN end FLCH = ipc.readLvar("L:MCP_FLCH_LT") if (FLCH ~= prevFLCH) then if FLCH == 1 then gfd.SetLight(GFMCPPRO,0,17) else gfd.ClearLight(GFMCPPRO,0,17) end prevFLCH = FLCH end HDGN = ipc.readLvar("L:MCP_HDG_HOLD_LT") if (HDGN ~= prevHDGN) then if HDGN == 1 then gfd.SetLight(GFMCPPRO,0,18) else gfd.ClearLight(GFMCPPRO,0,18) end prevHDGN = HDGN end APPR = ipc.readLvar("L:MCP_APP_LT") if (APPR ~= prevAPPR) then if APPR == 1 then gfd.SetLight(GFMCPPRO,0,19) else gfd.ClearLight(GFMCPPRO,0,19) end prevAPPR = APPR end ALTN = ipc.readLvar("L:MCP_ALT_HOLD_LT") if (ALTN ~= prevALTN) then if ALTN == 1 then gfd.SetLight(GFMCPPRO,0,20) else gfd.ClearLight(GFMCPPRO,0,20) end prevALTN = ALTN end VS = ipc.readLvar("L:MCP_VS_LT") if (VS ~= prevVS) then if VS == 1 then gfd.SetLight(GFMCPPRO,0,21) else gfd.ClearLight(GFMCPPRO,0,21) gfd.ClearLight(GFMCPPRO,0,10) end prevVS = VS end ipc.sleep(50) end I think it is time now for you to be on top of this stuff, no? Regards Pete
KAPTEJNLN Posted July 20, 2011 Author Report Posted July 20, 2011 well the codes i made and show here yesterday worked why i asked was because when i switch between the mach and ias (the mach number some times show the mach number from the plane + 0.01 mach more than inside the plane (if plane shows 0.50 mach it some times shows as ex 0.51 on the goflight device. it dosent happen all the time as it shows it right sometimes) so i was thinkig if it was becaus i made an error. but whit the code you mad it does the same so now i have to spot why it somtimes gives different inputs, and to test if it was my button for SEL i tryeid to changes the by pressing the button inside the plane insted but by doeing that it does the same somtimes the shown mach number + 0.01 on the goflight device. So another thanks for you grate help pete
Pete Dowson Posted July 20, 2011 Report Posted July 20, 2011 well the codes i made and show here yesterday worked why i asked was because when i switch between the mach and ias (the mach number some times show the mach number from the plane + 0.01 mach more than inside the plane (if plane shows 0.50 mach it some times shows as ex 0.51 on the goflight device. it dosent happen all the time as it shows it right sometimes) so i was thinkig if it was becaus i made an error. but whit the code you mad it does the same so now i have to spot why it somtimes gives different inputs, and to test if it was my button for SEL i tryeid to changes the by pressing the button inside the plane insted but by doeing that it does the same somtimes the shown mach number + 0.01 on the goflight device. So another thanks for you grate help pete Check the actual full value of the mach speed by logging the value you read. Maybe it's rounding because the true value is .005 more. You could try forcing it to round down to the nearest .01 by something like Mach = math.floor(ipc.readLvar("L:MCP_MACH_DSP") * 100) / 100 The function "math.floor" takes the integer below or equal to the value given, losing the fraction. Pete
KAPTEJNLN Posted July 20, 2011 Author Report Posted July 20, 2011 yes that seems to work when you press the button inside the plane. but have to think the things thru about the L:MachIASSelect as when it is in use in the ipcready it identify so it switch when you press the button but when i want to use it as push button it dosent do any thing. then i think we need to do as said yesterday write direct to the GF display insted, as it seems like you said it is not sure we can use all the Lvars, if other processes is made some where els.
KAPTEJNLN Posted July 20, 2011 Author Report Posted July 20, 2011 well thanks again for you help i found that using the files from yesterday works whit add the line: Mach = math.floor(ipc.readLvar("L:MCP_MACH_DSP") * 100) / 100 and by using the L:MCP_IAS_M_FLG as the sel button which is in the log, at startup L:MCP_IAS_M_FLG = 0 then i took that and try say as the push button ("L:MCP_IAS_M_FLG", 1) which works and would be the same as L:MCP_IAS_M_FLG = 1 but could find it in the log. only L:MCP_IAS_M_FLG = 0 + when i watch the button inside the plane the SEL button moves in when pressed for mach and comes back out when pressed again. also if i write("L:MCP_IAS_M_FLG", 2) nothing happens so it must be good enoug. about running more lua files for diferent planes then the ipcready should just contain: ipc.runlua("C757.lua") to run the file that is renamed from ipcready to C757.lua right? but how to insert a file for another plane like the airbus X. as this would work: ipc.runlua("C757.lua") ipc.runlua("A320.lua") seems like i miss something that can identyfy which plane is in use right?
Pete Dowson Posted July 20, 2011 Report Posted July 20, 2011 seems like i miss something that can identyfy which plane is in use right? Instead of starting the different aircraft Luas with ipcReady, use the [Auto] facility in FSUIPC INI to automatically start Luas for different aircraft. See the section called Automatic running of Macros and Lua plugins in the FSUIPC advanced users guide. Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now