dementedmonkey / cj4-mcdu

MCDU Web application for the Working Title CJ4
GNU General Public License v3.0
32 stars 4 forks source link

Help! #47

Closed GMotaG closed 1 month ago

GMotaG commented 8 months ago

Hi! I'm trying to do a E195 MCDU but I'm having some difficults.. Can you help me? I need to know how I can get something like this:

"const electricalConfig = xmlConfig.evaluate("/PlaneHTMLConfig/Instrument[Name='CJ4_FMC']/Electric/Or/Simvar/@name", xmlConfig, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);".

I would like, if you can, that you give me some help to get the screen of FSS E195 MCDU and send to a web browser..

dementedmonkey commented 8 months ago

I don't have the E195, so I can't help with details specific to that plane.

That line is selecting the electrical configuration node out of panel.xml. It was needed to work around an issue with the CJ4, where the FMC code was connected to both electrical buses, but it would "fake" being off by changing the screen to 0% brightness when the corresponding bus was turned off. I believe this was a leftover from before the FMCs were split.

Since I released this code, WT has modified the CJ4 so that it's no longer necessary. Each FMC is correctly wired to the individual electrical bus, and the in-sim checks for "is instrument powered" are correct without this workaround. I made these changes on my SU15 branch, but it appears as if this change was actually made in a previous release.

You can probably just remove that code and set this._circuit to 0. The code that checks the power status will then just use the native instrument power, which will be correct if the plane was properly wired, worst case would be that it would report power on status when it's not actually powered on.

GMotaG commented 8 months ago

Hi!

I’m working a few hours in your project, and I discovered some things. I excluded that code and used this._circuit = 47 and worked with the CJ4. But I’m having difficulties to understand some things, like where I can get the ‘update:cj4:..’ for any aircraft?

And another question, which is the code that the plugin recognizes the ready aircraft is loaded and send to localhost?

sorry for my ignorance, I’m starting in software development… Anything you say, will help me.

dementedmonkey commented 8 months ago

I don't quite follow what you're asking, but I'll try to answer.

update:cj4 is a prefix put on the messages so that, in theory, multiple aircraft could use the same websocket server. It's created here: https://github.com/dementedmonkey/cj4-mcdu/blob/33fc3ed92b547894dc47ea29cea19ad6f1391095/src/mod/dementedmonkey-cj4-mcdu/html_ui/Pages/VCockpit/Instruments/wt21/FMC/DM21_FMC.js#L115 and read here https://github.com/dementedmonkey/cj4-mcdu/blob/33fc3ed92b547894dc47ea29cea19ad6f1391095/src/app/client/src/App.jsx#L69

The point of cj4 being in there is so that the client could switch between showing the correct CDU for a CJ4 or, for example, a B737. If your CDU has the same layout as the CJ4, you wouldn't need to change that. (Note: The client does not currently support switching between aircraft, this is for future enhancement)

The mod will attempt to connect to localhost every 5 seconds, if it's not already connected. That's done here: https://github.com/dementedmonkey/cj4-mcdu/blob/33fc3ed92b547894dc47ea29cea19ad6f1391095/src/mod/dementedmonkey-cj4-mcdu/html_ui/Pages/VCockpit/Instruments/wt21/FMC/DM21_FMC.js#L22-L26

When it connects, this code will be executed on the MCDU server: https://github.com/dementedmonkey/cj4-mcdu/blob/33fc3ed92b547894dc47ea29cea19ad6f1391095/src/app/index.js#L186

dementedmonkey commented 1 month ago

Stale issue, closing.