Canadian Virtual Airlines
https://canadianva.com/forum/

Home Cockpit, switches and buttons
https://canadianva.com/forum/viewtopic.php?f=1&t=2722
Page 4 of 5

Author:  CVA0014 [ Thu Sep 13, 2012 2:35 am ]
Post subject:  Re: Home Cockpit, switches and buttons

An example of technical difficulties I encounter on this project.

This is done with a Saleae probe; really useful to analyse logic signals (on/off, 1/0, 5volts/0volts). I am checking exactly what goes on when I activate a pushbutton.

Image


I triggered the pushbutton 6 times, but this is a zoomed view of the 2nd trigger:

Image

What was meant as 6 triggers turned out to be 7 due to "static"; usually referred to as bouncing of the switch contacts (hence the name debouncing in electronics).


And this is where programming becomes useful. I added logic to prevent new triggers before a certain delay. Obviously my code still needs tweaking. :D

Author:  CVA0014 [ Wed Nov 16, 2016 10:17 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

CVA0014 wrote:
...But look at the LEDs; they could potentially be on all at once, 256 x 20mA is 5.12 amps...


Rereading this thread, I really had my head up my butt when I wrote this.

20mA = 0.002 amperes

256 x 0.002 = 0.512

0.512 amperes = 512mA or "1/2 an amp" if you prefer.

The USB port has a max of 500mA, so I'm betting your wall adapter has a minimum of 1 amp; most likely much higher depending on the rating of those motors.

Author:  CVA0014 [ Thu Dec 01, 2016 4:20 am ]
Post subject:  Re: Home Cockpit, switches and buttons

So I started shopping around for rotary switches. This was the biggest pain I had with this project, finding a cheap rotary switch supplier.

I just checked India, they scare me and charge $3 CAD for this switch. So I looked back at China. You really have to check "where" you shop online. Alibaba is now known the world over, and their prices reflect it.

RS26 adjustable rotary switch 2-12 positions:

Alibaba:
$0.10 - 1.00 USD per unit
https://www.alibaba.com/product-detail/RS26-0-3A-band-rotary-volume_60562043102.html?spm=a2700.7906341.35.1.aW3BfF&s=p
1,000 units at $0.10 for $100 USD (and I doubt you'll get it at $0.10 when the minimum order quantity is 500)

Made-in-China:
$0.01 - 0.03 USD per unit
http://lgswitch.en.made-in-china.com/product/KBRxuvVJqErP/China-2-Pole-12-Position-Dp12t-Rotary-Switch-RS26-.html
1,000 units @ $0.03 for $30 USD <-- and this guy even takes Paypal

Shoot...
10,000 unit @ $0.01 for $100 USD, and then turn around and sell overstock on eBay. This guy sells them for $1 USD EACH:
http://www.ebay.ca/itm/RS26-Band-Rotary-Channel-Selector-Switch-1-Pole-Position-12-Selectable-/282257711286?hash=item41b7dee0b6:g:DvgAAOSwiDFYLBtF

These switches appear slightly different, but they are essentially identical. You can set how many positions you want so you don't need an inventory of different switches. This was my original problem; I need 2, 3, 4, 5, 6, 7 and 8 positions rotary switches, and minimum orders of $100 for 7 different rotary switches added up quick.

Now I can do it all with a single rotary switch. The last hurdle I foresee is the "feel" of the switch. Does it require a vise-grip to turn or can you flip it with a feather. The cheaper one is rated at ROTATION TORQUE:150±50 g.cm. I have absolutely no clue how much torque that might be. And that's why god invented SAMPLES. :D

One thing that bugs me with the cheaper one; it uses 15 degrees of rotation angle regardless if you chose the 6, 8, 12 or 24 position model. I want the 8 position model; that means all 8 positions fit in just over a 1/4 turn of the knob. That sucks royally, I need it to go somewhere near 3/4 for it to look somewhat similar to most switches on the Level-D 767.

Author:  CVA0014 [ Thu Dec 01, 2016 5:40 am ]
Post subject:  Re: Home Cockpit, switches and buttons

Well look at what I found digging around:

RS26 adjustable rotary switch 2-12 positions, 30 degrees:

$0.01 - 0.03 USD per unit
http://lgswitch.en.made-in-china.com/pr ... RS26-.html

500 units @ $0.03 for $15 USD + shipping + exchange rate + duty

Woohoo! That's somewhere between $50-75 CAD, radically better than $1 USD each on eBay.


I just sent them a message; their listing mentions they accept custom designs. So I asked about an identical switch, but 1 pole 2-8 positions at 45 degrees, and their price.

The rotary switches in the Level-D are 30 and 45 degrees. I'd be set with a single order of 2 models. If they ask too much for a custom design, I can always make due with their 30 degree model.

Then I finished off with a nice bla-bla profile about designing and building custom cockpits for the average consumer.

You'd be amazed how well you get treated by Chinese companies at times. Some of their vendor profile pics are NOT like you see here. :lol:

Author:  CVA0014 [ Thu Dec 01, 2016 9:51 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

FINALLY!

I'm just about finished my cockpit.



Image

Author:  CVA0014 [ Fri Dec 02, 2016 4:33 am ]
Post subject:  Re: Home Cockpit, switches and buttons

Oh yeah, I am now officially equipped to mess up my FS-X install.

First fiddling with FS Panel Studio, cloned Captain's MIP, cloned and modified the bitmap.

Image

I had no idea just how complicated FS PS can be. I know where the gauge files for the Level-D 767 come from and that's about it. I have no clue yet how or where the buttons actions and dial movements are done in the background.

The PDF is very technical, going through each option. I'm not quite sure how I can make a custom panel for the Level-D 767 without interfering with the copyrighted folders. I'd like to get where Cal is at, able to distribute a custom panel for a given aircraft.

I should have forgotten about 95% of what I've read by tomorrow morning. :lol:

Author:  cva1412 [ Fri Dec 02, 2016 3:58 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

CVA0014 wrote:
FINALLY!

I'm just about finished my cockpit.



Image


I see where your problem is...it's right there on the top left :mrgreen:

Author:  CVA0014 [ Fri Dec 02, 2016 6:20 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

Your good. The loose connection on that blue wire has been causing me all sorts of headaches.


Made a bit of progress. Still don't know how to get inside an existing gauge and remove clutter. The standby instruments at left are a copy of the originals, I want to gut unused gauges within that GAU file but can't open it.

The standby gauges on the original captain's panel in the center, are toggled on-off, hiding a bunch of annunciators. I always hated that. Now they'll be in full view with the annunciators handled outside FS-X.

Image

My eyes are getting weaker and I always hated squinting at the gauges and leaning over the yoke. I have some tweaking to do but at least now they're a lot clearer.

This is where I got inspired to make display overlays with the large selector switches laid out just outside the area of the display (cause they're so freaking deep):
Image
http://www.ruscool.co.nz/boeing737.html

Check the prices. It may be top quality but it's insame. You bust a grand trying to make an overhead.

Author:  CVA0014 [ Fri Dec 02, 2016 6:42 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

Would you believe that glass level is painted of the damned background? Unlike all the other gauges, their shit moves along with the gauges and gets resized accordingly.

But no, they painted the freaking glass level so I had to go back and paint it on a black background BMP instead of just using a black background colour (less overhead).

But wait, then you have to fudge around moving that sucker until it lines up with that ball of air; open paint, move, save, open FS PS, check alignment, close, rinse and repeat. "Cause that ball of air is the only part of the gauge and that's somehow tied up with the instrument right under it.

Oh yeah, and I still have to resize those two displays a bit which means moving that stupid glass level on an otherwise empty BMP.

Royal pain...

Author:  CVA0014 [ Fri Dec 02, 2016 9:37 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

What's the difference in using the stock main instrument panel and mine?

The FS-X with the default panel runs at 30 fps, switching to mine jumps to 60 fps. That's the cost of clutter.


Decided to put as many annunciators back on the panel. I figure it's better to have them directly in line of sight. Can't quite take off all the little knobs. They get painted back in if they rotate, but they're gone if they are in the same state as the BMP I turned black. This is where it gets more complex; having to get into that background code and disable the repaint feature, wherever that is.

Got the red text back on the engine annunciators after taking this pic. I hadn't noticed those values when I cleared the background BMP for that gauge. D'oh!

Image

Author:  CVA0014 [ Sat Dec 03, 2016 3:46 am ]
Post subject:  Re: Home Cockpit, switches and buttons

First draft of the Captain's MIP. I just need to lift annunciators for autobrakes and brake source from existing gauges.

Image

It took me a while to tweak the sizes according to importance. Finding the right balance ain't easy, you want to jam everything in there but I have to leave enough space between openings for strength. Lifted the compass from the overhead gauge, now it's in a better line of sight.

It sucks that I can't modify the GAU files. They're compiled, no way around it. It's XML gauges that we can tweak, but FS-X and the Level-D don't use XML.

Author:  CVA0014 [ Sat Dec 03, 2016 6:34 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

Mylar sheets open the door to annunciators with improved script:

Image


It could also help reduce cost by having all annunciators on a single sheet, that could then be cut to size.

Image


And then there's these for the finishing touch, possibly coloured "Boeing beige", or even custom colours like gray, green or black.

Image

Author:  CVA0014 [ Tue Dec 06, 2016 12:11 am ]
Post subject:  Re: Home Cockpit, switches and buttons

YAY!

These are the brake pressure and alternate flaps positions using FSUIPC logging:
Image


This is a LUA script that can read the same variables:
while 1 do

  BrakePress = ipc.readUD(0x8b90)
--   lekseecon = 761  psi
--   fsuipc    = 0x8b90    4 bytes (32 bit), type U32

  AltFlapPos = ipc.readUB(0x9300)
--   lekseecon = 768       0=NORM, 1=UP, 2=1°, 3=5°, 4=15°, 5=20°, 6=25°, 7=DOWN
--   fsuipc    = 0x9300    1 byte (8 bit), type U8

  ipc.display("brake pressure="..BrakePress..", nalternate flap position="..AltFlapPos)
  ipc.sleep(200)
end


I shove the script file in the FS-X MODULES folder and Lekseecon updates them in the FSUIPC log as I click on the alternate flap switch:

Quote:
50734 Monitor IPC:8B90 (U32) = 30
50734 Monitor IPC:9300 (U8) = 1
58406 Aircraft="Level D Simulations B767-300ER Winglet - CVA B767-300ER Winglet"
58406 System time = 05/12/2016 18:43:57, Simulator time = 18:43:37 (22:43Z)
65688 Starting everything now ...
67203 Advanced Weather Interface Enabled
77563 Monitor IPC:8B90 (U32) = 29
77766 Monitor IPC:8B90 (U32) = 26
82969 Monitor IPC:9300 (U8) = 2
85172 Monitor IPC:9300 (U8) = 3
85375 Monitor IPC:8B90 (U32) = 27
85578 Monitor IPC:9300 (U8) = 4
86578 Monitor IPC:9300 (U8) = 5
86781 Monitor IPC:8B90 (U32) = 26
87766 Monitor IPC:8B90 (U32) = 27
89375 Monitor IPC:8B90 (U32) = 26
91578 Monitor IPC:8B90 (U32) = 27
92984 Monitor IPC:8B90 (U32) = 26
97391 Monitor IPC:8B90 (U32) = 27
99000 Monitor IPC:8B90 (U32) = 26
124625 Monitor IPC:8B90 (U32) = 27
126625 Monitor IPC:8B90 (U32) = 26


Next step: apparently LUA can write to variables that can then be read by XML gauges. That would mean I could redo the brake pressure and alternate flap gauges that look just fugly when you try to make them larger. It would also give me access to all annunciators values which also do not resize nicely.

WOOT!

Author:  CVA0014 [ Tue Dec 06, 2016 6:19 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

So it turns out I'm an idiot, the LUA script was never executed. :LOL:

Those values are displayed by the FSUIPC module; I had enabled on-screen logging for those two offsets. D'oh!

Turns out LUA scripts don't just magically start when you put them in the FSX Modules folder. You need to fire them up from an automated process by adding ipcready.lua in that folder.

Your LUA scripts also go in the Modules folder, KK_BrakePress.lua, or you can do your LUA code from within ipcready. I made them separate to have multiple logs and separate windows.

ipc.setowndisplay("Brake pressure", 50, 10, 25, 25)   -- enable display to individual window.
--  BrakePress
--   lekseecon = 761       range 0 to 40, gauge PSI x 1,000
--   fsuipc    = 0x8b90    4 bytes (32 bit), type U32
BrakePress = 0
while 1 do
  BrakePress = ipc.readUD(0x8b90)         -- read data from FSUIPC.
  ipc.display("Brake pressure="..BrakePress)      -- transmit data to your hardware.
  ipc.sleep(50)                  -- short delay in polling.
end


Make sure to click the logging features in FSUIPC:

Image

Other than that, you can have access to all FS-X and Lekseecon variables, except ONE. ARGH! The dial that shows the flaps moving is not within FSUIPC, it's kept secret within the Level-D DLL for some obscure reason.

Author:  CVA0014 [ Wed Dec 07, 2016 3:06 pm ]
Post subject:  Re: Home Cockpit, switches and buttons

Geez, there are moments I feel like I'm so smart, and then there's now. I couldn't find a variable for flap position.

It helps to look in the right FSUIPC manual; Offset Status has the flap positions and then some, not 2016 List of FSX Controls. Controls are inputs, not outputs.

We need a :bang-head-against-the-wall: smilie.

Page 4 of 5 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/