Jump to content
The simFlight Network Forums

Jackson5

Members
  • Posts

    62
  • Joined

  • Last visited

Posts posted by Jackson5

  1. Hello Everyone,

    Ik keep have these errors in my FSUIPC6 (p3Dv5.3) log and I don't know what they are and if they are a problem.
    FSUIPC seems to work ok for as far as I notice.

    Anyone know what they are and how to maybe solve it?

    551047 Exception 20 "DATA_ERROR", Ref 4083, Index param 1 on write SetData for "GENERAL ENG OIL LEAKED PERCENT:1"
       551047 Exception 20 "DATA_ERROR", Ref 4084, Index param 1 on write SetData for "GENERAL ENG OIL LEAKED PERCENT:2"

    Curious....

    Regards,

    Jaap

  2. Dear Pete and John,

    I have something that I can't figure out for a while and could use a little help.

    I am trying to assign a hardware switch with Project Magenta's PMSystems (737) to turn APU generator 1 on and off.
    This switch is connected to the PC via USB via a (simplified) FlightsimPM 737 overhead panel. The other normal on/off switches in this panel work fine.
    In PMSystems ,running on another PC, I see that APUGen1 has 3 positions. The Offset is said to be 5624 with values 0, 1 and 2 (by hovering over the switch).
    My hardware switch has 3 positions and always jumps back to the middle after operating. However, FSUIPC only sees the two extreme positions and not the middle one.
    Now in FSUIPC Buttons and Switches, if I assign my switch position “On” to Offset 5624 with value 4 (2^2), I can see the switch move in PMSystems but the generator will not turn on.
    When I operate the switch on the PMSystems screen, the generator does turn on.

    How do I assign it so that it will work and turns on APUGen1? And to turn it off again since I only have 1 switch position discovered by FSUIPC left?
    I've tried everything with the other values, but I can't get it to work. (I do this with Offset Byte Togglebits btw. or is that wrong?)
    I'm probably in a twist of my mind and approaching it from the wrong side, and maybe this won't work at all.
    Anyway, I need some fresh eyes and some help.

    Greetings from Delft Jaap

  3. Hello Pete,

    I needed to wait on the weekend before I could startup the sim and do some testing again...

     

    Thanks for the files, but what am I looking for?

     

    What is the precise question? Relate it to the files. I assume you've gone through the Lua trace and determined where you think something has gone wrong? You can't possibly expect me to look through over 30000 lines of logging not knowing what I'm supposed to be looking for? In other words, what sounds are you expecting at what stage in the log?

    I am trying to determine why my lua does not work when started from within ipc.ready.lua, but does work when started from a via FSUIPC assigned button.

    When the lua is started from ipc.ready it does some checking but finally jumps right to line 29, which is the end of the first function. After that nothing happens when opening and closing the doors. When I start the lua by hand (ipc.ready disabled), it works perfectly and starts playing the sounds beginning at line 14 as soon as the door is closed.

    I check the logfiles after every try, and during testing I always have the console log opened, so I can see what is going on.

     

     

    Does the Lear45 one work when loaded in ipcReady by itself? If not, why not do a trace with only that running? Maybe it would be easier to deal with a trace a bit less than 30000 lines?

    Lear45.lua is now the only used one. It does not run, and I did the trace but all it tells my untrained eye, is that somehow it skips the lines where it should check when the doors are opened or closed, starting at line 7. It just jumps to line 29.

     

     

    BTW, rather than use "ipc.macro" to run a Lua plug-in from a Lua plug-in you would be better using the dedicated function for this, "ipc.runlua". Also I note that the ipcReady file does not correspond to the one you actually used for the Trace because one of the plug-ins is commented out.

    Ok, I have changed my ipc.ready.lua as you suggested (attached as .txt). It is correct that the Lear45.lua was commented out. I did that to test how the lua would run when started by hand. I should have changed that back before posting.

     

     

    Also, in the Lear one you have these events:

     

    event.offset(0x281C,"UD","welcome")
    event.offset(0x0842,"SW","climb")
    event.offset(0x0842,"SW","descent")
    event.offset(0x0842,"SW","final")
    event.offset(0x0BDC,"UD","landing")
    event.offset(0x04FE,"UW","seatbelt")
     
    Why three separate events all for changes in 0842? Don't you think that's a wee bit inefficient?  Looking at the functions all called every time a little change occurs in 0842 they all pretty much do many similar things.
     
    It's also inefficient to do this:
     
    vspeed=ipc.readSW("0842")
     
    in the first line of the function in which the value of the offset you are reading, again, is supplied as  the parameter value. Why read it again?

    I understand what you're saying, it does look inefficient, but I just don't see how to improve that. I've been at it almost all weekend, and tried various combinations but I only made things worse or not working at all. I did simplify the Lear45.lua as much as I could (attached as .txt), and it runs fine when started by hand. But if you could help me simplify it even more I would be much obliged.

     

     

    Why do you have ipc.sleep(3000) BEFORE each sound.play?
     
    Finally, it would help immensely if you Monitor the offsets you are using for events in Lear45 -- ie 281C, 0842, 0BDC and 04FE. Use the Monitor facilty in the Logging tab ad select "normal log". Then changes in those will be shown within the trace.

    The first ipc.sleep in line 15 is done because of another sound (door closing) being generated by the sim would not be drowned by the pax sign sound in line 16. The other ipc.sleep commands are done for more or less the same reasons: not to drown other sounds.

     

    I have done the monitoring of offsets 0366 ( ground), 0BDC (flapsetting), 3367(doors) and 04FE(seatbeltsign from ProjectMagenta)

    Logfiles attached as .txt

     

     

    I have just found this line in your Log:

     

       103382 LUA.1: E:\Prepar3D\Modules\Lear45.lua:108
     
    That is the line in the Lear45.lua file playing a sound:
     
         sound.play("E:\\Prepar3D\\sound\\CA_seatbelts off.wav")    
     

    Is that what you are not hearing? If so, then additionally to what I said just above, could you add these lines to the [General] section in your FSUIPC4.INI:

     

    Debug=Please

    LogExtras=x20

     

    then run the sim and do the test -- the log should then contain details of the Sound calls made, and maybe why they failed.

    This line is no longer relevant, because the whole lua has been changed. The seatbelt.wav was playing however, but it only works when my other PC's running PM RJ, PM MCP and PM CDU are connected with WideFS.


    I added the above lines to my FSUIPC General section in the .ini.

     

    The log files are attached and their names should be self explanatory.

     I hope you have enough information to see what I am overlooking.

     

    Thanks for your patience and best regards,

    Jaap

    FSUIPC4log with LUA Autostart.txt

    FSUIPC4log with LUA Manual start.txt

    ipcready.txt

    Lear45.txt

    FSUIPC4log with LUA Autostart.txt

    FSUIPC4log with LUA Manual start.txt

    ipcready.txt

    Lear45.txt

  4. Hello Pete,

     

    Thanks for jumping in....

     

    Did you try Lus trace/logging to see why it didn't work -- just a checkbox in the FSUIPC logging tab? Did you  monitor the offset 04FE to see if was indeed changing? Did you even simply check the FSUIPC log to see if an error was reported?

    Yes I did, I even had the Console log opened so that I could see what was going on. On some occasions I had a Lua Error: Attempt to calll a number value , which made it kind of clear what I did wrong, but on other occasions the LUA just ended without doing anything I expected, and without any errors.

     

    So I tried the solution you gave me and of course that works flawlessly, (GRRR)

    Then I looked back to the things I tried before an came across this one:

    -- Seatbelt announcement
    function seatbelt(offset,seatbelt)
       Landed=ipc.readUW("0366")
       if Logic.And(seatbelt, 128) == 0 and (ipc.readUW("0366") == 0) then
         ipc.sleep(3000)    
         sound.play("E:\\Prepar3D\\sound\\CA_seatbelts off.wav")    
       end
    end
    

    Apart from a little addition, this looks almost the same, but I bet that you'll spot the fault in the wink of an eye.... I took me a while, but then I spotted it too: ​​

    Logic.And instead of logic.And. Oh my....... (bad words come to mind..)!.

     

    So that is solved now.

    Which brings me to my next question, the actual reason I started this topic: Why does the completed LUA not run correctly when started from within ipc.ready.lua? Are there limitations to the amount of LUA's that can be started from there, and can they interfere with each other when the same functions or offsets are used? And why did it run before updating from FSUIPC 4.939n (I'm not quite sure about that version) to 4.945a?

     

    When all LUA's are started automatically the LUA in question runs also but does this:

     

       185673 LUA.1: E:\Prepar3D\Modules\Lear45.lua:10
       185673 LUA.1: E:\Prepar3D\Modules\Lear45.lua:11
       185673 LUA.1: E:\Prepar3D\Modules\Lear45.lua:12
       185673 LUA.1: E:\Prepar3D\Modules\Lear45.lua:13
       191679 LUA.1: E:\Prepar3D\Modules\Lear45.lua:11
       191679 LUA.1: E:\Prepar3D\Modules\Lear45.lua:12
       191679 LUA.1: E:\Prepar3D\Modules\Lear45.lua:13
       197685 LUA.1: E:\Prepar3D\Modules\Lear45.lua:11
       197685 LUA.1: E:\Prepar3D\Modules\Lear45.lua:12
       197685 LUA.1: E:\Prepar3D\Modules\Lear45.lua:13
       200820 LUA.2: Offset Change event: calling "Doors" in "E:\Prepar3D\Modules\GoFlightleds.lua"
       200820 LUA.2: E:\Prepar3D\Modules\GoFlightleds.lua:44
       200820 LUA.2: Local: val = 0
       200820 LUA.2: E:\Prepar3D\Modules\GoFlightleds.lua:47
       200836 LUA.2: E:\Prepar3D\Modules\GoFlightleds.lua:49
       200836 LUA.2: Waiting for an event in "E:\Prepar3D\Modules\GoFlightleds.lua"
       203691 LUA.1: E:\Prepar3D\Modules\Lear45.lua:11
       203691 LUA.1: E:\Prepar3D\Modules\Lear45.lua:15
       203691 LUA.1: E:\Prepar3D\Modules\Lear45.lua:29
       203691 LUA.1: Waiting for an event in "E:\Prepar3D\Modules\Lear45.lua"

     

    In steps 11, 12 and 13 it's waiting for the door to be closed. Then when it is, it steps from 11 to 15 to 29 which is the end of the first part, but no sounds are played. (the LUA in use is the one from Post #3).

     

     When I remove the Lear45.lua from ipc.ready.lua and assign this LUA via FSUIPC buttons&switches to a switch, it runs perfectly together with the two LUA's that were started from within ipc.ready.lua (GFPower.lua and GoFlightleds.lua).

    I find that very strange. Maybe you can tell what is going wrong?

     

    In any case, thanks for helping and your patience.

    And sorry for the lenghty topic...

     

    Regards,

    Jaap

  5. I removed the Quotes and also tried the other form of notation Paul, but none of it was succesfull.

    I have been trying and trying for almost two days now and can't get it to work. Tried a lot off combinations and conditions, but it will not work.

    It should be so simple:

    All I want is a message being played when the seatbelt switch is set to off. That's all. How hard can it be? Am I so stupid that I can't figure it out?

    I know there would be easier ways to do it, but to operate the seatbeltsign in Project Magenta's RJ Glass displays, I already assigned that switch via FSUIPC Buttons&Switches. Otherwise I could assign a small lua, that just plays a message, to that switch.....

     

    I have tried to keep it as simple as I could think off:

    -- Seatbelt announcement
    
    function seatbelt(offset,value)
    seatbelt=ipc.readUW(0x04FE)  
    if (logic.And(seatbelt, 128) == 0) then	
    	 sound.play("E:\\Prepar3D\\sound\\CA_seatbelts off.wav")	
    	 end       
    end
    
    event.offset(0x04FE,"UW","seatbelt")

    I tried 0x080 instead of 128, and ~=128 or ==0 or ~=0 etc. But the closest I got was when the seatbelt switch was already off when I started the script, and the message was played! So I tried moving things around a bit, but it didn't get better.

    My holidays are now over and I'm quite fed up with it. The rest of my script is working OK, only not when started from within ipc.ready.lua.

     

    Thanks for helping Paul.

     

    Maybe when Pete is back he can solve it for me.

    I'm done for now!

    Regards,

    Jaap

     

    Any other suggestions: Welcome!

  6. Paul,

    Yes, you are absolutely right about the SW that should have been an UW! Not that I figured it out myself but shortly after my last post I came across a LUA somewhere that used the same offset and that said UW, so I already changed that.

    If I understand your explanation right a Signed Word is capable of using negative numbers and an Unsigned Word is not?

    I have some LUA documents opened here, but there's so much to absorb.......

     

    To make testing easier i have narrowed my lua down to this, as the rest works ok:

    -- Seatbelt announcement
    
    function seatbelt(offset,value)
    seatbelt=ipc.readUW("0x04FE")  
    landing=ipc.readUW("0x0366")
    if (logic.And(seatbelt, 128) == 128) and (landing == 0) then	
    	 sound.play("E:\\Prepar3D\\sound\\CA_seatbelts off.wav")	
    	 end       
    end
    
    event.offset(0x04FE,"UW","seatbelt")
    
    --global variables
    --end script--
    

    And I have tried a number of variations, but still get the same error. I am baffled, cause usually I can get things working by asking for advice and looking around how others have solved things, but I can't put my finger on this one. It's probably something stupid we're overlooking....

     

    @Jorge: In now have LUAEdit and that does the same thing. Also trying the debug function seems buggy. It finds errors in perfectly working lua's even the ones from the FSUIPC bundle. But in any case I don't have to count the lines anymore!

     

    Thanks for helping!

    Jaap

  7. Hi Paul,

    Thanks! Have the editor now, that's a little bit easier to work with.

    I already tried those two offsets you suggest, but it seems Project Magenta handles it in a different way, so they did nothing.

    However  I found an Offset in the Project Magenta part of the offset lists:

    Offset    Size    Use

    04FE       2       PFD

    Various (Read Only)

    Bit 0 Windshear

    1 Below G/S

    2 Caution

    3 Warning

    4 Stab Out Of Trim (Boeing only and TrimMax/TrimMin have to be set)

    6 Eight Mode ND Active

    7 Seatbelt Sign

    8 No Smoking Sign

    9 Weather Radar (Captain)

    10 EGPWS/Terrain (Captain)

    11 TCAS Active (Captain)

    13 TCAS WARNING

    14 TCAS ALERT

     

     and I tried this in between what I already had:

    -- Seatbelt announcementseatbeltflag=0function seatbelt(offset,value)seatbelt=ipc.readSW("04FE")landing=ipc.readUW("0366")   	if (ipc.readSW ("04FE") == 128) and (landing == 0) then			 sound.play("E:\\Prepar3D\\sound\\CA_paxsign.wav")	 ipc.sleep(3000)	 sound.play("E:\\Prepar3D\\sound\\CA_seatbelts off.wav")		 seatbeltflag=1	 end        end--LUA calls for events FSUIPCevent.offset(0x281C,"UD","welcome")event.offset(0x0842,"SW","climb")event.offset(0x0842,"SW","descent")event.offset(0x0842,"SW","final")event.offset(0x0BDC,"UD","landing")event.offset(0x04FE,"SW","seatbelt")--global variables--end script--

    But all I get is an Error: Attempt to calll a number value....

    I must admit that all that bit and byte Word and DWord stuff puzzles me very much, so I probably did something horribly wrong, but I just don't see it.

    Ideas?

     

    Thanks,

    Jaap

  8. Hello Paul,

    Thanks for looking at my LUA. I was puzzled about the colors in code window too, but had no Idea what it was for. So you can see by the colors when there is something faulty? You say you use a "Lua editor"? I write them in notepad, and that has no colors... What editor do you use? Maybe it can make my life a bit easier.

    Indeed if I run the script manually, it starts, but only the two first messages play, and sometimes, out of the blue, a descent or final message plays?! I run the FSUIPC console window next to my flightsim, and no errors appear but it sort of "hangs" in lines 8,9 and 10.

    I have fiddled around with the file and came up with a new one, and that seems to run fine so far, but only when I start it manually....

    I did change the division operations from 3.28084 /256 to ​3.28084/256 without space.

    Maybe you or someone else can check this file, and see if I did something wrong or too complicated.....

    -- Welcome Announcement, will start when door is closed. Door must be open first!--
    
    wcflag=0
    function welcome(offset,value)
        Battery=ipc.readUD("281C")	
    	if (ipc.readUD("281C") == 1) then
    	 repeat	  
    	  ipc.readUB("3367")
    	  ipc.sleep(6000)
    	 until (ipc.readUB("3367") > 0 )
    		 while (ipc.readUB("3367") > 0) do 
    	            ipc.readUB("3367")
    				ipc.sleep(6000)
    		 end
    		    if (value > 0) and (wcflag == 0) then
                             ipc.sleep(3000)
                             sound.play("E:\\Prepar3D\\sound\\CA_paxsign.wav")
    	                 ipc.sleep(3000)
    			 sound.play("E:\\Prepar3D\\sound\\CA_Welcome.wav") --Welcome Message
    			 ipc.sleep(60000)
                             sound.play("E:\\Prepar3D\\sound\\CA_paxsign.wav")
    	                 ipc.sleep(3000)
    			 sound.play("E:\\Prepar3D\\sound\\CA_SafetyMessage.wav") --Safety Message
    			 wcflag=1 --don`t repeat sound
    			end
    	else
    	wcflag=1
    	end
    end
    
    -- Climb Announcements
    
    climbflag=0
    function climb(offset,value)
    vspeed=ipc.readSW("0842") * -3.28084
    groundalt=ipc.readUD("0020") * 3.28084/256
    alt=ipc.readUD("0574") * 3.28084
       	if (ipc.readUB("0609") == 1) and (climbflag == 0) then		
    	 if
    	 (alt > 8000) and (vspeed > 1500) then
             sound.play("E:\\Prepar3D\\sound\\CA_paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CA_CapClimb.wav")	-- climb announcement
    	 climbflag=1
    	 end
            end
    end
    
    
    --Descent announcements
    
    descendflag=0
    function descent(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084/256
    alt=ipc.readUD("0574") * 3.28084
      	if (ipc.readUB("0609") == 1) and (descendflag == 0) then	
    	 if  
             (alt < 15000) and (vspeed > 1200) then
             sound.play("E:\\Prepar3D\\sound\\CA_paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CA_CapDescent.wav")	-- descent announcement
    	 descendflag=1
    	 end
    	end
    end
    
    -- Final announcement
    
    finalflag=0
    function final(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084/256
    alt=ipc.readUD("0574") * 3.28084
      	if (ipc.readUB("0609") == 1) and (finalflag == 0) then	
    	 if  
             (alt < 6000 ) and (vspeed > 1000) and (descendflag == 1) then
    	 sound.play("E:\\Prepar3D\\sound\\CA_paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CA_BeforeLanding.wav")	-- descent announcement
    	 finalflag=1
    	 end
    	end
    end
    
    -- After Landing Announcement
    
    landingflag=0
    function landing(offset,value)
        flaps=ipc.readUD("0BDC")
       Landed=ipc.readUW("0366") 
      	if (ipc.readUW("0366") == 1) and (landingflag == 0) and (finalflag == 1 ) then	
    	 if  
             (flaps == 16383) then
    	 sound.play("E:\\Prepar3D\\sound\\CA_paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CA_AfterLanding.wav")	-- After Landing announcement
    	 landingflag=1
    	 end
    	end
    end
    
    --LUA calls for events FSUIPC
    
    event.offset(0x281C,"UD","welcome")
    event.offset(0x0842,"SW","climb")
    event.offset(0x0842,"SW","descent")
    event.offset(0x0842,"SW","final")
    event.offset(0x0BDC,"UD","landing")
    
    --global variables
    --end script--
    
    
    
    
    
    
    

     

    I'm also trying to add a seatbelt announcement that should play when the seatbelt sign has been turned off, but I can't seem to find the right offset for that. I also use Project Magenta RJ Glass cockpit, and that shows when the signs are on or off. Maybe someone can help me with that too?

     

    Thanks in advance,

    Jaap

  9. Hello all,
    I hope someone with extensive LUA knowledge here, is prepared to take a look at my Lua. It is used to play announcements in the various stages of flight.

     I found it somewhere on the net, so I did not write it myself and frankly I'm not very smart with LUA programming. The strange thing is that before I updated my FSUIPC version to 4.945a it used to work without problems but now it does not anymore.

    The Lua is started with the Sim (prepar3d) via ipcready.
    Sadly I have not updated FSUIPC for a long time and can't trace which version I used before, otherwise I might be able to go back to that version....

    I also have the log attached, but it shows no errors though. By looking at the log, the LUA seems to run, but it doesn't.

    Only when I stop the LUA through some FSUIPC programmed buttons and then restart it, it runs (for a while)....

     

    Anyway, here it is. I hope someone can look it over and maybe find something incorrect.

    Thanks in advance,

    Jaap

    -- Welcome Announcement, will start sound if door closed. Note: Door must be open first!--
    
    wcflag=0
    doortime=0
    function welcome(offset,value)
        ground=ipc.readUW("0366")	--only on ground
    	if (ipc.readUW("0366") == 1) then
    	 repeat	  -- wait for door open, if open break
    	  ipc.readUB("3367")
    	  ipc.sleep(1000)
    	 until (ipc.readUB("3367") > 0 )
    		 while (ipc.readUB("3367") > 0) do -- wait for door closed
    	            ipc.readUB("3367")
    				ipc.sleep(1000)
    		 end
    		    if (value > 0) and (wcflag == 0) then
    			 sound.play("E:\\Prepar3D\\sound\\CD_Welcome.wav") --Welcome Message
    			 ipc.sleep(60000)
    			 sound.play("E:\\Prepar3D\\sound\\CD_SafetyMessage.wav") --Safety Message
    			 wcflag=1 --don`t repeat sound
    			end
    
    	else
    	wcflag=1
    	end
    end
    
    -- Climb Announcements
    
    cflag=0
    function climbp(offset,value)
    vspeed=ipc.readSW("0842") * -3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
       	if (ipc.readUB("0609") == 0) and (cflag == 0) and (tbflag == 0) then 	-- Piston Engine?
    	 if
    	 (alt > 5000) and (vspeed > 300) and (altogr > 2000) then 	-- no sightseeing
             sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_CapClimb.wav")	-- climb announcement
    	 cflag=1
    	 end
    	end
    end
    
    ctflag=0
    function climbt(offset,value)
    vspeed=ipc.readSW("0842") * -3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
      	if (ipc.readUB("0609") == 5) and (ctflag == 0) and (tbflag == 0) then	-- Turbo Engine?
    	 if
    	 (alt > 11000) and (vspeed > 900) then
             sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_CapClimb.wav")
    	 ctflag=1
    	 end
    	end
    end
    
    cjflag=0
    function climbj(offset,value)
    vspeed=ipc.readSW("0842") * -3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
       	if (ipc.readUB("0609") == 1) and (cjflag == 0) and (tbflag == 0) then	-- Jet?
    	 if
    	 (alt > 10000) and (vspeed > 1200) then
             sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_CapClimb.wav")	-- climb announcement
    	 cjflag=1
    	 end
    	end
    end
    
    
    --Descent announcements
    
    dpflag=0
    function descentp(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
      	if (ipc.readUB("0609") == 0) and (dpflag == 0) and (tbflag == 0) then 	-- Piston Engine?
    	 if
    	 (alt < 6000) and (vspeed > 300) and (altogr > 2000) then 
             sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_CapDescent.wav")	-- descent announcement
    	 dpflag=1
    	 end
    	end
    end
    
    dtflag=0
    function descentt(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
      	if (ipc.readUB("0609") == 5) and (dtflag == 0) and (tbflag == 0) then	-- Turbo Engine?
    	 if
    	 (alt < 13000) and (vspeed > 900) then
             sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_CapDescent.wav")	-- descent announcement
    	 dtflag=1
    	 end
    	end
    end
    
    djflag=0
    function descentj(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
      	if (ipc.readUB("0609") == 1) and (djflag == 0) and (tbflag == 0) then	-- Jet Engine?
    	 if
    	 (alt < 18000) and (vspeed > 1200) then
             sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_CapDescent.wav")	-- descent announcement
    	 djflag=1
    	 end
    	end
    end
    
    -- Final announcement
    
    fplflag=0
    function finalp(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
      	if (ipc.readUB("0609") == 0) and (fpflag == 0) then	-- Piston Engine?
    	 if
    	 (altogr < 2000) and (vspeed > 300) and (dpflag == 1) and (tbflag == 0) then	-- coming from descent
    	 sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_BeforeLanding.wav")	-- final announcement
    	 dpflag=1
    	 end
    	end
    end
    
    ftflag=0
    function finalt(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
      	if (ipc.readUB("0609") == 5) and (ftflag == 0) then  -- Turbo Engine?
    	 if
    	 (altogr < 4000) and (fpflag == 1) and (vspeed > 800)	and (tbflag == 0) then	--coming from descent
    	 sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_BeforeLanding.wav")	-- final announcement
    	 ftflag=1
    	 end
    	end
    end
    
    fjflag=0
    function finalj(offset,value)
    vspeed=ipc.readSW("0842") * 3.28084
    groundalt=ipc.readUD("0020") * 3.28084 /256
    alt=ipc.readUD("0574") * 3.28084
    altogr=alt - groundalt
      	if (ipc.readUB("0609") == 1) and (fjflag == 0) then	-- Jet Engine?
    	 if
    	 (altogr < 4000 ) and (vspeed > 1000) and (djflag == 1) and (tbflag == 0) then	 --coming from descent
    	 sound.play("E:\\Prepar3D\\sound\\paxsign.wav")
    	 ipc.sleep(3000)
    	 sound.play("E:\\Prepar3D\\sound\\CD_BeforeLanding.wav")	-- descent announcement
    	 fjflag=1
    	 end
    	end
    end
    --LUA calls for events FSUIPC
    
    event.offset(0x0366,"UW","welcome")
    
    event.offset(0x0842,"SW","climbp")
    event.offset(0x0842,"SW","climbt")
    event.offset(0x0842,"SW","climbj")
    event.offset(0x0842,"SW","descentp")
    event.offset(0x0842,"SW","descentt")
    event.offset(0x0842,"SW","descentj")
    event.offset(0x0842,"SW","finalp")
    event.offset(0x0842,"SW","finalt")
    event.offset(0x0842,"SW","finalj")
    --global variables
    --end script--
    

    ~

     

     

    Log.txt

  10. Hello Pete,

     

    Thansk for your answer. Pity that PM has no toggle facility for A/T and Flightdirectors. I asked them but got replied that I should try it with Offset 5410.

     

    When you mentioned the Flag Facility I remembered to have read something about that in the FSUIPC manuals. At that time I must have thought I would never need it, so I kind of forgot it.....

    With the manual at my side I started trying and after some errors I got this: 

     

    114=P101,29,C1005,3842

    115=CP(F+15,2)101,29,Cx0F005410,x00080000

    116=CP(F-15,2)101,29,Cx0F005410,x00100000

     

    And it works perfectly....   Did I do it in the correct way?

     

    Now I can do the same for the Flight Directors!

     

    Thanks again!

     

    Regards,

    Jaap

  11. Hello Mr. Dowson, and a Merry Christmas to you!

     

    I have a question about the options for the PM MCP Flight Director in the Buttons & Switches dropdownlist.

    Currently I am in the process of converting a GoFlight Boeing MCP to look and act like a Lear 45 MCP. This means some disassembling and making another frontplate. Some of the Boeing functions are obsolete, others will have to be amended if possible.

    This is how it looks at the time:

     

    MCP%20voorkant%20Klein.jpg

     You notice that switching the flight directors on / off no longer happens with a flip switch like with the Boeing, but with a push button, and herein lies my problem.

     

    I have hardwired the flip switch from the Go Flight MCP to the Push button on the Lear MCP. This Pushbutton is a momentary one so when I push it, the Flight Director comes on, and goes off again when I release the button!

    That was not meant to happen, but logical cause the GoFlight hardware is designed for a flip switch.

     

    I was hoping to be able to solve that with the FSUIPC buttons and Switches section but that is only partly true.

    I have now assigned the FD1 to the PM MCP FD1 ON  function. When I press it the FD goes on, but now I can never turn it off again with the same button. Same goes for the A/T. Originally also a Flip switch, but now a Push button,

     

    So, after a long story here is my question; Is it possible for you to add three options to the list of selections called: Toggle PM MCP FD1, a Toggle PM MCP FD2 and  Toggle PM MCP A/T ? That would instantly solve it.......

     

    Thanks for reading and Best Regards,

     

    Jaap Both

    Netherlands

  12. Hello mr. Dowson,

    When starting my APU via an FSUIPC assigned switch, I need to send the keycode ALT+a to two of my networked PC's that run PMRJ (connected via WideFS), to tell both PMRJ instances running on two separate PC's that the APU is starting and thus showing the APU spool up on the engine pages.

    When I flip the switch to start the APU, I hear the startup up sound via PMSounds, and when it has spooled up I switch on the APU generator (also assigned via FSUIPC) and I see my voltage go up from 24v to 28v, proving the APU is working in P3D.

    It used to work in FSX without any other programming , showing the APU starting in the PMRJ engines page as soon as I flipped the APU starter switch, but with P3D something must have changed for this to no longer work.

    The keycode to tell PMRJ to spool up the APU is ALT+a, given on the respective keyboard controlling the PMRJ PC, so I thought that if I could send this keycode over the network somehow, that I could get it working again.

    Is his possible at all? Do I make any sense? What could be the way of doing this in your opinion?

    Regards,

    Jaap

  13. No, it is really called Simcon.dll, and it is in the Voxatc main directory. I think it's VoxATC's own means to connect to Simconnect?

    I should not have any FSX, ESP or even older P3D dll's in my WinSXS dir. This is a clean Win7 and P3D 1.4 install. But I did install the P3D SDK however.

    Checking the WinSXS dir is a good suggestion however.

    EDIT: There are simconnect.dll's in the WinSXS dir, but I did not put them there. I suppose they came with Win7?

    Tegwyn just mailed me some suggestions to try out:

    Very strange. I think SimConnect is being overloaded which means that it

    can no longer handle VoxATC traffic and the throttles. Could you try

    with VoxATC traffic set to zero. Also, do you see the green taxi lights

    after getting taxi instructions? There may be a problem with all the

    calls to SimConnect to display the lights.

    Let's see what happens with his suggestions. I'll surely will ask Lockheed for help if the problem persists.

    EDIT: I tried a flight with the VoxATC Traffic slider set to zero, and that seemed to have helped. I was able to complete my flight for the first time!

    No real solution however, no Traffic at all is no fun! Posted my experiences on the P3d Forum too!

    My FSX setup was exactly the same as it is now with P3d:

    Four networked PC's, one of them running the Flightsim, MyTraffic, GoFlight and Voxatc. Another running Project Magenta PMRJ PMSounds and Simkits, yet another running PMRJ and OpenCockpits (with the Throttles), and the last one running PM MCP and PM CDU.

    The only thing changed in my setup was my main PC, that now has P3D instead of FSX......

    Thanks for your insights!

    Jaap

  14. What software are you using to drive these motorised throttles? Nothing in FSUIPC sends anything to control your motors. It'll be something your software is reading. How are the graphic throttles in P3D moving?

    I use OpenCockpits SIOC language for that. This is running on a different PC in the Network, connected via WideClient.

    As far as I know it only reads from FSUIPC and sends commands to the hardware throttles according to that.

    Here nothing changed, this PC is still as it was before installing P3D on my main system. With FSX everything was running fine....

    If P3D's SimConnect suddenly loses the user aircraft ID, not even recognising it as zero, then it is either a bug in P3D or something in SimConnect is getting corrupted.

    I am beginning to suspect that it has to do something with Simconnect...

    Looking at this part:

    61932 Aircraft="Learjet 45 Lear Project Edition"

    189510 Sim stopped: average frame rate for last 37 secs = 31.1 fps

    2268878

    1.It looks as if you are using an add-on aircraft. Are you sure it is 100% compatible with P3D? Can you test with the default Lear45 to check?

    2. There's a period of nearly 35 minutes elapsed before these errors occurred. Were your throttles going daft all that time? If not, did you notice anything specific occur just before they did? Perhaps complex add-on scenery? The G3D errors which occur are usually due to memory corruption as far as I can tell, so this might be just another symptom of the same.

    1. It's not really an add-on, It's the original Lear45 from P3D with my own Paint. I did test it with the Default Lear too, but there was no improvement.

    2. It was 35 minutes in the flight this log was from, other flights don't even last that long. Sometimes when getting ready to Taxi, and setting the Throttles, already makes P3D freez. But in those 35 minutes my Throttles went Daft right after setting A/T and TOGA, and they stayed that way until the program crashed...

    But I might have narrowed it down a bit. These Crashes and erratic throttle behaviour ONLY happen when I use VoxATC. The same flight without VoxATC gives no problems at all! I got instructions from Tegwyn West on how to Install VoxATC in P3D, and he had a special SimCon.dll for use with P3D.

    I followed his instructions, and overwrote the old SimCon.dll with the new one. (this file resides int the VoxATC main dir)

    You may need to enable SimConnect logging (see the FAQ subforum thread for instructions) and report all this to Lockheed-Martin so they can investigate -- but they may not want to know unless it is with supported add-ons or default stuff.

    Did that, and the log is over 500MB big! I have looked to some of it and see a lot of >>>>>>EXCEPTION<<<<<< entry's

    For the rest I have no Idea what to look at, and filter the problems out.... I have now sent the problem description and logs to VoxATC.

    Maybe you might have some ideas left?

    Thanks for your clear vision, and best regards!

    Jaap

  15. Hello Mr. Dowson,

    I have some strange behaviour with my 2 motorized throttles in my sim setup; they move crazy.

    I am using fsuipc 4.855 with P3D, and this is my fsuipc log. I can't make anything of it, and hope you can point me in the right direction.

    It's about the last part of the log....

    ********* FSUIPC4, Version 4.855 by Pete Dowson *********

    Running inside Prepar3D on Windows 7

    Module base=62110000

    User Name="edited out"

    User Addr="edited out"

    FSUIPC4 Key is provided

    WideFS7 Key is provided

    187 System time = 17/09/2012 00:55:53

    187 FLT UNC path = "\\GAMEPC1\FSPLANS\"

    187 Trying E:\Prepar3D\Modules\SimConnectP3D.dll

    203 Found it: trying to connect

    203 FS UNC path = "\\GAMEPC1\Prepar3D\"

    499 LogOptions=00000000 00000001

    499 Wind smoothing fix is fully installed

    499 G3D.DLL fix attempt installed ok

    499 SimConnect_Open succeeded: waiting to check version okay

    499 Trying to use SimConnect Prepar3D

    2106 Running in "Lockheed Martin® Prepar3D®", Version: 1.4.4747.0 (SimConnect: 1.4.0.0)

    2106 Initialising SimConnect data requests now

    2106 FSUIPC Menu entry added

    2137 \\GAMEPC1\FSPLANS\Standard P3D Flight.flt

    2137 \\GAMEPC1\Prepar3D\SimObjects\Airplanes\Mooney_Bravo\Mooney_Bravo.AIR

    53976 System time = 17/09/2012 00:56:47, Simulator time = 11:06:55 (15:06Z)

    53992 Aircraft="Mooney Bravo With G1000"

    54226 Starting everything now ...

    54257 Using "E:\GoFlight\GFDEV.DLL", version 2.2.1.0

    54257 GoFlight GFP8 detected: 4 devices

    54257 GoFlight GFT8 detected: 3 devices

    54257 GoFlight GFLGT detected: 1 device

    54257 GoFlight GF166 detected: 4 devices

    54257 GoFlight GFTQ6 detected: 1 device

    54257 GoFlight GFMCPPRO detected: 1 device

    54257 GoFlight GFWP6 detected: 1 device

    54257 LUA.0: beginning "E:\Prepar3D\Modules\ipcReady.lua"

    54304 LUA.0: ended "E:\Prepar3D\Modules\ipcReady.lua"

    55505 Advanced Weather Interface Enabled

    61417 \\GAMEPC1\Prepar3D\SimObjects\Airplanes\Lear45\Lear45.AIR

    61417 D:\Jaap\My Documents\Prepar3D Files\VoxATC IFR EHRD-EDDS.PLN

    61417 Weather Mode now = Theme

    61417 \\GAMEPC1\FSPLANS\VoxATC IFR EHRD-EDDS.FLT

    61932 Aircraft="Learjet 45 Lear Project Edition"

    189510 Sim stopped: average frame rate for last 37 secs = 31.1 fps

    2268878 Exception 3 "UNRECOGNIZED_ID", Ref 5906, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:1"

    2268878 Exception 3 "UNRECOGNIZED_ID", Ref 5906, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:1"

    2269190 Exception 3 "UNRECOGNIZED_ID", Ref 5910, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:2"

    2269190 Exception 3 "UNRECOGNIZED_ID", Ref 5910, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:2"

    2269378 Exception 3 "UNRECOGNIZED_ID", Ref 5912, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:3"

    2269378 Exception 3 "UNRECOGNIZED_ID", Ref 5912, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:3"

    2269690 Exception 3 "UNRECOGNIZED_ID", Ref 5913, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:4"

    2269690 Exception 3 "UNRECOGNIZED_ID", Ref 5913, Index param 3 on write SetData for "GENERAL ENG THROTTLE LEVER POSITION:4"

    If you need more data, please let me know what it is....

    Thanks in advance,

    Jaap Both

  16. That's because, as with all indicators and buttons in GF units (and in FSUIPC generally), the lights are numbered from 0 (0-5 in this case) not 1. Your attempt to set light 6 is ignored.

    I know, and that is where the strangness starts: when I only do this:

    gfd.SetBright(GFWP6, 0, 10) 
    gfd.SetColour(GFWP6, 0, 0, 1)
    gfd.SetLight(GFWP6, 0, 0)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 0)

    (I have set id# 0 here) No lights come on.

    But when I do this:

    gfd.SetBright(GFWP6, 0, 10) 
    gfd.SetColour(GFWP6, 0, 1, 1)
    gfd.SetLight(GFWP6, 0, 1)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 1)

    the First light on the module goes on and off!

    That is why I also tried to address light #6 which should not be there.

    Could there be a shift of some kind?

  17. I'd need to look af GFpower. I don't remember it.

    Here it is:

    -- Master GF Driver
    -- Looks after power on/off checking, and runs other Lua's depending on connected units
    
    local models = {} -- for counts of devices of each type
    brightness = 10 --default brightness for all units
    
    --##########################################################
    -- initial power on/off checking
    powerset = 0 -- 1 Batt, 2 Batt&gt;18v, 4 Avionics, 8 Not failed
    
    if ipc.readUD(0x281C) ~= 0 then
        powerset = 1 -- Battery is on to start
    end
    if ipc.readDBL(0x2834) &gt; 18.0 then
        powerset = logic.Or(powerset, 2) -- Battery is &gt; 18v
    end
    if ipc.readDBL(0x2E80) ~= 0 then
        powerset = logic.Or(powerset, 4) -- Avionics on
    end
    if ipc.readUB(0x0B6A) == 0 then
        powerset = logic.Or(powerset, 8) -- Electrics not failed
    end
    
    --##########################################################
    -- Power on or off
    local function setallbright(B)
    		m = 0
    		while m &lt; 32 do
    		    if models[m] ~= 0 then
    		        u = 0
    		        while u &lt; models[m] do
    				    		if m == GFLGT2 then
    		 		        		-- to counter problem in LGT2
    										-- brightness value is reversed!    	
    								    gfd.SetBright(m, u, 15-B)
    								else
    		                gfd.SetBright(m, u, B)
    		            end
    		            u = u + 1
    		        end
    		    end
    		    m = m + 1
    	  end
    end
    
    local function checkpower()
        if powerset == 15 then
        		setallbright(brightness)
        else
        		setallbright(0)
        end
    end
    
    -- ########################################################
    -- Detecting changes by events on offsets
    local function keeptrack(value, n)
       if value == 0 then
          powerset = logic.And(powerset, 15 - n)
       else
          powerset = logic.Or(powerset, n)
       end
       checkpower()
    end
    
    -- Battery switch
    function batt(offset, value)
    		keeptrack(value, 1)
    end
    
    -- Battery voltage
    function battvolt(offset, value)
        keeptrack(value, 2)
    end
    
    -- Avionics switch
    function avionics(offset, value)
        keeptrack(value, 4)
    end
    
    -- Electrical failure
    function elecfail(offset, value)
        keeptrack(1 - value, 8)
    end
    
    -- ########################################################
    -- Main program (executed once only):
    gfd.BlankAll()
    
    -- Determine numbers of each device
    m = 0
    while m &lt; 32 do
    	  models[m] = gfd.GetNumDevices(m)
    	  if models[m] ~= 0 then
    	  		-- Run other Luas here, one for each type connected
    	  		luaname = string.format("Lua %s", gfd.GetName(m))
    	  		ipc.macro(luaname) 		
    		end
    	  m = m+1
    end
    
    checkpower()
    
    event.offset(0x281C, "UD", "batt")
    event.offset(0x2834, "DBL", "battvolt")
    event.offset(0x0B6A, "UB", "elecfail")
    event.offset(0x2E80, "UD", "avionics")
    
    -- ########################################################
    

    Okay. It will be setting lights off by using SetLights, but not by setting the colour to black. However, the GFDev.DLL probably sets lights off using colour black, and it is likely that the GF driver doesn't restore its own colour. I can't think of anything else which could be worng.

    That's Clear, and I think that might have been because I left out the SetColour part!

    without seeing your code I can't really comment., but if it's like the SetLights example i'm not really surprised! ;-)

    This is what I have now, and it's not supposed to do anything but playing with the lights. It's not part of anything I need to do!

    gfd.SetBright(GFWP6, 0, 10) 
    gfd.SetColour(GFWP6, 0, 1, 1)
    gfd.SetLight(GFWP6, 0, 1)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 1)
    
    
    gfd.SetColour(GFWP6, 0, 2, 2)
    gfd.SetLight(GFWP6, 0, 2)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 2)
    
    
    gfd.SetColour(GFWP6, 0, 3, 3)
    gfd.SetLight(GFWP6, 0, 3)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 3)
    
    
    gfd.SetColour(GFWP6, 0, 4 ,4)
    gfd.SetLight(GFWP6, 0, 4)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 4)
    
    
    gfd.SetColour(GFWP6, 0, 5, 5)
    gfd.SetLight(GFWP6, 0, 5)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 5)
    
    
    gfd.SetColour(GFWP6, 0, 6, 7)
    gfd.SetLight(GFWP6, 0, 6)
    ipc.sleep(250)
    gfd.ClearLight(GFWP6, 0, 6)

    Apart from it being very rudimentary and might be missing some, it does turn on the lights one by one and turns them off again.

    There's only one strange thing, and you probably see what's wrong with it right away: the last light does not come on at all.

    That is the light I started out with, before I decided to add all the others, so at first I only had the last 4 lines, plus the SetBright line (line1)

    Have you read the documentation? What is it you don't understand?

    Read it several times, but I must be missing something. These programming languages are very hard for me to understand, but I'm trying my best.

    Thanks for being so patient with me!

    Jaap

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.