RoystonS / BetterBravoLights

Utility for controlling lights on a Honeycomb Bravo Throttle from Microsoft Flight Simulator
MIT License
43 stars 8 forks source link

Provide option to disable lights when aircraft is unpowered #24

Closed cjkreklow closed 2 years ago

cjkreklow commented 2 years ago

Software version 0.6.0

Is your feature request related to a problem? Please describe. The default Honeycomb driver disables the lights until power is available, this is not present in BetterBravoLights.

Describe the solution you'd like A "master toggle" option of some kind that would disable all the lights for a given condition. The Honeycomb configuration appears to be when A:ELECTRICAL MAIN BUS AMPS == 0

Describe alternatives you've considered Adding an AND condition to each individual configuration with A:ELECTRICAL MAIN BUS AMPS > 0

RoystonS commented 2 years ago

Hi @cjkreklow!

Nice idea!

As I've been adding the configurations for different aircraft it's interesting to see how some of their cockpit codes specifically check for the main avionics/battery/master to be on before enabling lights, and some don't. In general I've been following the specific patterns for each specific aircraft where possible.

But yep, it would certainly be interesting to have an easy way to disable all lights. (Check out all the ugly repeated ASCRJ_ELEC_BATTMASTER configuration here for the CRJ configuration: https://github.com/RoystonS/BetterBravoLights/blob/main/BravoLights/Config.BuiltIn.ini#L420-L450)

I'd not noticed that the default Honeycomb driver disables the lights until power is available. I have previously documented how their use of 'A:ELECTRICAL MAIN BUS AMPS' for their 'Low Volts' isn't actually correct, here: https://github.com/RoystonS/honeycomb/blob/main/bravo-lights.md#fix-the-low-volts-indicator but I had wondered what on earth their strange piece of 'byte 0' configuration was about:

    {   
      "ByteIndex": 0,
      "BitIndex": 0,
      "Condition": "A:ELECTRICAL MAIN BUS AMPS, Amperes",
      "ConditionValue": "!=0"
    },

The USB protocol for the Bravo only uses 4 bytes (their 1-4) so I had wondered why there was a stray 'byte 0'. Good spot!

Yes, it would certainly be easy to add something like

[Default]
MasterEnable = A:ELECTRICAL MAIN BUS AMPS, amps > 0

[Aircraft.Aerosoft_CRJ_550]
MasterEnable = L:ASCRJ_ELEC_BATTMASTER == 1

to provide an aircraft-specific global light override.

RoystonS commented 2 years ago

Yep, very very easy indeed. I haven't written all the tests yet, but the implementation took 3 lines of code.

So, if I add

MasterEnable = A:SOME THING, volts >= 1 OR A:ANOTHER THING, amps > 0 to any aircraft (including [Default]) it then effectively ANDs itself to all expressions.

For example, this is how the PARKING BRAKE expression gets modified:

image

Can you confirm this is what you were looking for, @cjkreklow ?

cjkreklow commented 2 years ago

Yes, that looks perfect. Thanks!

t0ffi commented 2 years ago

I using version from flightsim.to and it seem that it doesn't using that function MasterEnable = A:ELECTRICAL MAIN BUS AMPS, amps > 0

How can I get version with that?

RoystonS commented 2 years ago

Hi @t0ffi!

There's a new version coming out in a few days with that new feature in. I did do the coding and testing for it in December (https://github.com/RoystonS/BetterBravoLights/commit/3a2a9f8aae8937c524fc3ec518dae8ba669094b8#diff-f9e29519c9706396914d64b612a000e61ea0ce1e28d88dcee6306e8b8eaf77a5R52-R66) but then the universe around me exploded and I've not had time to even launch MSFS since then. The rubble has just started to settle and I'll be pushing the new version out very shortly.

t0ffi commented 2 years ago

Thank you for information I waiting for new version.

RoystonS commented 2 years ago

I just released v0.7.0 which includes this feature. Thank you!

t0ffi commented 2 years ago

Thank you for providing us new version. I just testing a20nx FBW and lights are enabled during cold and dark state. Maybe I need to turn something?

RoystonS commented 2 years ago

Well, that's interesting...

The new MasterEnable feature is working as intended, but the FBW aircraft is reporting that the electrics panel is on even when cold + dark:

image

The logic there is saying "If the electrical panel is on and either engine oil pressures are less than 60 psi, show the low oil pressure light", and MSFS is reporting that the electrical panel is on.

I presume that the FBW 320 (as it often seems to do) is using a different value to indicate that the electrical panel is on?

I'll take a quick look and see if I can figure it out. A fix will simply involve adding one line of config to say "The MasterEnable flag for this aircraft is ... blah...".

RoystonS commented 2 years ago

So... @t0ffi , it turns out that there are huge numbers of custom variables for the FBW A32NX, even just for its electrical system.

Here's the full list that FBW provide: https://github.com/flybywiresim/a32nx/blob/master/docs/a320-simvars.md

Do you know which of those indicate that the aircraft is 'powered'? There seem to be 14 variables indicating that various busses have power. One or more of those probably indicates the state needed but I'm afraid I haven't the first clue as I don't know the A320 systems.

image

So, for instance, an expression in your config.ini file like:

[Aircraft.FlyByWire_A320_NEO]
MasterEnable = L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED == 1

seems to work for me in that lights then only come on when I start up the aircraft BUT - and this is a hugely important BUT - I have no idea what an 'ESS SHED BUS' is. When I say 'start up the aicraft' I'm literally hitting Ctrl+E because I'm no A320 pilot and don't know the full startup procedure.

Armed with that, can you figure out what the correct variable (or variables plural) would be?

cjkreklow commented 2 years ago

Pretty sure you want A32NX_ELEC_AC_ESS_BUS_IS_POWERED there.

RoystonS commented 2 years ago

Nice one, @cjkreklow. Ok @t0ffi, so try putting this into your Config.ini file:

[Aircraft.FlyByWire_A320_NEO]
MasterEnable = L:A32NX_ELEC_AC_ESS_BUS_IS_POWERED == 1
t0ffi commented 2 years ago

Everything now working fine. After turning on bat no lights, lights starts to appear after connecting external power. @RoystonS, @cjkreklow thank you guys for your help!

RoystonS commented 2 years ago

Nice one. I already made the code change so that'll be part of the built-in configuration in the next release of BBL, so you'll be able to get rid of that custom config then.

https://github.com/RoystonS/BetterBravoLights/commit/ae1d4cb361252409f40ed21aeebcbbb4efac1b4f