• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Why doesn't my SetMASTER_BATTERY_ON() work while SetMASTER_BATTERY_OFF() does?

Messages
129
Country
unitedstates
Please look at this. I am simconnect app in C#

//
THIS WORKS

public void SetMASTER_BATTERY_OFF()
{
TransmitEvent(EventEnum.MASTER_BATTERY_OFF, 1);
TransmitEvent(EventEnum.MASTER_BATTERY_OFF, 2);
}

WHY THEN DOESN"T THIS WORK (has no effect , electrical external power is on)

public void SetMASTER_BATTERY_ON()
{
TransmitEvent(EventEnum.MASTER_BATTERY_ON, 1);
TransmitEvent(EventEnum.MASTER_BATTERY_ON, 2);
}

they all call
simConnect.TransmitClientEvent(0, cmd, Param, GROUP.GROUP1, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);

MY AI tells me I should use something like this for the indexes

simConnect.MapClientEventToSimEvent(EventID.MASTER_BATTERY1_ON, “MASTER_BATTERY1_ON”);

is that correct?

THIS IS ALL IN THE Asobo A320
 
I can't really answer the underlying question, but it's likely not your code. Just tried it here and same results (stock Asobo A320-neo). And MASTER_BATTERY_SET acts the same way -- can turn them off but not on.

In the process I discovered that the docs for MASTER_BATTERY_SET have the parameter order switched... the first param is actually the bool value and 2nd is the index. Good times.

I'm curious, do you use any program/app to test things like key events or sim vars before trying to use them in actual code?

There are so many things that just don't work, or don't work as expected (especially with some models) that I find it a huge time saver to verify these things first before trying to actually use them in something I'm building.

Cheers,
-Max
 
thank you Max. Well your suggestion is a wise one, I have added in many functions at once and then discover some don't work and the I start hacking and trying other revisions to try to the broken ones working.
That has not be producitive.

So I did just create an nex example app for testing and I'll only keep the code that works. !

On ther other hand, I gave up on this app some time again because so many functions did not work .... then with the latest SDK update ... suddenly a dozen or so functions worked magically just by compiling to the update.
 
If something doesn't work and you can be sure that your code is correct (as in your example above) start getting suspicious of the SDK. Never trust anything in the simconnect.h file (you've probably read my other exchange with Max on menus) and never forget that the SDK hasn't even reached 1.0 yet. That in itself implies that some of it is broken/still not implemented.
 
thanks for the advice .. I had an app almost ready for beta a year ago and after a MS release it was a disaster and I was unable to figure it out. Now a year later I took the recent release , compiled my old program and most of it magically works now.
 
Back
Top