David Megginson's changes:
src/Cockpit/radiostack.cxx - extended VOR ranges to make them slightly more usable (pending some real radio code) src/Cockpit/sp_panel.cxx - fixed heading bug on gyro compass (sort-of -- the AP still doesn't work quite as expected) - skid ball moves the right direction - moved whiskey compass more to the co-pilot's side, as suggested by Alex a while back src/Joystick/joystick.cxx - included Norm's Windows patches - renamed brake properties (see bfi.cxx, below) src/Main/bfi.cxx src/Main/bfi.hxx - renamed getBrake and setBrake to getBrakes and setBrakes - added getCenterBrake and setCenterBrake - added getAPHeading (without mag correction, needed for the panel) - renamed property /controls/brake to /controls/brakes/all - renamed property /controls/left-brake to /controls/brakes/left (as requested by Alex) - renamed property /controls/right-brake to /controls/brakes/right (as requested by Alex) - added property /controls/brakes/center - added property /autopilot/settings/heading - fixed bug in setAltitude so that altitude will be property restored from a save file - fixed getBrakes to return the highest of the three brake settings src/Main/save.cxx - call FGBFI::getBrakes instead of FGBFI::getBrake
This commit is contained in:
parent
3d96949058
commit
0c8c3ac0d6
6 changed files with 111 additions and 75 deletions
|
@ -37,7 +37,7 @@ kludgeRange (double stationElev, double aircraftElev, double nominalRange)
|
||||||
// Assume that the nominal range (usually
|
// Assume that the nominal range (usually
|
||||||
// 50nm) applies at a 5,000 ft difference.
|
// 50nm) applies at a 5,000 ft difference.
|
||||||
// Just a wild guess!
|
// 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);
|
double range = fabs(nominalRange * factor);
|
||||||
|
|
||||||
// Clamp the range to keep it sane; for
|
// Clamp the range to keep it sane; for
|
||||||
|
|
|
@ -403,7 +403,7 @@ struct InstrumentData
|
||||||
InstrumentData instruments[] =
|
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 MagRibbon(int(SIX_W*0.8), int(SIX_W*0.2))},
|
||||||
{new MyTexturedLayer("compassFront", SIX_W, SIX_W*(24.0/80.0))}
|
{new MyTexturedLayer("compassFront", SIX_W, SIX_W*(24.0/80.0))}
|
||||||
}},
|
}},
|
||||||
|
@ -465,7 +465,7 @@ InstrumentData instruments[] =
|
||||||
{new MyTexturedLayer("turnBall",
|
{new MyTexturedLayer("turnBall",
|
||||||
int(SIX_W * (4.0/64.0)), int(SIX_W * (4.0/64.0))), {
|
int(SIX_W * (4.0/64.0)), int(SIX_W * (4.0/64.0))), {
|
||||||
{TransData::Rotation, FGSteam::get_TC_rad,
|
{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}
|
{TransData::YShift, 0, 0.0, 0.0, 0.0, -(SIX_W/4)+4}
|
||||||
}}
|
}}
|
||||||
}},
|
}},
|
||||||
|
@ -558,8 +558,8 @@ InstrumentData instruments[] =
|
||||||
}},
|
}},
|
||||||
{new MyTexturedLayer("bug",
|
{new MyTexturedLayer("bug",
|
||||||
int(SIX_W*(4.0/64.0)), int(SIX_W*(4.0/64.0))), {
|
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, 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::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}
|
{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))},
|
{new MyTexturedLayer("compassCenter", int(SIX_W*0.625), int(SIX_W*0.625))},
|
||||||
|
@ -567,7 +567,7 @@ InstrumentData instruments[] =
|
||||||
int(SIX_W*(21.0/112.0)), int(SIX_W*(21.0/112.0))), {
|
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::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::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",
|
{new MyTexturedLayer("knob",
|
||||||
int(SIX_W*(22.0/112.0)), int(SIX_W*(22.0/112.0))), {
|
int(SIX_W*(22.0/112.0)), int(SIX_W*(22.0/112.0))), {
|
||||||
|
|
|
@ -132,20 +132,20 @@ setupDefaults ()
|
||||||
// Default axis 0 to aileron
|
// Default axis 0 to aileron
|
||||||
if (!props.getValue("/input/js0/axis0/control")) {
|
if (!props.getValue("/input/js0/axis0/control")) {
|
||||||
props.setStringValue("/input/js0/axis0/control", "/controls/aileron");
|
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
|
// Default axis 1 to elevator
|
||||||
if (!props.getValue("/input/js0/axis1/control")) {
|
if (!props.getValue("/input/js0/axis1/control")) {
|
||||||
props.setStringValue("/input/js0/axis1/control", "/controls/elevator");
|
props.setStringValue("/input/js0/axis1/control", "/controls/elevator");
|
||||||
props.setFloatValue("/input/js0/axis1/dead-band", 0.1);
|
props.setDoubleValue("/input/js0/axis1/dead-band", 0.1);
|
||||||
props.setFloatValue("/input/js0/axis1/factor", -1.0);
|
props.setDoubleValue("/input/js0/axis1/factor", -1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default axis 2 to rudder
|
// Default axis 2 to rudder
|
||||||
if (!props.getValue("/input/js0/axis2/control")) {
|
if (!props.getValue("/input/js0/axis2/control")) {
|
||||||
props.setStringValue("/input/js0/axis2/control", "/controls/rudder");
|
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
|
// Default axis 3 to throttle
|
||||||
|
@ -153,34 +153,35 @@ setupDefaults ()
|
||||||
// and factor to make it work
|
// and factor to make it work
|
||||||
if (!props.getValue("/input/js0/axis3/control")) {
|
if (!props.getValue("/input/js0/axis3/control")) {
|
||||||
props.setStringValue("/input/js0/axis3/control", "/controls/throttle");
|
props.setStringValue("/input/js0/axis3/control", "/controls/throttle");
|
||||||
props.setFloatValue("/input/js0/axis3/dead-band", 0.0);
|
props.setDoubleValue("/input/js0/axis3/dead-band", 0.0);
|
||||||
props.setFloatValue("/input/js0/axis3/offset", -1.0);
|
props.setDoubleValue("/input/js0/axis3/offset", -1.0);
|
||||||
props.setFloatValue("/input/js0/axis3/factor", -0.5);
|
props.setDoubleValue("/input/js0/axis3/factor", -0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default button 0 to all brakes
|
// Default button 0 to all brakes
|
||||||
if (!props.getValue("/input/js0/button0/control")) {
|
if (!props.getValue("/input/js0/button0/control")) {
|
||||||
props.setStringValue("/input/js0/button0/action", "switch");
|
props.setStringValue("/input/js0/button0/action", "switch");
|
||||||
props.setStringValue("/input/js0/button0/control", "/controls/brake");
|
props.setStringValue("/input/js0/button0/control", "/controls/brakes/all");
|
||||||
props.setFloatValue("/input/js0/button0/step", 1.0);
|
props.setDoubleValue("/input/js0/button0/step", 1.0);
|
||||||
props.setFloatValue("/input/js0/button0/repeatable", false);
|
props.setDoubleValue("/input/js0/button0/repeatable", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default button 1 to left brake.
|
// Default button 1 to left brake.
|
||||||
if (!props.getValue("/input/js0/button1/control")) {
|
if (!props.getValue("/input/js0/button1/control")) {
|
||||||
props.setStringValue("/input/js0/button1/action", "switch");
|
props.setStringValue("/input/js0/button1/action", "switch");
|
||||||
props.setStringValue("/input/js0/button1/control", "/controls/left-brake");
|
props.setStringValue("/input/js0/button1/control",
|
||||||
props.setFloatValue("/input/js0/button1/step", 1.0);
|
"/controls/brakes/left");
|
||||||
props.setFloatValue("/input/js0/button1/repeatable", false);
|
props.setDoubleValue("/input/js0/button1/step", 1.0);
|
||||||
|
props.setDoubleValue("/input/js0/button1/repeatable", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default button 2 to right brake.
|
// Default button 2 to right brake.
|
||||||
if (!props.getValue("/input/js0/button2/control")) {
|
if (!props.getValue("/input/js0/button2/control")) {
|
||||||
props.setStringValue("/input/js0/button2/action", "switch");
|
props.setStringValue("/input/js0/button2/action", "switch");
|
||||||
props.setStringValue("/input/js0/button2/control",
|
props.setStringValue("/input/js0/button2/control",
|
||||||
"/controls/right-brake");
|
"/controls/brakes/right");
|
||||||
props.setFloatValue("/input/js0/button2/step", 1.0);
|
props.setDoubleValue("/input/js0/button2/step", 1.0);
|
||||||
props.setFloatValue("/input/js0/button2/repeatable", false);
|
props.setDoubleValue("/input/js0/button2/repeatable", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default buttons 3 and 4 to elevator trim
|
// Default buttons 3 and 4 to elevator trim
|
||||||
|
@ -188,14 +189,14 @@ setupDefaults ()
|
||||||
props.setStringValue("/input/js0/button3/action", "adjust");
|
props.setStringValue("/input/js0/button3/action", "adjust");
|
||||||
props.setStringValue("/input/js0/button3/control",
|
props.setStringValue("/input/js0/button3/control",
|
||||||
"/controls/elevator-trim");
|
"/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);
|
props.setBoolValue("/input/js0/button3/repeatable", true);
|
||||||
}
|
}
|
||||||
if (!props.getValue("/input/js0/button4/control")) {
|
if (!props.getValue("/input/js0/button4/control")) {
|
||||||
props.setStringValue("/input/js0/button4/action", "adjust");
|
props.setStringValue("/input/js0/button4/action", "adjust");
|
||||||
props.setStringValue("/input/js0/button4/control",
|
props.setStringValue("/input/js0/button4/control",
|
||||||
"/controls/elevator-trim");
|
"/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);
|
props.setBoolValue("/input/js0/button4/repeatable", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,13 +204,13 @@ setupDefaults ()
|
||||||
if (!props.getValue("/input/js0/button5/control")) {
|
if (!props.getValue("/input/js0/button5/control")) {
|
||||||
props.setStringValue("/input/js0/button5/action", "adjust");
|
props.setStringValue("/input/js0/button5/action", "adjust");
|
||||||
props.setStringValue("/input/js0/button5/control", "/controls/flaps");
|
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);
|
props.setBoolValue("/input/js0/button5/repeatable", false);
|
||||||
}
|
}
|
||||||
if (!props.getValue("/input/js0/button6/control")) {
|
if (!props.getValue("/input/js0/button6/control")) {
|
||||||
props.setStringValue("/input/js0/button6/action", "adjust");
|
props.setStringValue("/input/js0/button6/action", "adjust");
|
||||||
props.setStringValue("/input/js0/button6/control", "/controls/flaps");
|
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);
|
props.setBoolValue("/input/js0/button6/repeatable", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +294,7 @@ fgJoystickInit()
|
||||||
name += "/dead-band";
|
name += "/dead-band";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
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));
|
FG_LOG(FG_INPUT, FG_INFO, " dead-band is " << js->getDeadBand(j));
|
||||||
|
|
||||||
// Offset
|
// Offset
|
||||||
|
@ -301,7 +302,7 @@ fgJoystickInit()
|
||||||
name += "/offset";
|
name += "/offset";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
a.offset = value->getFloatValue();
|
a.offset = value->getDoubleValue();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " offset is " << a.offset);
|
FG_LOG(FG_INPUT, FG_INFO, " offset is " << a.offset);
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,7 +311,7 @@ fgJoystickInit()
|
||||||
name += "/factor";
|
name += "/factor";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
a.factor = value->getFloatValue();
|
a.factor = value->getDoubleValue();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " factor is " << a.factor);
|
FG_LOG(FG_INPUT, FG_INFO, " factor is " << a.factor);
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,7 +320,7 @@ fgJoystickInit()
|
||||||
name += "/tolerance";
|
name += "/tolerance";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
a.tolerance = value->getFloatValue();
|
a.tolerance = value->getDoubleValue();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " tolerance is " << a.tolerance);
|
FG_LOG(FG_INPUT, FG_INFO, " tolerance is " << a.tolerance);
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,7 +329,7 @@ fgJoystickInit()
|
||||||
name += "/saturation";
|
name += "/saturation";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
js->setSaturation(j, value->getFloatValue());
|
js->setSaturation(j, value->getDoubleValue());
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " saturation is " << js->getSaturation(j));
|
FG_LOG(FG_INPUT, FG_INFO, " saturation is " << js->getSaturation(j));
|
||||||
|
|
||||||
// Minimum range
|
// Minimum range
|
||||||
|
@ -336,7 +337,7 @@ fgJoystickInit()
|
||||||
name += "/min-range";
|
name += "/min-range";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
minRange[j] = value->getFloatValue();
|
minRange[j] = value->getDoubleValue();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " min-range is " << minRange[j]);
|
FG_LOG(FG_INPUT, FG_INFO, " min-range is " << minRange[j]);
|
||||||
|
|
||||||
// Maximum range
|
// Maximum range
|
||||||
|
@ -344,7 +345,7 @@ fgJoystickInit()
|
||||||
name += "/max-range";
|
name += "/max-range";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
maxRange[j] = value->getFloatValue();
|
maxRange[j] = value->getDoubleValue();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " max-range is " << maxRange[j]);
|
FG_LOG(FG_INPUT, FG_INFO, " max-range is " << maxRange[j]);
|
||||||
|
|
||||||
// Center
|
// Center
|
||||||
|
@ -352,7 +353,7 @@ fgJoystickInit()
|
||||||
name += "/center";
|
name += "/center";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
center[j] = value->getFloatValue();
|
center[j] = value->getDoubleValue();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " center is " << center[j]);
|
FG_LOG(FG_INPUT, FG_INFO, " center is " << center[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +388,7 @@ fgJoystickInit()
|
||||||
name += "/step";
|
name += "/step";
|
||||||
value = current_properties.getValue(name);
|
value = current_properties.getValue(name);
|
||||||
if (value != 0)
|
if (value != 0)
|
||||||
b.step = value->getFloatValue();
|
b.step = value->getDoubleValue();
|
||||||
FG_LOG(FG_INPUT, FG_INFO, " step is " << b.step);
|
FG_LOG(FG_INPUT, FG_INFO, " step is " << b.step);
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
|
|
100
src/Main/bfi.cxx
100
src/Main/bfi.cxx
|
@ -139,10 +139,6 @@ FGBFI::init ()
|
||||||
getThrottle, setThrottle);
|
getThrottle, setThrottle);
|
||||||
current_properties.tieDouble("/controls/flaps",
|
current_properties.tieDouble("/controls/flaps",
|
||||||
getFlaps, setFlaps);
|
getFlaps, setFlaps);
|
||||||
current_properties.tieBool ("/controls/flaps/raise",
|
|
||||||
0, setFlapsRaise);
|
|
||||||
current_properties.tieBool ("/controls/flaps/lower",
|
|
||||||
0, setFlapsLower);
|
|
||||||
current_properties.tieDouble("/controls/aileron",
|
current_properties.tieDouble("/controls/aileron",
|
||||||
getAileron, setAileron);
|
getAileron, setAileron);
|
||||||
current_properties.tieDouble("/controls/rudder",
|
current_properties.tieDouble("/controls/rudder",
|
||||||
|
@ -151,8 +147,18 @@ FGBFI::init ()
|
||||||
getElevator, setElevator);
|
getElevator, setElevator);
|
||||||
current_properties.tieDouble("/controls/elevator-trim",
|
current_properties.tieDouble("/controls/elevator-trim",
|
||||||
getElevatorTrim, setElevatorTrim);
|
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",
|
current_properties.tieDouble("/controls/brake",
|
||||||
getBrake, setBrake);
|
getBrakes, setBrakes);
|
||||||
current_properties.tieDouble("/controls/left-brake",
|
current_properties.tieDouble("/controls/left-brake",
|
||||||
getLeftBrake, setLeftBrake);
|
getLeftBrake, setLeftBrake);
|
||||||
current_properties.tieDouble("/controls/right-brake",
|
current_properties.tieDouble("/controls/right-brake",
|
||||||
|
@ -165,6 +171,8 @@ FGBFI::init ()
|
||||||
getAPAltitude, setAPAltitude);
|
getAPAltitude, setAPAltitude);
|
||||||
current_properties.tieBool("/autopilot/locks/heading",
|
current_properties.tieBool("/autopilot/locks/heading",
|
||||||
getAPHeadingLock, setAPHeadingLock);
|
getAPHeadingLock, setAPHeadingLock);
|
||||||
|
current_properties.tieDouble("/autopilot/settings/heading",
|
||||||
|
getAPHeading, setAPHeading);
|
||||||
current_properties.tieDouble("/autopilot/settings/heading-magnetic",
|
current_properties.tieDouble("/autopilot/settings/heading-magnetic",
|
||||||
getAPHeadingMag, setAPHeadingMag);
|
getAPHeadingMag, setAPHeadingMag);
|
||||||
current_properties.tieBool("/autopilot/locks/nav1",
|
current_properties.tieBool("/autopilot/locks/nav1",
|
||||||
|
@ -258,7 +266,7 @@ FGBFI::reinit ()
|
||||||
double throttle = getThrottle();
|
double throttle = getThrottle();
|
||||||
double elevator_trim = getElevatorTrim();
|
double elevator_trim = getElevatorTrim();
|
||||||
double flaps = getFlaps();
|
double flaps = getFlaps();
|
||||||
double brake = getBrake();
|
double brake = getBrakes();
|
||||||
bool apHeadingLock = getAPHeadingLock();
|
bool apHeadingLock = getAPHeadingLock();
|
||||||
double apHeadingMag = getAPHeadingMag();
|
double apHeadingMag = getAPHeadingMag();
|
||||||
bool apAltitudeLock = getAPAltitudeLock();
|
bool apAltitudeLock = getAPAltitudeLock();
|
||||||
|
@ -291,7 +299,7 @@ FGBFI::reinit ()
|
||||||
setThrottle(throttle);
|
setThrottle(throttle);
|
||||||
setElevatorTrim(elevator_trim);
|
setElevatorTrim(elevator_trim);
|
||||||
setFlaps(flaps);
|
setFlaps(flaps);
|
||||||
setBrake(brake);
|
setBrakes(brake);
|
||||||
setAPHeadingLock(apHeadingLock);
|
setAPHeadingLock(apHeadingLock);
|
||||||
setAPHeadingMag(apHeadingMag);
|
setAPHeadingMag(apHeadingMag);
|
||||||
setAPAltitudeLock(apAltitudeLock);
|
setAPAltitudeLock(apAltitudeLock);
|
||||||
|
@ -528,8 +536,8 @@ void
|
||||||
FGBFI::setAltitude (double altitude)
|
FGBFI::setAltitude (double altitude)
|
||||||
{
|
{
|
||||||
fgFDMForceAltitude(getFlightModel(), altitude * FEET_TO_METER);
|
fgFDMForceAltitude(getFlightModel(), altitude * FEET_TO_METER);
|
||||||
// current_options.set_altitude(altitude * FEET_TO_METER);
|
current_options.set_altitude(altitude * FEET_TO_METER);
|
||||||
// current_aircraft.fdm_state->set_Altitude(altitude);
|
current_aircraft.fdm_state->set_Altitude(altitude);
|
||||||
// needReinit();
|
// needReinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,24 +791,6 @@ FGBFI::setFlaps (double flaps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 aileron, from -1.0 (left) to 1.0 (right).
|
||||||
*/
|
*/
|
||||||
|
@ -886,23 +876,47 @@ FGBFI::setElevatorTrim (double trim)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
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);
|
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
|
void
|
||||||
FGBFI::setBrake (double brake)
|
FGBFI::setCenterBrake (double brake)
|
||||||
{
|
{
|
||||||
controls.set_brake(FGControls::ALL_WHEELS, brake);
|
controls.set_brake(2, brake);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1029,6 +1043,26 @@ FGBFI::setAPHeadingLock (bool lock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Get the autopilot target heading in degrees.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -110,32 +110,34 @@ public:
|
||||||
static double getRudder ();
|
static double getRudder ();
|
||||||
static double getElevator ();
|
static double getElevator ();
|
||||||
static double getElevatorTrim ();
|
static double getElevatorTrim ();
|
||||||
static double getBrake ();
|
static double getBrakes ();
|
||||||
static double getLeftBrake ();
|
static double getLeftBrake ();
|
||||||
static double getRightBrake ();
|
static double getRightBrake ();
|
||||||
|
static double getCenterBrake ();
|
||||||
|
|
||||||
static void setThrottle (double throttle);
|
static void setThrottle (double throttle);
|
||||||
static void setFlaps (double flaps);
|
static void setFlaps (double flaps);
|
||||||
static void setFlapsRaise (bool step);
|
|
||||||
static void setFlapsLower (bool step);
|
|
||||||
static void setAileron (double aileron);
|
static void setAileron (double aileron);
|
||||||
static void setRudder (double rudder);
|
static void setRudder (double rudder);
|
||||||
static void setElevator (double elevator);
|
static void setElevator (double elevator);
|
||||||
static void setElevatorTrim (double trim);
|
static void setElevatorTrim (double trim);
|
||||||
static void setBrake (double brake);
|
static void setBrakes (double brake);
|
||||||
static void setLeftBrake (double brake);
|
static void setLeftBrake (double brake);
|
||||||
static void setRightBrake (double brake);
|
static void setRightBrake (double brake);
|
||||||
|
static void setCenterBrake (double brake);
|
||||||
|
|
||||||
|
|
||||||
// Autopilot
|
// Autopilot
|
||||||
static bool getAPAltitudeLock ();
|
static bool getAPAltitudeLock ();
|
||||||
static double getAPAltitude ();
|
static double getAPAltitude ();
|
||||||
static bool getAPHeadingLock ();
|
static bool getAPHeadingLock ();
|
||||||
|
static double getAPHeading ();
|
||||||
static double getAPHeadingMag ();
|
static double getAPHeadingMag ();
|
||||||
|
|
||||||
static void setAPAltitudeLock (bool lock);
|
static void setAPAltitudeLock (bool lock);
|
||||||
static void setAPAltitude (double altitude);
|
static void setAPAltitude (double altitude);
|
||||||
static void setAPHeadingLock (bool lock);
|
static void setAPHeadingLock (bool lock);
|
||||||
|
static void setAPHeading (double heading);
|
||||||
static void setAPHeadingMag (double heading);
|
static void setAPHeadingMag (double heading);
|
||||||
|
|
||||||
static bool getAPNAV1Lock ();
|
static bool getAPNAV1Lock ();
|
||||||
|
|
|
@ -104,8 +104,7 @@ fgSaveFlight (ostream &output)
|
||||||
//
|
//
|
||||||
SAVE("elevator-trim", FGBFI::getElevatorTrim());
|
SAVE("elevator-trim", FGBFI::getElevatorTrim());
|
||||||
SAVE("flaps", FGBFI::getFlaps());
|
SAVE("flaps", FGBFI::getFlaps());
|
||||||
// FIXME: save each brake separately
|
SAVE("brake", FGBFI::getBrakes());
|
||||||
SAVE("brake", FGBFI::getBrake());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Radio navigation
|
// Radio navigation
|
||||||
|
@ -323,7 +322,7 @@ fgLoadFlight (istream &input)
|
||||||
else if (text == "brake:") {
|
else if (text == "brake:") {
|
||||||
input >> n;
|
input >> n;
|
||||||
cout << "brake is " << n << endl;
|
cout << "brake is " << n << endl;
|
||||||
FGBFI::setBrake(n);
|
FGBFI::setBrakes(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue