Jump to content
The simFlight Network Forums

airlombadb

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by airlombadb

  1. Hello Pete and Paul,

    Thank you very much to both of you for your answers!

    To Pete:

    Some time ago, I was suspecting, now I'm sure: I really need to reinforce my glasses. :) Thanks Pete for pointing me the ONE BYTE values mistake. In fact I never noticed that these values were only one byte wide... Since I read your post I corrected the error and verified the remaining variables sizes. Fortunately, there was only one more of this type. I too wondered about how many error of this kind I would find in my code. Hopefully, my codes are rather simple, just to interface some hardware I build to FS. I am an electronics guy who only knows about ASM (for several CPU architectures) and C programming above Linux. In Windows (due to MSFS) I started to use Visual C# Express Edition (free). I have been able to do some stuff, but very painfully. I've never seen such a stupid way of doing things as I do on Windows; I just can't find any suitable programming tutorial or manual for this "programming language"... Anyway, thanks again.

    About the writing two FF bytes at 0x3210, every ten seconds. My code never writes anything there. I don't know where this comes from. I didn't find any evidence of the origin of these writing, but I will keep looking for.

    To Paul:

    Yes! I am still using the C# SDK.

    Thank you for your answer too. You are also right about writing the wrong size variable. Thanks for your code example, it is almost exactly the same as I have written.

    About your DLL, once I finish this piece of code (almost there) I will try the DLL (I already downloaded it), and given what you say, I will use it in my future developments. ;)

    I cannot finsh my post without thanking both of you once more for your precious help. Thank you! 8-)

    Best regards to all,

    Emmanuel.

  2. Hi again Pete,

    I remembered I had exactly the same problem some time ago with a "virtual hardware" I did. So I just used it to make the test you asked earlier in your post. Please find the log below.

    I lanched FS2004 with default C172SP, sitting on the runway ready to depart (as default by FS).

    Then I lanched my application, when it connects to FSUIPC, it shuts everything off in the aircraft, in order to put it as "cold and dark cockpit".

    Then I start the engine start-up sequence:

    - Master BAT ON

    - Fuel valve BOTH

    - Fuel pump ON

    - Mixture RICH

    - Start

    Then, when I "hit" the MASTER ALT button, all electrical stuff goes OFF (Master BAT, master avionics and even the fuel pump).

    HOWEVER, if I do this but instead of using my software to "hit" the master ALT, I use the button in Flight Simulator, everything goes fine! Strange huh?!

    ********* FSUIPC, Version 3.93 by Pete Dowson *********

    Running inside FS2004 (FS9.1 CONTROLS.DLL, FS9.1 WEATHER.DLL)

    User Name="Emmanuel******"

    User Addr="************************"

    FSUIPC Key is provided

    WideFS Key is provided

    [Continuation log requested by user]

    Module base=61000000

    ClassOptions: UIPCMAIN=FF7F, FS98MAIN=FF7F, FS2KMAIN=FF5E

    WeatherOptions(Orig)=4000BE87[4000BE87]

    InitDelay: 0 seconds

    WeatherReadInterval=4

    LogOptions=00000005

    1281828 System time = 03/03/2011 22:01:13, FS2004 time = 12:16:30 (12:16Z)

    1286250 WRITE0 3210, 2 bytes: FF FF

    1289734 WRITE0 (failed, read-only!) 330A, 4 bytes: 02 00 00 00

    1290078 WRITE0 0892, 2 bytes: 00 00

    1290078 WRITE0 37F0, 8 bytes: 00 00 00 00 00 00 00 00

    1290078 WRITE0 0890, 2 bytes: 00 00

    1290078 WRITE0 088E, 2 bytes: 00 00

    1290078 WRITE0 2E80, 4 bytes: 00 00 00 00

    1290078 WRITE0 281C, 4 bytes: 00 00 00 00

    1290078 WRITE0 3101, 4 bytes: 00 00 00 00

    1290078 WRITE0 029C, 1 bytes: 00

    1290078 WRITE0 029D, 3 bytes: 00 00 00

    1290078 WRITE0 3110, 4 bytes: A3 01 01 00

    1290078 WRITE0 0BC8, 2 bytes: FF 7F

    1290078 WRITE0 0BCA, 2 bytes: 00 00

    1290078 WRITE0 0BE8, 4 bytes: FF 3F 00 00

    1290078 WRITE0 0D0C, 2 bytes: 00 00

    1290078 WRITE0 0D0E, 2 bytes: 00 00

    1290078 WRITE0 3110, 4 bytes: 3B 00 01 00

    1290078 WRITE0 3104, 4 bytes: 00 00 00 00

    1290078 *** EVENT: Cntrl= 66242 (0x000102c2), Param= 0 (0x00000000) TOGGLE_MASTER_ALTERNATOR

    1290078 *** EVENT: Cntrl= 65955 (0x000101a3), Param= 0 (0x00000000) FUEL_SELECTOR_OFF

    1290078 *** EVENT: Cntrl= 65595 (0x0001003b), Param= 0 (0x00000000) FLAPS_UP

    1295141 WRITE0 281C, 4 bytes: 01 00 00 00

    1296609 WRITE0 3210, 2 bytes: FF FF

    1297766 WRITE0 3110, 4 bytes: A3 01 01 00

    1297766 *** EVENT: Cntrl= 65955 (0x000101a3), Param= 0 (0x00000000) FUEL_SELECTOR_OFF

    1297781 WRITE0 3110, 4 bytes: A4 01 01 00

    1297781 *** EVENT: Cntrl= 65956 (0x000101a4), Param= 0 (0x00000000) FUEL_SELECTOR_ALL

    1301594 WRITE0 3104, 4 bytes: 01 00 00 00

    1301594 *** EVENT: Cntrl= 66339 (0x00010323), Param= 0 (0x00000000) TOGGLE_ELECT_FUEL_PUMP

    1303562 WRITE0 0890, 2 bytes: 00 00

    1303641 WRITE0 0890, 2 bytes: 00 00

    1303656 WRITE0 0890, 2 bytes: 73 00

    1303687 WRITE0 0890, 2 bytes: E5 00

    1303719 WRITE0 0890, 2 bytes: 3D 02

    1303734 WRITE0 0890, 2 bytes: AF 02

    1303766 WRITE0 0890, 2 bytes: 07 04

    1303781 WRITE0 0890, 2 bytes: 5E 05

    1303812 WRITE0 0890, 2 bytes: 9B 07

    1303844 WRITE0 0890, 2 bytes: 6B 0D

    1303859 WRITE0 0890, 2 bytes: 8D 10

    1303891 WRITE0 0890, 2 bytes: 57 12

    1303906 WRITE0 0890, 2 bytes: EB 15

    1303937 WRITE0 0890, 2 bytes: 43 17

    1303969 WRITE0 0890, 2 bytes: BC 1B

    1303984 WRITE0 0890, 2 bytes: F8 1D

    1304016 WRITE0 0890, 2 bytes: AE 24

    1304031 WRITE0 0890, 2 bytes: 5D 27

    1304062 WRITE0 0890, 2 bytes: BB 2C

    1304094 WRITE0 0890, 2 bytes: F8 2E

    1304109 WRITE0 0890, 2 bytes: A7 31

    1304141 WRITE0 0890, 2 bytes: FE 32

    1304156 WRITE0 0890, 2 bytes: 92 36

    1304187 WRITE0 0890, 2 bytes: 77 37

    1304219 WRITE0 0890, 2 bytes: 26 3A

    1304219 WRITE0 0890, 2 bytes: 63 3C

    1304781 WRITE0 0890, 2 bytes: F7 3F

    1304812 WRITE0 0890, 2 bytes: F7 3F

    1306984 WRITE0 3210, 2 bytes: FF FF

    1309109 WRITE0 0892, 2 bytes: 00 00

    1309125 WRITE0 0892, 2 bytes: 01 00

    1311062 WRITE0 0892, 2 bytes: 01 00

    1311078 WRITE0 0892, 2 bytes: 02 00

    1312797 WRITE0 0892, 2 bytes: 02 00

    1312828 WRITE0 0892, 2 bytes: 03 00

    1314672 WRITE0 0892, 2 bytes: 03 00

    1314687 WRITE0 0892, 2 bytes: 04 00

    1317328 WRITE0 3210, 2 bytes: FF FF

    1318828 WRITE0 0892, 2 bytes: 04 00

    1318859 WRITE0 0892, 2 bytes: 03 00

    1327703 WRITE0 3210, 2 bytes: FF FF

    1334625 WRITE0 3101, 4 bytes: 01 00 00 00

    1334625 *** EVENT: Cntrl= 66339 (0x00010323), Param= 0 (0x00000000) TOGGLE_ELECT_FUEL_PUMP

    1334625 *** EVENT: Cntrl= 66241 (0x000102c1), Param= 0 (0x00000000) TOGGLE_MASTER_BATTERY

    1334625 *** EVENT: Cntrl= 66242 (0x000102c2), Param= 0 (0x00000000) TOGGLE_MASTER_ALTERNATOR

    1334703 *** EVENT: Cntrl= 66242 (0x000102c2), Param= 0 (0x00000000) TOGGLE_MASTER_ALTERNATOR

    1338062 WRITE0 3210, 2 bytes: FF FF

    1349406 LogOptions changed, now 00000001 (LogExtras=0)

    Thank you for your time Pete!

    Best regards,

    Emmanuel.

  3. Hello Pete,

    Thanks for your reply!

    I need more information. You need to enable Event logging and IPC Write logging -- see the Logging Tab in FSUIPC options. Then repeat the whole sequence. Check that what you THINK you are writing is actually being written.

    Also check whether it applies to all aircraft or only some -- the Master Alternator might be tied to the Battery switch so that you have to operate one before the other.

    I am not with my hardware by my side (I'm not at home right now), so I can't make the tests right now, I have to let this for tomorrow. I'll be back with what you asked for.

    What sort of code is that? Where is the size of the write defined? Is the "keyswitch" value supplied in the FSUIPC_Write call a pointer to where the 0 or 1 is stored, as it should be? Does the variable pointed to have the correct size?

    My bad, I apologise, it's not a code, but rather some kind of pseudo-side-note-code. I'm sorry for getting you confused and spend your precious time over this.

    "keyswitch" is a 32 bit variable (Int32) containing the logic state of the switch: 0 or 1.

    So here goes an excert of the actual code:

    Int32 keyswitch;   //Variable declaration
    if (RXstring.Substring(50, 1) == "0")   //I090 - MASTER BAT switch OFF  <-- RXstring is received via serial port
    {
       keyswitch = 0;
       result = fsuipc.FSUIPC_Write(0x281C, keyswitch, ref token, ref dwResult);
    }
    else                                    //I091 - MASTER BAT switch ON
    {
       keyswitch = 1;
       result = fsuipc.FSUIPC_Write(0x281C, keyswitch, ref token, ref dwResult);
    }
    result = fsuipc.FSUIPC_Process(ref dwResult);
    

    BTW I am away from tomorrow (Friday) until Sunday 13th March. So apologies if you get no more replies from me till then.

    Regards

    Pete

    Not a problem at all! I just hope that you'll get some quality time in the meanwhile. ;)

    I'll be here waiting. 8-)

    Best regards,

    Emmanuel.

  4. Hello all,

    I have been searching the net, and particularly this forum for an answer or some direction to follow but I didn't find any, so here goes my problem.

    I have a small inputs card with some switches... And I developed a small software application in Visual C# to interface this inputs card to FS2004 via FSUIPC (registered version).

    Here goes a step by step of what I do and what happens:

    1) Launch FS2004 with default C172;

    2) Launch my application who connects to inputs card and acquire switches states;

    3) My application connects to FS2004 via FSUIPC;

    4) My application sends switches states to FS2004 via FSUIPC (via suitable Offsets and according values) to initialize the aircraft for a cold and dark start...

    Problem 1: Everything goes OK. All switches in FS2004 replicate the real switches states EXCEPT for MASTER BAT and MASTER AVIONICS who doesn't switch OFF (as requested by my application).

    Problem 2: During startup of the engine (after ignoring problem 1 and forcing manually all switches OFF), everything works OK but when I switch ON the MASTER ALT, electricity goes off! I mean, MASTER ALT goes ON then OFF, MASTER BAT goes OFF and MASTER AVIONICS goes OFF.

    Can anyone help me or explain me why this could be happening?

    FYI: The code I to control these switches:

    MASTER ALT:

    keyswitch = 0; //OFF

    keyswitch = 1; //ON

    result = fsuipc.FSUIPC_Write(0x3101, keyswitch, ref token, ref dwResult);

    MASTER BAT:

    keyswitch = 0; //OFF

    keyswitch = 1; //ON

    result = fsuipc.FSUIPC_Write(0x281C, keyswitch, ref token, ref dwResult);

    MASTER AVIONICS:

    keyswitch = 0; //OFF

    keyswitch = 1; //ON

    result = fsuipc.FSUIPC_Write(0x2E80, keyswitch, ref token, ref dwResult);

    Many thanks and best regards to all,

    Emmanuel.

  5. Hello Paul,

    many many thanks for your help.

    I copied the four methods you provided in your last post, recompiled the code, but unfortunately nothing changed.

    So far, for testing purposes, I am trying to read the cowl flaps lever position value as follows (please take a look):

    //Global variables
    double cowl_flaps = 0.0;
    
    (...)
    
    //cowl flaps
    result = fsuipc.FSUIPC_Read(0x37F0, 8, ref token, ref dwResult);
    result = fsuipc.FSUIPC_Process(ref dwResult);
    result = fsuipc.FSUIPC_Get(ref token, ref dwResult);
    cowl_flaps = dwResult;
    textBox4.Text = cowl_flaps.ToString();
    

    This value should be between 0.0 and 1.0 (fully open and fully closed, respectively). However I always get a signed integer.

    For example, when in FSInterrogate I get 0,78, in my textbox I get -1889785610.

    What am I missing or doing wrong? Thank you very much for your help!!!

    Best regards,

    LOMBA, Emmanuel.

  6. Wooooooow!!!!

    Man I am disapointed!!! :(

    I have been working on a piece of software for some time. A lot has been developed and let to the end the reading of float64 values. Now that I am working on solving this last milestone, I find this topic, I find that I can't handle these values. Man, you can't imagine the words that came out of my mouth. Pfffffff...

    What can I do now? Start all over again and use phenty's DLL. That's an idea but I am really not into that, unless as a last resource.

    Phenty, can you help me? Privode some code or pseudo-code so I can resume my work? Thank you anyway.

    Best regards to all,

    LOMBA, Emmanuel.

  7. Hello all,

    I am developing some hardware to build a home cockpit of a simple C172.

    So far, everything done is working fine through FSUIPC and my drivers. However I have now reached a big wall to jump over (if possible).

    In fact, I am using the Garmin 500 gps (from fs2004) in a separate window (via undock) and want to control it via some buttons and encoders that I mounted in my panel.

    The hardware is functionning well and communications between my hardware and my software are good.

    The problem is between my software and FSUIPC... I can't find any offset to control the gps buttons. Am i missing something? Because I see that it is possible to control the gps via the computer keyboard keys defined directly inside FSUIPC. What I want is to control the gps just like I control the lights; via an offset in FSUIPC.

    Can anyone help me?

    Thank you very much.

    Best regards to all,

    Emmanuel.

×
×
  • 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.