Jump to content
The simFlight Network Forums

FSUIPC Hardware Button


Recommended Posts

Hello,

a short question:

How can i provide that a Hardware Switch (ON/ON) connected on the BU0836X from Leo http://www.leobodnar.com/products/BU0836X/

always is in the same position as the switch in the Cockpit ?

For example the Landing Lights of an PMDG737:

HWS - Hardware Switch

SWS - The Switch in the Cockpit

HWS = OFF , SWS = OFF

now set the HWS to on, ok, HWS = ON and SWS is also ON

BUT NOW I TAKE THE MOUSE AND SET THE SWS TO OFF !!!

Now the HWS is ON and the SWS is OFF.

When i now set the HWS to OFF the SWS switches to ON.

This is exactly the wrong direction of the Switches.

What can i do here ?

Matthias

Link to comment
Share on other sites

a short question:

And a short answer.

If you program an on/off locking toggle switch to operate a Toggle control, there is no solution UNLES you have a program which is monitoring the state of your switches and restoring the state of whatever it is they control whenever it sees that state change. That might be a separate program interfacing to FSUIPC, or it might be a Lua plug-in. either could do it -- providing you can read that state.

But if it is only the Action of the switch which concerns you, not its physical position in relation to the current state, then never assign it to toggling type controls, only those which switch things on specifically, or off specifically. If such a control doesn't exist, then for most FS internals there's likely to be an offset which you can set or clear using the Offset controls.

For example the Landing Lights of an PMDG737:

Are the landing lights on the aircraft controlled by the FS internals, or PMDG's own implementation? If it is the FS landing lights then it is easy: there are separate LANDING LIGHTS ON and OFF controls. If it is PMDG, then it depends whether they provide separate on and off facilities or only a toggle.

Regards

Pete

Link to comment
Share on other sites

Hello Pete,

thanks for the fast answer !!

Its the PMDG and here are in your Macro ( and the PMDG Software ) only a Toggle for the Logo Lights.

I have testet the Landing Lightsit works. ( Programmed the FS9 Landing Lights OFF to the Button OFF and ON to ON )

But there are no offset for the Strobes / Logo / ACL - Lights in the FS9.

Do you know a software scanning the Hardware Positions of the BU0836X and send the Actual Positions over the FSUIPC to the FS ?

Matthias

Link to comment
Share on other sites

But there are no offset for the Strobes / Logo / ACL - Lights in the FS9.

Have you tried the individual light switch bits in FSUIPC offset 0D0C? You can set and clear individual bits there using the Offset Word SetBits and Offset Word Clearbits controls. Of course if the PMDG aircraft does its own thing for the lights then that won't work, but you say the normal FS landing lights work okay?

Do you know a software scanning the Hardware Positions of the BU0836X and send the Actual Positions over the FSUIPC to the FS ?

No. But if the buttons come in via normal Windows joystick scanning, you could write one as a Lua plug-in.

Did you ask in the MyCockpit forums as I suggested?

Regards

Pete

Link to comment
Share on other sites

Hello Pete,

thanks for the Answer, but i dont understand what you mean about the SetBit and ClearBit ?

Have you tried the individual light switch bits in FSUIPC offset 0D0C? You can set and clear individual bits there using the Offset Word SetBits and Offset Word Clearbits controls

Where and How can/must i do that? In the FSUIPC Window i have not found some equal?

And also what is a Lua plug-in ??

This http://www.artweaver.de/lua-plug-in-de/ ??

Matthias

Link to comment
Share on other sites

thanks for the Answer, but i dont understand what you mean about the SetBit and ClearBit ?

Sorry, they are the FSUIPC assignable controls I mentioned to you, here (in bold red):

Have you tried the individual light switch bits in FSUIPC offset 0D0C? You can set and clear individual bits there using the Offset Word SetBits and Offset Word Clearbits controls

Where and How can/must i do that? In the FSUIPC Window i have not found some equal?

