Page 57 of 74 FirstFirst ... 74753545556575859606167 ... LastLast
Results 561 to 570 of 737
  1. #561
    150+ Forum Groupie
    Join Date
    Mar 2009
    Location
    South Africa
    Posts
    221
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Quote Originally Posted by sgaert View Post
    I buyed the Software 2 weeks after Publication. I paid 250€.
    Yes i remember when it was so cheap and then i was still planning my cockpit and was buying screens and then i missed the "bus" and the price went up TOO much for me.

  2. #562
    300+ Forum Addict



    Join Date
    Mar 2009
    Location
    Usa
    Posts
    388
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Quote Originally Posted by shearder View Post
    But problem is buttons, switches and knobs i can get don't look like the "real" thing.
    ..... oh bugger, . guilt trip vcoming on here, .... drop me your address again via PM , ....

  3. #563
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Stefan,

    Shearder and myself are having some issues (one anyway) with the MCP code and hope that you can take a look at it. Here is the problem, when intercepting the ILS vectors, we press the APP button which turns off the AP HDG and stays horizonatally aligned with the runway, but it does not follow the glide slope down to the runway, the ALT remains on and the aircraft maintains it's altitude. We have both gone over the code and cannot identify why this is happening. Without FSBus running, the software (FSX) does exactly as it should.

    Here is the .cpp file for the MCP (I will only post the case and not the declarations and Mk code)

    Thanks
    David

    Code:
    void  cbModecontrolpanel (int oid, int val, double dval)
    {
    	int x;
        switch (oid)
    	{
    	case C_RCOURSELR:
                //EventHandler(S_RHEADING, 0, 0); // sound rotary
                Course -= val; // val can be >1 or <-1
                while (Course > 360) // wrapped forward
                    Course -= 360; // full circle back
                while (Course <= 0) // wrapped backward
                    Course += 360;  // full circle forward
                FsWriteInt(FS_NAV1OBS, Course); // to FS
                FsbusWrite(C_DCOURSEL, Course); // to cockpit display
                FsbusWrite(C_DCOURSER, Course);
    			FsbusWrite(C_OBS_DISPLAY, Course);
                break;
    
            case C_RIAS:
                //EventHandler(S_RHEADING, 0, 0); // sound rotary
                if (MachSpeed == 0)
                {
                    Airspeed -= val;
                    if (Airspeed < 100) // minimum 100 knts
                        Airspeed = 100;
                    if (Airspeed > 340) // maximum 340 knts
                        Airspeed = 340;
                    FsWriteInt(FS_AP_AIRSPEED, Airspeed);  // to FS
                    FsbusWrite(C_DIAS, Airspeed);
                }
                else 
                {
                    Mach -= val;
                    if (Mach > 70)
                        Mach = 70;
                    if (Mach < 10)
                        Mach = 10;
                    FsWriteInt(FS_AP_MACH, Mach * 65536 / 100);
                    FsbusWrite(C_DIAS, Mach);
                }
                break;
    
            case C_RHEADING: // APHeading range: 1..360
                //EventHandler(S_RHEADING, 0, 0); // sound rotary
                APHeading -= val; // val can be >1 or <-1
                while (APHeading > 360) // wrapped forward
                    APHeading -= 360; // full circle back
                while (APHeading <= 0) // wrapped backward
                    APHeading += 360; // full circle forward
                x = (APHeading % 360) * 65536 / 360 + 1; // (+1 is for rounding)
                FsWriteInt(FS_AP_HEADING, x); // to FS
                FsbusWrite(C_DHEADING, APHeading); // to cockpit display
                break;
    
            case C_RALTITUDE:
    			  apalt += val*100;
    			  if (apalt < 0)
    				  apalt = 0;
    			  if (apalt > 39000)
    				  apalt = 39000;
    			  FsbusWrite (C_DALTITUDE, apalt);
    			  FsWriteInt(FS_AP_ALTITUDE, apalt*19975);
            break;
    		//EventHandler(S_RHEADING, 0, 0); // sound rotary
                /*Altitude += val * 10000 / 100;// // val can be >1 or <-1
         //       printf("Altitude %d\n", Altitude);
                FsbusWrite(C_DALTITUDE, Altitude);
    			FsWriteInt(FS_AP_ALTITUDE, Altitude); // to Fs
                break;*/
            case C_RVSPEED:
                //EventHandler(S_RHEADING, 0, 0); // sound rotary
                Vertspeed += val * 10000 / 100; // update
                if (Vertspeed < -7600)
                    Vertspeed = -7600; // Max decend
                if (Vertspeed > 6000)
                    Vertspeed = 6000; // Max climb
                FsbusWrite(C_DVSPEED, Vertspeed);
    			FsWriteInt(FS_AP_VS, Vertspeed); // to FS			 
                break;
    		
    		case C_SFLIGHTDIRL:
    				if (val == 0)  //here you write if 1 active or 0
    				{
    					 printf("DIRL0, val=%d\n", val);
    					FsbusWrite(C_LFLIGHTDIRL, 1);
    					FsbusWrite(C_LMASTFLIGHTL, 1);
    					FsWriteInt(FS_FLIGHTDIRECTOR,1);
    				}
    				else
    				{
    					// printf("DIRL1, val=%d\n", val);
    					FsbusWrite(C_LFLIGHTDIRL, 0);
    					FsbusWrite(C_LMASTFLIGHTL, 0);
    					FsWriteInt(FS_FLIGHTDIRECTOR, 0);
    				}
    				break;
    case C_SAUTOTHROTTLEARM:
                CockpitATArmed = (val == 0) ? 1 : 0;
                if (bSynchronised) // pass only when in sync
                    FsWriteInt(FS_AUTOTHROTTLEARM, (val == 0) ? 1 : 0);
                FsbusWrite(C_LATARMED, CockpitATArmed);
                printf("C_SAUTOTHROTTLEARM event, CockpitATarmed  %d\n", CockpitATArmed);
                if (CockpitATArmed == 0)
                {
                    AirspeedHold = 0;
                    MachHold = 0;
                }
                break;
            case C_SN1:
                if ((val == 0) & (CockpitATArmed == 1)) // button push only
                {                                                                                                                       //  AT on
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                    EngN1 = (EngN1 == 0) ? 1 : 0; // toggle
                    if (MachSpeed == 0)
                        FsWriteInt(FS_AP_AIRSPEEDHOLD, EngN1); // to FS
                    else
                        FsWriteInt(FS_AP_MACHHOLD, EngN1);
                    if (EngN1 == 1)
                        AirspeedHold = 0;
                    FsbusWrite(C_LN1, EngN1);
                    FsbusWrite(C_LAIRSPEEDHOLD, AirspeedHold);
                    FsWriteInt(FS_ENGINE1N1, EngN1);
                    FsWriteInt(FS_ENGINE1N2, EngN1);
                }
                break;
            case C_SSPDHLD:
                if ( (val == 0) && (CockpitATArmed == 1) ) // button push only
                {
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                    AirspeedHold = (AirspeedHold == 0) ? 1 : 0; // toggle
                    FsbusWrite(C_LAIRSPEEDHOLD, AirspeedHold);
                    if (AirspeedHold == 1)
                    {
                        EngN1 = 0;
                        FsbusWrite(C_LN1, EngN1);
                        if (MachSpeed == 0)
                            FsWriteInt(FS_AP_AIRSPEEDHOLD, 1);
                        else
                            FsWriteInt(FS_AP_MACHHOLD, 1);
                    }
                    else
                    {
                        FsWriteInt(FS_AP_AIRSPEEDHOLD, 0);
                        FsWriteInt(FS_AP_MACHHOLD, 0);
                    }
                    //FsWriteInt(FS_ENGINE1N1, EngN1);
                    //FsWriteInt(FS_ENGINE1N2, EngN1);
                 }
                break;
            case C_SSPDINTV:
                break;
            case C_SCHANGEOVER:
                //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                if (val == 0) // button push only
                {
                    MachSpeed = (MachSpeed == 0) ? 1 : 0; // toggle
                    if (MachSpeed == 1) // Mach indication
                    {
                        DisplayOptions(C_DIAS, 3, 0, TRUE, 3);
                        FsbusWrite(C_DIAS, Mach);
                        FsWriteInt(FS_AP_MACHHOLD, 1);
                    }
                    else // IAS indication
                    {
                        DisplayOptions(C_DIAS, 4, 0, FALSE, 0); // Fsbus bug (p5=0)
                        FsbusWrite(C_DIAS, Airspeed);
                        FsWriteInt (FS_AP_AIRSPEEDHOLD, 1);
                    }
                }
                break;
            case C_SVNAV:
                break;
            case C_SLNAV:
                break;
            case C_SLVLCHG:
    			//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                if ((val == 0)  &&  // button push
    					(abs(ActAlt - Altitude) > 200)  &&  // delta in ft
    					((AirspeedHold == 1) || (EngN1 == 1)))
                {
    					LvlChg = (LvlChg == 0) ? 1 : 0; // toggle
                    if (LvlChg == 1) // level change
                    {
                        AltitudeLock = 0; // off
                        FsWriteInt(FS_AP_ALTITUDELOCK, LvlChg); // activate
                        x = Altitude * 65536 / 100 * 3048; // in meters * 65536
                        AltitudeSave = Altitude; // save for AltInt
                        FsWriteInt(FS_AP_ALTITUDE, x * 19975);
                        FsWriteInt(FS_AP_VSHOLD, 0);
                        FsbusWrite(C_LLVLCHG, LvlChg); // sync lvl change
                        if (ActAlt < Altitude) // climbing
                        {
                            EngN1 = 0; // force N1 off
                            //EventHandler(C_SN1, 0, 0); // toggle -> on
                            FsWriteInt(FS_AP_VS, 800); // default climb speed
                        }
                        else // descending
                        {
                            AirspeedHold = 0; // force IAS off
                            //EventHandler(C_SSPDHLD, 0, 0); // toggle -> on
                            FsWriteInt(FS_AP_VS, -800); // default desc. speed
                        }
                    }
                    else // no level change
                    {
                        AltitudeLock = 1; // on
                        FsbusWrite(C_LLVLCHG, LvlChg); // lvl-swtch
                    }
                    FsbusWrite(C_LALTITUDELOCK, AltitudeLock); // update altitude lock
                }
                break;
            case C_SHEADINGLOCK:
                if (val == 0) // button push only
                {
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                    HeadingLock = (HeadingLock == 0) ? 1 : 0; // toggle
                    FsWriteInt(FS_AP_HEADINGLOCK, HeadingLock);
                }
                break;
    
            case C_SVORLOC:
                break;
            case C_SAPP:
    				//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                if (val == 0) // button push only
                {
                    ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
                    FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
                }
                break;
            case C_SALTHLD:
                if (val == 0)
                {
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                    AltitudeLock = (AltitudeLock == 0) ? 1 : 0; // toggle
                    FsWriteInt(FS_AP_ALTITUDELOCK, AltitudeLock);
                    printf("C_SALTHLD AltitudeLock=%d\n", AltitudeLock);
                    FsbusWrite(C_LALTITUDELOCK, AltitudeLock);
                }
                break;
            case C_SALTINTV:
                //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                if (val == 0) // button push only
                {
                    if (AltitudeSave != Altitude) // changed by pilot
                    {
                        AltitudeSave = Altitude; // save for AltInt
                        x = Altitude * 65536 / 10000 * 3048; // in meters * 65536
                    }
                    else // unchanged
                    {
                        AltitudeSave = ActAlt; // save for AltInt
                        x = (ActAlt + 50) / 100 * 100; // round to 100
                        x = x * 65536 / 10000 * 3048; // in meters * 65536
                        AltitudeLock = 1;
                        FsbusWrite(C_LALTITUDELOCK, AltitudeLock);
                        LvlChg = 0;
                        FsbusWrite(C_LLVLCHG, LvlChg);
                    }
                    FsWriteInt(FS_AP_ALTITUDE, x); // new AP altitude
                }
                break;
            case C_SVSPEEDHLD:
                //EventHandler(S_SADFSWAP, 0, 0);  // sound small switch
                if (val == 0) // button push only
                {
                    VertspeedHold = (VertspeedHold == 0) ? 1 : 0; // toggle
                    FsWriteInt(FS_AP_VSHOLD, VertspeedHold);
                }
                break;
            case C_SCMDA:
                if ((val==0) && (Disengage == 0)) // button push only
                {
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
    
                    Cmda = (Cmda == 0) ? 1 : 0; // toggle
                    if (Cmda == 0)
                        FsbusWrite(C_LCMDA, 0);
                    else
                    {
                        FsbusWrite(C_LCMDA, 1);
                        FsbusWrite(C_LCMDB, 0);
                        FsbusWrite(C_LCWSA, 0);
                        FsbusWrite(C_LCWSB, 0);
                        FsWriteInt(FS_AP_MASTER, 1);
                    }
                }
                break;
            case C_SCMDB:
                if ((val==0) && (Disengage == 0)) // button push only
                {
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                    Cmdb = (Cmdb == 0) ? 1 : 0; // toggle
                    if (Cmdb == 0)
                        FsbusWrite(C_LCMDB, 0);
                    else
                    {
                        FsbusWrite(C_LCMDB, 1);
                        FsbusWrite(C_LCWSA, 0);
                        FsbusWrite(C_LCWSB, 0);
                        FsWriteInt(FS_AP_MASTER, 1);
                    }
                }
                break;
           case C_SCWSA:
               if ((val==0) && (Disengage == 0)) // button push only
               {
                   //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                   Cwsa = (Cwsa == 0) ? 1 : 0; // toggle
                   if (Cwsa == 0)
                       FsbusWrite(C_LCWSA, 0);
                   else
                   {
                       FsbusWrite(C_LCMDA, 0);
                       FsbusWrite(C_LCMDB, 0);
                       FsbusWrite(C_LCWSA, 1);
                       FsbusWrite(C_LCWSB, 0);
                       FsWriteInt(FS_AP_MASTER, 1);
                   }
                }
                break;
            case C_SCWSB:
                if ((val==0) && (Disengage == 0)) // button push only
                {
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                    Cwsb = (Cwsb == 0) ? 1 : 0; // toggle
                    if (Cwsb == 0)
                        FsbusWrite(C_LCWSB, 0);
                    else
                    {
                        FsbusWrite(C_LCMDA, 0);
                        FsbusWrite(C_LCMDB, 0);
                        FsbusWrite(C_LCWSA, 0);
                        FsbusWrite(C_LCWSB, 1);
                        FsWriteInt(FS_AP_MASTER, 1);
                    }
                }
                break;
            case C_SAPDISENGAGE:
                if (val==0) // button push only
                {
                    //EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                    Disengage = (Disengage == 0) ? 1 : 0; // toggle
                    if (Disengage == 0)
                    {
                        FsbusWrite(C_LAPDISENGAGEL, 0);
                        FsbusWrite(C_LAPDISENGAGER, 0);
                    }
                    else
                    {
                        FsbusWrite(C_LAPDISENGAGEL, 1);
                        FsbusWrite(C_LAPDISENGAGER, 1);
                        FsbusWrite(C_LCMDA, 0);
                        FsbusWrite(C_LCMDB, 0);
                        FsbusWrite(C_LCWSA, 0);
                        FsbusWrite(C_LCWSB, 0);
                        FsWriteInt(FS_AP_MASTER, 0);
                    }
                }
                break;
            case FS_AP_MASTER:
                break;
            case FS_AP_WINGLEVELER:
                break;
            case FS_AP_NAV1LOCK:
                break;
            case FS_AP_HEADINGLOCK:
                HeadingLock = val;
                FsbusWrite(C_LHEADINGLOCK, val);
                break;
            case FS_AP_HEADING:
                APHeading = (val + 1) * 360 / 65536; // (+1 for rounding)
                if (APHeading == 0)
                    APHeading = 360;
                FsbusWrite(C_DHEADING, APHeading);
                break;
            case FS_NAV1OBS:
                Course = val;
                if (Course == 0)
                    Course = 360;
                FsbusWrite(C_DCOURSEL, Course);
                FsbusWrite(C_DCOURSER, Course);
                break;
            case FS_AP_ALTITUDELOCK:
                AltitudeLock = val;
                FsbusWrite(C_LALTITUDELOCK, val);
                break;
            case FS_AP_ALTITUDE:
                Altitude = (val / 3048 * 2500 + 8192) / 16384; // to feet
                FsbusWrite(C_DALTITUDE, Altitude);
                break;
            case FS_ALTITUDE:
                ActAlt = val * 10000 / 3048; // to feet
                if ((ActAlt > 25500) && (ActAlt < 26500)) 
                {
                    if ((MachSpeed == 0) && (ActAlt > 26000))
                        cbModecontrolpanel(C_SCHANGEOVER,0,0);
                    else if ((MachSpeed == 1) && (ActAlt < 26000))
                        cbModecontrolpanel(C_SCHANGEOVER,0,0);
                }
                if (abs(Altitude - ActAlt) < 10)
                {
                    LvlChg = 0;
                    FsbusWrite (C_LLVLCHG , LvlChg);
                    FsbusWrite (C_LALTITUDELOCK , 1);
                }
                break;
            case FS_AP_VS:
                Vertspeed = val;
                FsbusWrite(C_DVSPEED, Vertspeed);
                break;
            case FS_AP_RPMHOLD:
                break;
            case FS_AP_RPM:
                break;
            case FS_AP_GLIDESLOPEHOLD:
                break;
            case FS_AP_APPROACHHOLD:
                ApproachHold = val;
                FsbusWrite(C_LAPP, ApproachHold);
                break;
            case FS_FLIGHTDIRECTOR:
                if (bSynchronised == false)
                {
                    if (val == 1)
                    {   printf("C_SFLIGHTDIRL event, ValFlightDir=%d\n", ValFlightDir);
                        FsbusWrite(C_LFLIGHTDIRL, 1);
                        FsbusWrite(C_LMASTFLIGHTL, 1);
                        FsbusWrite(C_LFLIGHTDIRR, 0);
                        FsbusWrite(C_LMASTFLIGHTR, 0);
    //                  FsWrite(FS_FLIGHTDIRECTOR,1);
                        ValFlightDir  = 1;
                    }
                else
                    {
                        FsbusWrite(C_LFLIGHTDIRL, 0);
                        FsbusWrite(C_LMASTFLIGHTL, 0);
                        FsbusWrite(C_LFLIGHTDIRR, 0);
                        FsbusWrite(C_LMASTFLIGHTR, 0);
    //                  FsWrite(FS_FLIGHTDIRECTOR,0);
                        ValFlightDir  = 0;
                    }
                }
                break;
    
            case FS_ENGINE1N1:
                Engine1N1 = val * 100 / 16384;
                break;
    
            case FS_ENGINE1N2:
                Engine1N2 = val * 100 / 16384;
                break;
            }
    }

  4. #564
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Quote Originally Posted by RobiD View Post
    Here is the problem, when intercepting the ILS vectors, we press the APP button which turns off the AP HDG and stays horizonatally aligned with the runway, but it does not follow the glide slope down to the runway, the ALT remains on and the aircraft maintains it's altitude.
    Ok, what Aircraft do you use?
    Do you press the VorLoc befor you press the App?
    Can you compare alle the MCP Offsets with FSinterogate, test one Software panel only, second test with hardware.

    I donīt know your code. It looks like FS default but without knowing the offset i canīt say anything.
    But as first, i also told that Shearder via skype there is no VORLOC funktion.

    Code:
            case C_SAPP:
    				//EventHandler(S_SADFSWAP, 0, 0); // sound small switch
                if (val == 0) // button push only
                {
                    ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
                    FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
                }
                break;
    That is the App, it only writes 0 or 1 to an offset, the fsbus code donīt makes more. The rest do only the aircraft by it self.
    I would start writing the a new MCP code.

    Stefan

  5. #565
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Stefan,

    I am testing this in a 737.
    When I just use FSX, it works fine and I don't push VOR LOC it intercepts the GS and holds runway heading (basically lands itself).

    With FSInterrogate, here are my findings:

    When just using FSX (this can be with FSBus running, but pressing the buttons in the VC with the mouse)
    When you select APP, 07C8 (APHeadingHold) turns off (goes from a 1 to a 0) as it intercepts the ILS (horizontal) and then 07D0 (APAltitude Hold) turns off as it intersects the glideslope. Also at the same time as pressing APP, the following two offsets turn on: 07FC (AP GSHold), and 0800 (AP Approach Hold).

    Same situation, this time just using the buttons on my MCP through FSBUS:
    When you select APP, 07C8 (APHeadingHold) turns off (goes from a 1 to a 0) as it intercepts the ILS (horizontal) but 07D0 (APAltitude Hold) does not turn off as it intersects the glideslope. Also at the same time as pressing APP, the following offset turn on: 0800 (AP Approach Hold).
    07FC (AP GSHold) does not turn on, which I think is why APAltitude Hold does not turn off as it intersects the glideslope.

    Does this give any clarity?

    Here is the code I have relating to the last two offsets:

    case FS_AP_GLIDESLOPEHOLD:
    break;
    case FS_AP_APPROACHHOLD:
    ApproachHold = val;
    FsbusWrite(C_LAPP, ApproachHold);
    break;


    Thanks
    David

    PS I hope this makes sense.

  6. #566
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    I would write the MCP new, if you use the default 737 use that MCP as sample.

  7. #567
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Ok, after much testing, here is the solution!!!


    Add this at the top with the rest of the static int:

    Code:
    static   int    GlideslopeHold   = 0;
    Then uncomment out:
    Code:
    MkFsObject(FS_AP_GLIDESLOPEHOLD,  "",cbModecontrolpanel, 0x07FC, 4,  TP_UI32,  FS_NORMAL, 0);
    Then change this:
    Code:
    case C_SAPP:
    				            if (val == 0) // button push only
                {
                    ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
                    FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
    				            }
                break;
    to this:

    Code:
    case C_SAPP:
                if (val == 0) // button push only
                {
                    ApproachHold = (ApproachHold == 0) ? 1 : 0; // toggle
                    FsWriteInt(FS_AP_APPROACHHOLD, ApproachHold);
    				GlideslopeHold = (GlideslopeHold == 0) ? 1 : 0;
    				FsWriteInt(FS_AP_GLIDESLOPEHOLD, GlideslopeHold);
                }
                break;
    Have tested and works for me.

    Let me know if it works for you too.

    David

  8. #568
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Need your help again Stefan.

    I am programming a stepper driven ADF/RMI.

    I just need help with the details in the code. I have pasted the basic template below and would be very gratefull for your help to complete.

    It is driven by 2 stepper motors, one for the ADF Dial Heading(compass card) and the other motor drives the ADF Relative Bearing indicator needle.

    I also have a rotary to adjust the compass card.

    I have also layed it out using Dirk's example of using only one file which is the .cpp if I understand correctly and do not need the .h file.

    Thanks as always.
    David


    Code:
    #include "stdafx.h"
    #include "fsbus.h"
    
    void cbSteppergauges(int oid, int val, double dval);
    #define FS_ADF1RELATIVEBEARING 1
    #define FS_ADF1DIALBEARING 2
    #define C_ADFCOMPASSCARD 3
    #define C_ADFBEARINGNEEDLE 4
    #define C_ADFROSEADJUST 5
    
    void cbSteppergaugesBuildObjects()
    {
    	MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle",  cbSteppergauges,  0x0C6A, 2, TP_I16,  FS_NORMAL,0);
    	MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card",  cbSteppergauges,  0x0C6C, 2, TP_I16,  FS_NORMAL,0);
    	MkFsbusObject(BTP_V_OUT, C_ADFCOMPASSCARD,"",NULL,30,80,0);
    	MkFsbusObject(BTP_V_OUT, C_ADFBEARINGNEEDLE,"",NULL,29,80,0);
    	MkFsbusObject(BTP_ROTARY, C_ADFROSEADJUST,	"",cbModecontrolpanel, 27, 14, 0);
    }
    
    {
    	switch(oid)
    	{
    	case FS_ADF1RELATIVEBEARING:
    		FsbusWrite(C_ADFBEARINGNEEDLE, ????);//should this be FsbusWriteFmtVar()
    		break;
    
    	case FS_ADF1DIALBEARING:
    		FsbusWrite(C_ADFCOMPASSCARD, ????);//should this be FsbusWriteFmtVar()
    		break;
    
    	case C_ADFROSEADJUST:
    		// this rotary will move the compass rose left or right (FS_ADF1DIALBEARING)
    		FsWriteInt(FS_ADF1DIALBEARING, val??);
    		break;
    	}
    }

  9. #569
    300+ Forum Addict
    Join Date
    Feb 2008
    Location
    Krefeld, Germany
    Posts
    318
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Hi David,

    The stepper outputs use the FsbusWriteFmtVar(cid,rid,value) function.
    You donīt need to define a stepper.

    Stefan

  10. #570
    300+ Forum Addict RobiD's Avatar
    Join Date
    Sep 2007
    Location
    Gold Coast, Australia
    Posts
    430
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Progamming help with FSBus dll

    Ok, is this getting closer?

    Also is my rotary code correct?

    Also, is this written correctly (do I need to have more than just 'val' there:

    case FS_ADF1RELATIVEBEARING:
    FsbusWriteFmtVar(29,80,val);
    break;

    Thanks
    David

    Code:
    #include "stdafx.h"
    #include "fsbus.h"
    
    void cbSteppergauges(int oid, int val, double dval);
    #define FS_ADF1RELATIVEBEARING 1
    #define FS_ADF1DIALBEARING 2
    //#define C_ADFCOMPASSCARD 3 / not needed
    //#define C_ADFBEARINGNEEDLE 4 / not needed
    #define C_RADFROSEADJUST 5
    
    static int ADFroseadjust = 0;
    
    void cbSteppergaugesBuildObjects()
    {
    	MkFsObject(FS_ADF1RELATIVEBEARING,"ADF Needle",  cbSteppergauges,  0x0C6A, 2, TP_I16,  FS_NORMAL,0);
    	MkFsObject(FS_ADF1DIALBEARING,"ADF Compass Card",  cbSteppergauges,  0x0C6C, 2, TP_I16,  FS_NORMAL,0);
    	//MkFsbusObject(BTP_V_OUT, C_ADFCOMPASSCARD,"",NULL,30,80,0);Not needed
    	//MkFsbusObject(BTP_V_OUT, C_ADFBEARINGNEEDLE,"",NULL,29,80,0);Not needed
    	MkFsbusObject(BTP_ROTARY, C_RADFROSEADJUST,	"",cbModecontrolpanel, 27, 26, 0);
    }
    
    {
    	switch(oid)
    	{
    	case FS_ADF1RELATIVEBEARING:
    		FsbusWriteFmtVar(29,80,val);
    		break;
    
    	case FS_ADF1DIALBEARING:
    		FsbusWriteFmtVar(30,80,val);
    		break;
    
    	case C_RADFROSEADJUST:
    		ADFroseadjust -= val;
    		while (ADFroseadjust > 360)
    			ADFroseadjust -= 360;
    		while (ADFroseadjust <=0)
    			ADFroseadjust += 360;
    		x = (ADFroseadjust % 360)
    		FsWriteInt(FS_ADF1DIALBEARING,x);
    		break;
    	}
    }

Similar Threads

  1. Fsbus CDK
    By flyandre in forum General Builder Questions All Aircraft Types
    Replies: 4
    Last Post: 12-27-2014, 12:58 PM
  2. Need Help Getting My FSBUS NG I/O Going Again..
    By JBRoberts in forum I/O Interfacing Hardware and Software
    Replies: 14
    Last Post: 03-21-2010, 01:38 PM
  3. Fsbus ng io
    By Davral in forum I/O Interfacing Hardware and Software
    Replies: 0
    Last Post: 01-10-2009, 10:38 PM
  4. Fsbus 2.4.3
    By Anderson/SBSP in forum I/O Interfacing Hardware and Software
    Replies: 9
    Last Post: 11-30-2008, 04:25 PM
  5. Help FSBUS
    By cesarfsim in forum I/O Interfacing Hardware and Software
    Replies: 2
    Last Post: 10-26-2008, 02:23 PM

Tags for this Thread