// Assume that the nominal range (usually
// 50nm) applies at a 5,000 ft difference.
// Just a wild guess!
- double factor = ((aircraftElev*METER_TO_FEET) - stationElev) / 5000.0;
+ double factor = ((aircraftElev*METER_TO_FEET) - stationElev) / 1000.0;
double range = fabs(nominalRange * factor);
// Clamp the range to keep it sane; for
InstrumentData instruments[] =
{
- {"magcompass", 512, 459, SIX_W, SIX_W/2, {}, {
+ {"magcompass", 768, 459, SIX_W, SIX_W/2, {}, {
{new MagRibbon(int(SIX_W*0.8), int(SIX_W*0.2))},
{new MyTexturedLayer("compassFront", SIX_W, SIX_W*(24.0/80.0))}
}},
{new MyTexturedLayer("turnBall",
int(SIX_W * (4.0/64.0)), int(SIX_W * (4.0/64.0))), {
{TransData::Rotation, FGSteam::get_TC_rad,
- -0.1, 0.1, -2000.0, 0.0},
+ -0.1, 0.1, 400.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -(SIX_W/4)+4}
}}
}},
}},
{new MyTexturedLayer("bug",
int(SIX_W*(4.0/64.0)), int(SIX_W*(4.0/64.0))), {
- {TransData::Rotation, FGBFI::getAPHeadingMag, -720.0, 720.0, 1.0, 0.0},
- {TransData::Rotation, FGSteam::get_DG_deg, -720.0, 720.0, 1.0, 0.0},
+ {TransData::Rotation, FGBFI::getAPHeading, -720.0, 720.0, 1.0, 180.0},
+ {TransData::Rotation, FGSteam::get_DG_deg, -720.0, 720.0, -1.0, 0.0},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -(SIX_W/2.0)+4}
}},
{new MyTexturedLayer("compassCenter", int(SIX_W*0.625), int(SIX_W*0.625))},
int(SIX_W*(21.0/112.0)), int(SIX_W*(21.0/112.0))), {
{TransData::XShift, 0, 0.0, 0.0, 0.0, SIX_W/2-10},
{TransData::YShift, 0, 0.0, 0.0, 0.0, -SIX_W/2+10},
- {TransData::Rotation, FGBFI::getAPHeadingMag, -360.0, 360.0, 1.0, 0.0}
+ {TransData::Rotation, FGBFI::getAPHeading, -360.0, 360.0, 1.0, 0.0}
}},
{new MyTexturedLayer("knob",
int(SIX_W*(22.0/112.0)), int(SIX_W*(22.0/112.0))), {
// Default axis 0 to aileron
if (!props.getValue("/input/js0/axis0/control")) {
props.setStringValue("/input/js0/axis0/control", "/controls/aileron");
- props.setFloatValue("/input/js0/axis0/dead-band", 0.1);
+ props.setDoubleValue("/input/js0/axis0/dead-band", 0.1);
}
// Default axis 1 to elevator
if (!props.getValue("/input/js0/axis1/control")) {
props.setStringValue("/input/js0/axis1/control", "/controls/elevator");
- props.setFloatValue("/input/js0/axis1/dead-band", 0.1);
- props.setFloatValue("/input/js0/axis1/factor", -1.0);
+ props.setDoubleValue("/input/js0/axis1/dead-band", 0.1);
+ props.setDoubleValue("/input/js0/axis1/factor", -1.0);
}
// Default axis 2 to rudder
if (!props.getValue("/input/js0/axis2/control")) {
props.setStringValue("/input/js0/axis2/control", "/controls/rudder");
- props.setFloatValue("/input/js0/axis2/dead-band", 0.1);
+ props.setDoubleValue("/input/js0/axis2/dead-band", 0.1);
}
// Default axis 3 to throttle
// and factor to make it work
if (!props.getValue("/input/js0/axis3/control")) {
props.setStringValue("/input/js0/axis3/control", "/controls/throttle");
- props.setFloatValue("/input/js0/axis3/dead-band", 0.0);
- props.setFloatValue("/input/js0/axis3/offset", -1.0);
- props.setFloatValue("/input/js0/axis3/factor", -0.5);
+ props.setDoubleValue("/input/js0/axis3/dead-band", 0.0);
+ props.setDoubleValue("/input/js0/axis3/offset", -1.0);
+ props.setDoubleValue("/input/js0/axis3/factor", -0.5);
}
// Default button 0 to all brakes
if (!props.getValue("/input/js0/button0/control")) {
props.setStringValue("/input/js0/button0/action", "switch");
- props.setStringValue("/input/js0/button0/control", "/controls/brake");
- props.setFloatValue("/input/js0/button0/step", 1.0);
- props.setFloatValue("/input/js0/button0/repeatable", false);
+ props.setStringValue("/input/js0/button0/control", "/controls/brakes/all");
+ props.setDoubleValue("/input/js0/button0/step", 1.0);
+ props.setDoubleValue("/input/js0/button0/repeatable", false);
}
// Default button 1 to left brake.
if (!props.getValue("/input/js0/button1/control")) {
props.setStringValue("/input/js0/button1/action", "switch");
- props.setStringValue("/input/js0/button1/control", "/controls/left-brake");
- props.setFloatValue("/input/js0/button1/step", 1.0);
- props.setFloatValue("/input/js0/button1/repeatable", false);
+ props.setStringValue("/input/js0/button1/control",
+ "/controls/brakes/left");
+ props.setDoubleValue("/input/js0/button1/step", 1.0);
+ props.setDoubleValue("/input/js0/button1/repeatable", false);
}
// Default button 2 to right brake.
if (!props.getValue("/input/js0/button2/control")) {
props.setStringValue("/input/js0/button2/action", "switch");
props.setStringValue("/input/js0/button2/control",
- "/controls/right-brake");
- props.setFloatValue("/input/js0/button2/step", 1.0);
- props.setFloatValue("/input/js0/button2/repeatable", false);
+ "/controls/brakes/right");
+ props.setDoubleValue("/input/js0/button2/step", 1.0);
+ props.setDoubleValue("/input/js0/button2/repeatable", false);
}
// Default buttons 3 and 4 to elevator trim
props.setStringValue("/input/js0/button3/action", "adjust");
props.setStringValue("/input/js0/button3/control",
"/controls/elevator-trim");
- props.setFloatValue("/input/js0/button3/step", 0.001);
+ props.setDoubleValue("/input/js0/button3/step", 0.001);
props.setBoolValue("/input/js0/button3/repeatable", true);
}
if (!props.getValue("/input/js0/button4/control")) {
props.setStringValue("/input/js0/button4/action", "adjust");
props.setStringValue("/input/js0/button4/control",
"/controls/elevator-trim");
- props.setFloatValue("/input/js0/button4/step", -0.001);
+ props.setDoubleValue("/input/js0/button4/step", -0.001);
props.setBoolValue("/input/js0/button4/repeatable", true);
}
if (!props.getValue("/input/js0/button5/control")) {
props.setStringValue("/input/js0/button5/action", "adjust");
props.setStringValue("/input/js0/button5/control", "/controls/flaps");
- props.setFloatValue("/input/js0/button5/step", -0.34);
+ props.setDoubleValue("/input/js0/button5/step", -0.34);
props.setBoolValue("/input/js0/button5/repeatable", false);
}
if (!props.getValue("/input/js0/button6/control")) {
props.setStringValue("/input/js0/button6/action", "adjust");
props.setStringValue("/input/js0/button6/control", "/controls/flaps");
- props.setFloatValue("/input/js0/button6/step", 0.34);
+ props.setDoubleValue("/input/js0/button6/step", 0.34);
props.setBoolValue("/input/js0/button6/repeatable", false);
}
}
name += "/dead-band";
value = current_properties.getValue(name);
if (value != 0)
- js->setDeadBand(j, value->getFloatValue());
+ js->setDeadBand(j, value->getDoubleValue());
FG_LOG(FG_INPUT, FG_INFO, " dead-band is " << js->getDeadBand(j));
// Offset
name += "/offset";
value = current_properties.getValue(name);
if (value != 0)
- a.offset = value->getFloatValue();
+ a.offset = value->getDoubleValue();
FG_LOG(FG_INPUT, FG_INFO, " offset is " << a.offset);
name += "/factor";
value = current_properties.getValue(name);
if (value != 0)
- a.factor = value->getFloatValue();
+ a.factor = value->getDoubleValue();
FG_LOG(FG_INPUT, FG_INFO, " factor is " << a.factor);
name += "/tolerance";
value = current_properties.getValue(name);
if (value != 0)
- a.tolerance = value->getFloatValue();
+ a.tolerance = value->getDoubleValue();
FG_LOG(FG_INPUT, FG_INFO, " tolerance is " << a.tolerance);
name += "/saturation";
value = current_properties.getValue(name);
if (value != 0)
- js->setSaturation(j, value->getFloatValue());
+ js->setSaturation(j, value->getDoubleValue());
FG_LOG(FG_INPUT, FG_INFO, " saturation is " << js->getSaturation(j));
// Minimum range
name += "/min-range";
value = current_properties.getValue(name);
if (value != 0)
- minRange[j] = value->getFloatValue();
+ minRange[j] = value->getDoubleValue();
FG_LOG(FG_INPUT, FG_INFO, " min-range is " << minRange[j]);
// Maximum range
name += "/max-range";
value = current_properties.getValue(name);
if (value != 0)
- maxRange[j] = value->getFloatValue();
+ maxRange[j] = value->getDoubleValue();
FG_LOG(FG_INPUT, FG_INFO, " max-range is " << maxRange[j]);
// Center
name += "/center";
value = current_properties.getValue(name);
if (value != 0)
- center[j] = value->getFloatValue();
+ center[j] = value->getDoubleValue();
FG_LOG(FG_INPUT, FG_INFO, " center is " << center[j]);
}
name += "/step";
value = current_properties.getValue(name);
if (value != 0)
- b.step = value->getFloatValue();
+ b.step = value->getDoubleValue();
FG_LOG(FG_INPUT, FG_INFO, " step is " << b.step);
// Type
getThrottle, setThrottle);
current_properties.tieDouble("/controls/flaps",
getFlaps, setFlaps);
- current_properties.tieBool ("/controls/flaps/raise",
- 0, setFlapsRaise);
- current_properties.tieBool ("/controls/flaps/lower",
- 0, setFlapsLower);
current_properties.tieDouble("/controls/aileron",
getAileron, setAileron);
current_properties.tieDouble("/controls/rudder",
getElevator, setElevator);
current_properties.tieDouble("/controls/elevator-trim",
getElevatorTrim, setElevatorTrim);
+ current_properties.tieDouble("/controls/brakes/all",
+ getBrakes, setBrakes);
+ current_properties.tieDouble("/controls/brakes/left",
+ getLeftBrake, setLeftBrake);
+ current_properties.tieDouble("/controls/brakes/right",
+ getRightBrake, setRightBrake);
+ current_properties.tieDouble("/controls/brakes/Center",
+ getRightBrake, setCenterBrake);
+
+ // Deprecated...
current_properties.tieDouble("/controls/brake",
- getBrake, setBrake);
+ getBrakes, setBrakes);
current_properties.tieDouble("/controls/left-brake",
getLeftBrake, setLeftBrake);
current_properties.tieDouble("/controls/right-brake",
getAPAltitude, setAPAltitude);
current_properties.tieBool("/autopilot/locks/heading",
getAPHeadingLock, setAPHeadingLock);
+ current_properties.tieDouble("/autopilot/settings/heading",
+ getAPHeading, setAPHeading);
current_properties.tieDouble("/autopilot/settings/heading-magnetic",
getAPHeadingMag, setAPHeadingMag);
current_properties.tieBool("/autopilot/locks/nav1",
double throttle = getThrottle();
double elevator_trim = getElevatorTrim();
double flaps = getFlaps();
- double brake = getBrake();
+ double brake = getBrakes();
bool apHeadingLock = getAPHeadingLock();
double apHeadingMag = getAPHeadingMag();
bool apAltitudeLock = getAPAltitudeLock();
setThrottle(throttle);
setElevatorTrim(elevator_trim);
setFlaps(flaps);
- setBrake(brake);
+ setBrakes(brake);
setAPHeadingLock(apHeadingLock);
setAPHeadingMag(apHeadingMag);
setAPAltitudeLock(apAltitudeLock);
FGBFI::setAltitude (double altitude)
{
fgFDMForceAltitude(getFlightModel(), altitude * FEET_TO_METER);
-// current_options.set_altitude(altitude * FEET_TO_METER);
-// current_aircraft.fdm_state->set_Altitude(altitude);
+ current_options.set_altitude(altitude * FEET_TO_METER);
+ current_aircraft.fdm_state->set_Altitude(altitude);
// needReinit();
}
}
-void
-FGBFI::setFlapsRaise (bool step)
-{
- if (step)
- controls.set_flaps(controls.get_flaps() - 0.26);
- printf ( "Raise: %i\n", step );
-}
-
-
-void
-FGBFI::setFlapsLower (bool step)
-{
- if (step)
- controls.set_flaps(controls.get_flaps() + 0.26);
- printf ( "Lower: %i\n", step );
-}
-
-
/**
* Get the aileron, from -1.0 (left) to 1.0 (right).
*/
/**
- * Get the brake setting, from 0.0 (none) to 1.0 (full).
+ * Get the highest brake setting, from 0.0 (none) to 1.0 (full).
*/
double
-FGBFI::getBrake ()
+FGBFI::getBrakes ()
+{
+ double b1 = getCenterBrake();
+ double b2 = getLeftBrake();
+ double b3 = getRightBrake();
+ return (b1 > b2 ? (b1 > b3 ? b1 : b3) : (b2 > b3 ? b2 : b3));
+}
+
+
+/**
+ * Set all brakes, from 0.0 (none) to 1.0 (full).
+ */
+void
+FGBFI::setBrakes (double brake)
+{
+ setCenterBrake(brake);
+ setLeftBrake(brake);
+ setRightBrake(brake);
+}
+
+
+/**
+ * Get the center brake, from 0.0 (none) to 1.0 (full).
+ */
+double
+FGBFI::getCenterBrake ()
{
- // FIXME: add brake selector
return controls.get_brake(2);
}
/**
- * Set the brake, from 0.0 (none) to 1.0 (full).
+ * Set the center brake, from 0.0 (none) to 1.0 (full).
*/
void
-FGBFI::setBrake (double brake)
+FGBFI::setCenterBrake (double brake)
{
- controls.set_brake(FGControls::ALL_WHEELS, brake);
+ controls.set_brake(2, brake);
}
}
+/**
+ * Get the autopilot target heading in degrees.
+ */
+double
+FGBFI::getAPHeading ()
+{
+ return current_autopilot->get_TargetHeading();
+}
+
+
+/**
+ * Set the autopilot target heading in degrees.
+ */
+void
+FGBFI::setAPHeading (double heading)
+{
+ current_autopilot->set_TargetHeading( heading );
+}
+
+
/**
* Get the autopilot target heading in degrees.
*/
static double getRudder ();
static double getElevator ();
static double getElevatorTrim ();
- static double getBrake ();
+ static double getBrakes ();
static double getLeftBrake ();
static double getRightBrake ();
+ static double getCenterBrake ();
static void setThrottle (double throttle);
static void setFlaps (double flaps);
- static void setFlapsRaise (bool step);
- static void setFlapsLower (bool step);
static void setAileron (double aileron);
static void setRudder (double rudder);
static void setElevator (double elevator);
static void setElevatorTrim (double trim);
- static void setBrake (double brake);
+ static void setBrakes (double brake);
static void setLeftBrake (double brake);
static void setRightBrake (double brake);
+ static void setCenterBrake (double brake);
// Autopilot
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 ();
//
SAVE("elevator-trim", FGBFI::getElevatorTrim());
SAVE("flaps", FGBFI::getFlaps());
- // FIXME: save each brake separately
- SAVE("brake", FGBFI::getBrake());
+ SAVE("brake", FGBFI::getBrakes());
//
// Radio navigation
else if (text == "brake:") {
input >> n;
cout << "brake is " << n << endl;
- FGBFI::setBrake(n);
+ FGBFI::setBrakes(n);
}