Sorry, I thought you knew how to assign controls to buttons already? See the Buttons & Switches tab in FSUIPC options. There's a whole chapter about assigning buttons in the User Guide.

And also what is a Lua plug-in ??

Please look in your FS Modules folder and see some of the documentation installed for you, including the Lua documents. There's also the same in the Announcements here in the Forum.

It would always be worth your while looking through the Announcements here from time to time. They are there for your benefit!

Pete

Link to comment
Share on other sites

ahh...you mean the Button+Switches Page. I know this Page but where can i enter an Offset here?

In the field handily labelled "offset" which appears when you select an Offset control! It does actually tell you this in the User Guide, in the Buttons chapter, in the part about additional controls beginning "Offset controls". The offset field never appears for controls other than Offset controls.

Also i have not found in any Documents what the "Parameter" Field means ? ( under the "Clear" Button )

It is used, surprisingly enough, to supply a parameter to those controls which need a parameter, like the Offset controls, and pretty much all those controls ending in "set", plus a fair few others.

If you never want to use any such controls, you don't need to worry. If you do need to use such controls you'll know what the parameter means.

Pete

Link to comment
Share on other sites

Ahh,

thanks..now i have found it .. Sorry i am a absolute Beginner in Homecockpit building.

Another Question about the Meter Panel. Is there an Offset to get the Values for DC AMPS / DC VOLTS / AC AMPS / AC VOLTS and CPS FREQ ?

And also for the many LED coming up when an engine fails or an fuel pump is not working ?

Mean eg. the Lit Buttons over the GEN 1 ON / OFF switch named "TRANSFER BUS OFF" and "SOURCE OFF".

Matthias

Link to comment
Share on other sites

Another Question about the Meter Panel. Is there an Offset to get the Values for DC AMPS / DC VOLTS / AC AMPS / AC VOLTS and CPS FREQ ?

By program? Are you a programmer? Or you can get such stuff via a Lua plug-in, but then what do you do with it?

The default FS aircraft do have such values in offsets, excepting the Frequency. FS doesn't simulate the subsystem that well.

And also for the many LED coming up when an engine fails or an fuel pump is not working ?

Mean eg. the Lit Buttons over the GEN 1 ON / OFF switch named "TRANSFER BUS OFF" and "SOURCE OFF".

Most of those subsystems aren't really simulated in detail by FS, but they are usually dealt with in add-on aircraft like those from PMDG and LevelD. Alternatively there are packages like Flight Deck Software, Project Magenta, and SimAvionics which simulate them. I use PM's "pmSystems" for all the overhead-based subsystems in my 737NG.

For FS offsets and programming information you need to refer to the documents included in the FSUIPC SDK. For the other packages you need their documentation. For add-on aircraft you are problably going to have difficulty, but you could ask in the MyCockpit Forums. Please do try looking up the values and offsets you might need in the available documents. If you ask me, I have to go and find my copy of the document and search it here, I don't remember it all! You could easily do the same, please do help yourself in such ways, it will be more efficient for us both.

Regards

Pete

Link to comment
Share on other sites

Hello Pete,

i see i must read the LUA Plugin Help ( i dont understand the LUA Plugin at the momenthow it works and how it is to use )

And also i must take a closer look to the pmSystems Software and how it works and how to get a LEP to come up same time a LED in the FS.

For the Moment very thanks for your help !!

I hope i can come back with the next beginner questions?

Matthias

Link to comment
Share on other sites

i see i must read the LUA Plugin Help ( i dont understand the LUA Plugin at the momenthow it works and how it is to use )

There's no one "Lua plug-in". A plug-in is simply an extra bit which plugs in. As to how it works, wellFSUIPC contains a Lua compiler and interpreter and runs the little plug-ins on request, or automatically. The plug-ins can extend the facilities offered by FSUIPC.

