// Action: move heading bug
inst->addAction(0, SIX_W/2 - SIX_W/5, -SIX_W/2, SIX_W/10, SIX_W/5,
- new FGAdjustAction(FGBFI::getAPHeading,
- FGBFI::setAPHeading,
+ new FGAdjustAction(FGBFI::getAPHeadingMag,
+ FGBFI::setAPHeadingMag,
-1.0, -360.0, 360.0, true));
inst->addAction(0, SIX_W/2 - SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5,
- new FGAdjustAction(FGBFI::getAPHeading,
- FGBFI::setAPHeading,
+ new FGAdjustAction(FGBFI::getAPHeadingMag,
+ FGBFI::setAPHeadingMag,
1.0, -360.0, 360.0, true));
inst->addAction(1, SIX_W/2 - SIX_W/5, -SIX_W/2, SIX_W/10, SIX_W/5,
- new FGAdjustAction(FGBFI::getAPHeading,
- FGBFI::setAPHeading,
+ new FGAdjustAction(FGBFI::getAPHeadingMag,
+ FGBFI::setAPHeadingMag,
-5.0, -360.0, 360.0, true));
inst->addAction(1, SIX_W/2 - SIX_W/10, -SIX_W/2, SIX_W/10, SIX_W/5,
- new FGAdjustAction(FGBFI::getAPHeading,
- FGBFI::setAPHeading,
+ new FGAdjustAction(FGBFI::getAPHeadingMag,
+ FGBFI::setAPHeadingMag,
5.0, -360.0, 360.0, true));
// Layer 0: compass background
FGSteam::get_MH_deg,
-720.0, 720.0, -1.0, 0.0);
inst->addTransformation(FGInstrumentLayer::ROTATION,
- FGBFI::getAPHeading,
+ FGBFI::getAPHeadingMag,
-720.0, 720.0, 1.0, 0.0);
// Layer 2: fixed center
inst->addTransformation(FGInstrumentLayer::XSHIFT, SIX_W/2 - 10);
inst->addTransformation(FGInstrumentLayer::YSHIFT, -SIX_W/2 + 10);
inst->addTransformation(FGInstrumentLayer::ROTATION,
- FGBFI::getAPHeading,
+ FGBFI::getAPHeadingMag,
-360.0, 360.0, 1.0, 0.0);
return inst;
double flaps = getFlaps();
double brake = getBrake();
bool apHeadingLock = getAPHeadingLock();
- double apHeading = getAPHeading();
+ double apHeadingMag = getAPHeadingMag();
bool apAltitudeLock = getAPAltitudeLock();
double apAltitude = getAPAltitude();
const string &targetAirport = getTargetAirport();
setFlaps(flaps);
setBrake(brake);
setAPHeadingLock(apHeadingLock);
- setAPHeading(apHeading);
+ setAPHeadingMag(apHeadingMag);
setAPAltitudeLock(apAltitudeLock);
setAPAltitude(apAltitude);
setTargetAirport(targetAirport);
* Get the autopilot target heading in degrees.
*/
double
-FGBFI::getAPHeading ()
+FGBFI::getAPHeadingMag ()
{
- return current_autopilot->get_TargetHeading();
+ return current_autopilot->get_TargetHeading() - getMagVar();
}
* Set the autopilot target heading in degrees.
*/
void
-FGBFI::setAPHeading (double heading)
+FGBFI::setAPHeadingMag (double heading)
{
- current_autopilot->set_TargetHeading( heading );
+ current_autopilot->set_TargetHeading( heading + getMagVar() );
}
static bool getAPAltitudeLock ();
static double getAPAltitude ();
static bool getAPHeadingLock ();
- static double getAPHeading ();
+ static double getAPHeadingMag ();
static void setAPAltitudeLock (bool lock);
static void setAPAltitude (double altitude);
static void setAPHeadingLock (bool lock);
- static void setAPHeading (double heading);
+ static void setAPHeadingMag (double heading);
static bool getAPNAV1Lock ();
static void setAPNAV1Lock (bool lock);
SAVE("autopilot-altitude-lock", FGBFI::getAPAltitudeLock());
SAVE("autopilot-altitude", FGBFI::getAPAltitude());
SAVE("autopilot-heading-lock", FGBFI::getAPHeadingLock());
- SAVE("autopilot-heading", FGBFI::getAPHeading());
+ SAVE("autopilot-heading", FGBFI::getAPHeadingMag());
SAVE("autopilot-gps-lock", FGBFI::getGPSLock());
SAVE("autopilot-gps-lat", FGBFI::getGPSTargetLatitude());
SAVE("autopilot-gps-lon", FGBFI::getGPSTargetLongitude());
else if (text == "autopilot-heading:") {
input >> n;
cout << "autopilot heading is " << n << endl;
- FGBFI::setAPHeading(n);
+ FGBFI::setAPHeadingMag(n);
}
else if (text == "autopilot-gps-lock:") {