Heading bug (and bfi) now deals with magnetic compass heading rather than
true heading. Internally, the sim (and the autopilot) still runs off of true heading.
This commit is contained in:
parent
56a8d4247d
commit
7863c607bf
4 changed files with 20 additions and 20 deletions
|
@ -207,20 +207,20 @@ createGyroCompass (int x, int y)
|
|||
|
||||
// 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
|
||||
|
@ -237,7 +237,7 @@ createGyroCompass (int x, int y)
|
|||
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
|
||||
|
@ -250,7 +250,7 @@ createGyroCompass (int x, int y)
|
|||
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;
|
||||
|
|
|
@ -117,7 +117,7 @@ FGBFI::reinit ()
|
|||
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();
|
||||
|
@ -138,7 +138,7 @@ FGBFI::reinit ()
|
|||
setFlaps(flaps);
|
||||
setBrake(brake);
|
||||
setAPHeadingLock(apHeadingLock);
|
||||
setAPHeading(apHeading);
|
||||
setAPHeadingMag(apHeadingMag);
|
||||
setAPAltitudeLock(apAltitudeLock);
|
||||
setAPAltitude(apAltitude);
|
||||
setTargetAirport(targetAirport);
|
||||
|
@ -786,9 +786,9 @@ FGBFI::setAPHeadingLock (bool lock)
|
|||
* Get the autopilot target heading in degrees.
|
||||
*/
|
||||
double
|
||||
FGBFI::getAPHeading ()
|
||||
FGBFI::getAPHeadingMag ()
|
||||
{
|
||||
return current_autopilot->get_TargetHeading();
|
||||
return current_autopilot->get_TargetHeading() - getMagVar();
|
||||
}
|
||||
|
||||
|
||||
|
@ -796,9 +796,9 @@ FGBFI::getAPHeading ()
|
|||
* 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() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -121,12 +121,12 @@ public:
|
|||
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);
|
||||
|
|
|
@ -128,7 +128,7 @@ fgSaveFlight (ostream &output)
|
|||
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());
|
||||
|
@ -408,7 +408,7 @@ fgLoadFlight (istream &input)
|
|||
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:") {
|
||||
|
|
Loading…
Add table
Reference in a new issue