Really, if you are not a programmer, and don't even yet understand the relatively easy user facilities provided by FSUIPC, I don't think you want to worry about Lua plug-ins or FSUIPC offsets or anything. It was just that you suddenly ask, out of the blue, about reading Voltages and Amps as if you were going to write a program to use them. If you are not, what can you possibly do with such offset information? Why ask in the first place?

And also i must take a closer look to the pmSystems Software and how it works and how to get a LEP to come up same time a LED in the FS.

Such packages will only do such things for you if you use the ready-built hardware which they include drivers for. If you are building your own hardware you will almost always need to do some programming, though there are some good hardware interface cards available for which folks have done generic drivers where you more or less just need to fill in parameters.

I hope i can come back with the next beginner questions?

If you are really talking about interfacing homebuilt hardware, I would really recommend you to go to MyCockpits forums instead. I have never ever built my own cockpit and don't know much about the hardware and programs available. There's a lot of experience over in MyCockpits.

Go to http://www.mycockpit.org/forums/forum.php

Regards

Pete

Link to comment
Share on other sites

Yes i will build my own Overhead Panel for an 737NG ( PMDG ) but i am in a very very beginning stadium !

The PMDG aircraft will present you with major problems for your overhead. There is one hardware interface which has been made -- I saw it at the Lelystad FS show last year. But otherwise you face utmost difficulties as virtually none of the insides of the PMDG aircraft are available to outside programs. They are secret to PMDG and never revealed, by policy.

But i will lern, read Manuals and Forums !

You might be better off choosing an easier aircraft. But if you stick to the PMDG, the full one with its own logics, you'll need to contact some folks who frequent the MyCockpit forums. Or check out Ian's site at http://www.737ng.co.uk. You will find Ian very helpful and he's been through all the problems you are going to face.

I use the PMDG 737NG model and visuals, but throw away all of the panel parts. I use Project Magenta (http://www.projectmagenta.com ) for the instrumentation and subsystems. It's probably the most expensive choice, but I've been involved with PM for a long time. The more recent additions to this area are Sim-Avionics (http://www.sim-avionics.com ) who are good for the 777, and Flight Deck Software (http://www.flightdecksoftware.com ), for the 737NG.

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

for this time i have ordered a Expand and a Master Card from Opencockpits. The BU0836X from Leo will do the easy Jobs... eg real ON/OFF Switches.

The future Switches connected to the Opencockpits Boards i will try to programm the Lights and switches with SIOC.

I am nearly pinned on the PMDG 737 while i have the MCP COMBO Panel from VRInsight. This will work perfekt with the PMDG 737, but also with the LVL-D 767. This is the alternative for me.

But for the moment i must test all this things.

Matthias

Link to comment
Share on other sites

  • 2 weeks later...

Hello Pete again,

i have a question about this LUA Plugin and the PMDG...sorry.

Ok, is it possible to read the actual Position of the Stby PWR Switch in the PMDG OVHD Panel with this LUA Plugin?

If yes .. ( i hope ) .. how?

sorry...have you a example for this?

Thanks

Matthias

Link to comment
Share on other sites

i have a question about this LUA Plugin and the PMDG...sorry.

Which Lua plug-in?

Ok, is it possible to read the actual Position of the Stby PWR Switch in the PMDG OVHD Panel with this LUA Plugin?

Sorry, I've no idea which plug-in you are talking about, nor why your thread title is "FSUIPC Hardware Button". Where does a hardware button come into your question?

If yes .. ( i hope ) .. how?

If you mean "can i read the state of a switch on a PMDG panel in a Lua plug-in I might write", the answer is "maybe, if that switch is readable from an FSUIPC offset (doubtful) or from an L:Var (more likely). To see if it changes an L:var value, use the Log Lvars facility in FSUIPC (an assignable control in the drop-downs), or the more extensive Lua plug-in provided to help find out about these things.

Regards

Pete

Link to comment
Share on other sites

you dont know your own answer ?

You write about the LUA Plug-in in your 2. or 3. Post ???

Which thread? What does my "2. or 3. Post" mean? There are no posts from me with such meaningless titles!

Can't you identify which Lua plug-in you mean? There are very many of them already! I supply quite a few samples with FSUIPC, and there are loads more published in threads here.

Unless you can explain what you are talking about or give adequate references I'm afraid I cannot help you!

Regards

Pete

Link to comment
Share on other sites

Hello Pete,

now i understand a litle bit more what you mean.

I mean e.g. this lua script:

log lvars.lua

-- "LogLvars" example LUA plug-in, by Pete Dowson, February 2009

displaymax = 15

local vals = {}
local names = {}
local lines = {}

for i = 0, displaymax, 1 do
   lines[i] = ""
end

line = 0
scan = true
postscan = false

while 1 do
   i = 0
   while i < 65536 do
      if scan then
         name = ipc.getLvarName(i)
         if name == nil then
            scan = false
            postscan = true
            break
         end

         if name ~= names[i] then
            vals[i] = nil
            names[i] = name
         end

      elseif names[i] == nil then
         break
      end

      n = ipc.readLvar(names[i])

      if n == nil then
         scan = true
         break
      end

      dodisp = false

      if n ~= vals[i] then
      	 lines[line] = "L:" .. names[i] .. "=" .. n
         ipc.log(lines[line])
         vals[i] = n

         line = line + 1
         if line > displaymax then
            line = 0
         end

         dodisp = true
      end

      if postscan or (dodisp and not scan) then
	 j = line
         disp = ""

         repeat
            disp = disp .. "\n" .. lines[j]

            j = j + 1
            if j > displaymax then 
               j = 0
            end       
         until j == line 

         ipc.display(disp)

         postscan = false
      end

      i = i + 1
   end

   ipc.sleep(5)

end

What do this script and how is it to use?

I have copied it into the modules folder and assigned it to a joistik button.

After pressing the Button .. nothing happens.

Whats wrong?

Matthias

Link to comment
Share on other sites

I mean e.g. this lua script:

Thanks,m but you really never need to paste my own programs here. It was written by me, it is listed in the Lua documentation and it is included in the FSUIPC install. I don't need to see it here!

What do this script and how is it to use?

It logs "L:vars", local named variables used by many panels. It logs them in the log, as they change, and on screen. It is useful for investigating whether L:vars would be useful to you.

I have copied it into the modules folder and assigned it to a joistik button.

After pressing the Button .. nothing happens.

Whats wrong?

I csnnot possibly know because you supply no more information. What, exactly, did you assign to the button? write down what it is assigned to.

If you enable button logging, what does the Log file tell you is happening? Do you know that there are some L:vars to be logged in the panel you are using?

Pete

Link to comment
Share on other sites

Hello Pete,

Thanks,m but you really never need to paste my own programs here. It was written by me, it is listed in the Lua documentation and it is included in the FSUIPC install. I don't need to see it here!

If you write you dont know what Lua Script i mean....

It logs "L:vars", local named variables used by many panels. It logs them in the log, as they change, and on screen. It is useful for investigating whether L:vars would be useful to you.

ahha, in the log ???...ok, where is the log ? ( i have no log found in the moduls directory )

and on the Screen ?? No, if you mean the FS Main Window i have not seen anything on the Screen.

What have i do?

I have assigned a Joistick Button to the Script.

Explaining:

Go to the FSUIPC manü and open.

Open the Button & Switches page.

Press a joistick button

select under "Control sent when Button pressed" the script LUA Log Vars ( i have also tested all other entries with Log Vars in the Name )

Ok, i hope you can now help me and explain me also a litle bit more what i have to do with a lua script?

Matthias

Link to comment
Share on other sites

If you write you dont know what Lua Script i mean....

Yes, you only had to refer to the Log Lvars.lua plug-in. ;-)

ahha, in the log ???...ok, where is the log ? ( i have no log found in the moduls directory )

If you have no FSUIPC log file than FSUIPC cannot be running. It always makes a log file if it is running.

and on the Screen ?? No, if you mean the FS Main Window i have not seen anything on the Screen.

Either you are not running that Lua plug-in, or it is getting an error because you are using an old version of FSUIPC without the facilities. The log would show you if there's an error.

Please ALWAYS refer to the log when anything unexpected happens. That is what it is for!

Press a joistick button

select under "Control sent when Button pressed" the script LUA Log Vars ( i have also tested all other entries with Log Vars in the Name )

You have done it wrong somehow then. since I cannot sit behind you whilst you are doing it, why not do as I asked -- enable Button logging (in the FSUIPC logging tab), then operate your button, and look in the FSUIPC log to see what happened. Show it to me if you do not understand.

BTW if you are doing this with FS9 or before, make sure your FSUIPC is up to date (at least 3.96) because the LVar access facilities were only added to FSUIPC3 recently. Mind you, you must surely know you should always be sure to use a supported versiion of FSUIPC before posting here? ;-)

Regards

Pete

Link to comment
Share on other sites

  • 9 months later...

this is my code about "light" ,wrong or right???

procedure TFormMain.BBCNClick(Sender: TObject);

var

dwResult : DWORD;

dwResult1 : DWORD;

// Light : Byte;

Light : Array[1..2] of Byte;

AllLight : SmallInt;

begin

//BCN灯开关

if FSUIPC_Read($0280, 2, @Light, dwResult) and FSUIPC_Read($0D0C, 2, @AllLight, dwResult1)then begin

if FSUIPC_Process(dwResult) and FSUIPC_Process(dwResult1) then begin

if ByteToBool(Light[1]) then begin//这个变量将来要跟单片机的状态相连

Light[1]:=0;

end else begin

Light[1]:=1;

end;

end;

end;

AllLight:=2;//1=Nav, 2=Bcn, 4=Land, 8=Taxi, 16=Strobe,

//32=Panel, 64=Recognition, 128=Wing, 256=Logo, 512=Cabin

//$0D0C(see also $0280, $0281 and $028C)

if FSUIPC_Write($0280, 2, @Light, dwResult) and FSUIPC_Write($0D0C, 2, @AllLight, dwResult1)then begin

if FSUIPC_Process(dwResult1) then begin

//for i:=1 to 2 do cLight:=0;

//cLight[1] := 1;

//cLight[2] := 1;

//cLight[3] := 1;

end else begin

// Unable to "Process"

BBCN.Caption := 'Processing: ' + ResultText[dwResult];

end;

end else begin

// Unable to "Read"

BBCN.Caption := 'Reading: ' + ResultText[dwResult];

end;

end;

Link to comment
Share on other sites

This is my code about "light" ,wrong or right???

You do realise that you added your post to a nine-month old (and well dead) thread about some "FSUIPC Hardware Button", I suppose? If you want folks to spot your questions and answer helpfully i suggest you re-post in a new thread with a title which corresponds to your question.

I cannot help directly because I do not know that laguage you are using, nor even whether it is VB or C#. However, I can see that you are reading and writing both the old FS98-compatible combined lights offset 0280 as well as the much more useful individual light switches at 0D0C. You should use one or the other -- 0D0C is normally better as it gives you individual control over each of the 10 possible lights in FS.

Additionally, here:

if FSUIPC_Read($0280, 2, @Light, dwResult) and FSUIPC_Read($0D0C, 2, @AllLight, dwResult1)then begin

if FSUIPC_Process(dwResult) and FSUIPC_Process(dwResult1) then begin

You should NOT perform two successive "process" calls. The second has nothing at all to do. All Reads and Writes are accumulated in your program's own memory (obtained when you did the FSUIPC_Open), and the Process call fires them off, all together, to FSUIPC.

Also, there's no point in accumulating error results separately (dwResult and dwReault2) unless you are going to examine them.

Regards

Pete

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.