Add support for speed brakes to plugin HandleCtrl function.
This commit is contained in:
@@ -69,6 +69,9 @@ namespace XPC
|
|||||||
drefs.insert(make_pair(DREF_FlapSetting, XPLMFindDataRef("sim/flightmodel/controls/flaprqst")));
|
drefs.insert(make_pair(DREF_FlapSetting, XPLMFindDataRef("sim/flightmodel/controls/flaprqst")));
|
||||||
drefs.insert(make_pair(DREF_FlapActual, XPLMFindDataRef("sim/flightmodel/controls/flaprat")));
|
drefs.insert(make_pair(DREF_FlapActual, XPLMFindDataRef("sim/flightmodel/controls/flaprat")));
|
||||||
|
|
||||||
|
drefs.insert(make_pair(DREF_SpeedBrakeSet, XPLMFindDataRef("sim/flightmodel/controls/sbrkrqst")));
|
||||||
|
drefs.insert(make_pair(DREF_SpeedBrakeActual, XPLMFindDataRef("sim/flightmodel/controls/sbrkrat")));
|
||||||
|
|
||||||
drefs.insert(make_pair(DREF_GearDeploy, XPLMFindDataRef("sim/aircraft/parts/acf_gear_deploy")));
|
drefs.insert(make_pair(DREF_GearDeploy, XPLMFindDataRef("sim/aircraft/parts/acf_gear_deploy")));
|
||||||
drefs.insert(make_pair(DREF_GearHandle, XPLMFindDataRef("sim/cockpit/switches/gear_handle_status")));
|
drefs.insert(make_pair(DREF_GearHandle, XPLMFindDataRef("sim/cockpit/switches/gear_handle_status")));
|
||||||
drefs.insert(make_pair(DREF_BrakeParking, XPLMFindDataRef("sim/flightmodel/controls/parkbrakel")));
|
drefs.insert(make_pair(DREF_BrakeParking, XPLMFindDataRef("sim/flightmodel/controls/parkbrakel")));
|
||||||
@@ -169,7 +172,7 @@ namespace XPC
|
|||||||
sprintf(multi, "sim/multiplayer/position/plane%i_spoiler_ratio", i);
|
sprintf(multi, "sim/multiplayer/position/plane%i_spoiler_ratio", i);
|
||||||
mdrefs[i][DREF_Spoiler] = XPLMFindDataRef(multi);
|
mdrefs[i][DREF_Spoiler] = XPLMFindDataRef(multi);
|
||||||
sprintf(multi, "sim/multiplayer/position/plane%i_speedbrake_ratio", i);
|
sprintf(multi, "sim/multiplayer/position/plane%i_speedbrake_ratio", i);
|
||||||
mdrefs[i][DREF_BrakeSpeed] = XPLMFindDataRef(multi);
|
mdrefs[i][DREF_SpeedBrakeSet] = XPLMFindDataRef(multi);
|
||||||
sprintf(multi, "sim/multiplayer/position/plane%i_slat_ratio", i);
|
sprintf(multi, "sim/multiplayer/position/plane%i_slat_ratio", i);
|
||||||
mdrefs[i][DREF_Slats] = XPLMFindDataRef(multi);
|
mdrefs[i][DREF_Slats] = XPLMFindDataRef(multi);
|
||||||
sprintf(multi, "sim/multiplayer/position/plane%i_wing_sweep", i);
|
sprintf(multi, "sim/multiplayer/position/plane%i_wing_sweep", i);
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ namespace XPC
|
|||||||
// Multiplayer Aircraft
|
// Multiplayer Aircraft
|
||||||
DREF_FlapActual2,
|
DREF_FlapActual2,
|
||||||
DREF_Spoiler,
|
DREF_Spoiler,
|
||||||
DREF_BrakeSpeed,
|
DREF_SpeedBrakeSet,
|
||||||
|
DREF_SpeedBrakeActual,
|
||||||
DREF_Sweep,
|
DREF_Sweep,
|
||||||
DREF_Slats,
|
DREF_Slats,
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ namespace XPC
|
|||||||
std::size_t size = msg.GetSize();
|
std::size_t size = msg.GetSize();
|
||||||
//Legacy packets that don't specify an aircraft number should be 26 bytes long.
|
//Legacy packets that don't specify an aircraft number should be 26 bytes long.
|
||||||
//Packets specifying an A/C num should be 27 bytes.
|
//Packets specifying an A/C num should be 27 bytes.
|
||||||
if (size != 26 && size != 27)
|
if (size != 26 && size != 27 && size != 31)
|
||||||
{
|
{
|
||||||
#if LOG_VERBOSITY > 0
|
#if LOG_VERBOSITY > 0
|
||||||
Log::FormatLine("[CTRL] ERROR: Unexpected message length (%i)", size);
|
Log::FormatLine("[CTRL] ERROR: Unexpected message length (%i)", size);
|
||||||
@@ -185,10 +185,15 @@ namespace XPC
|
|||||||
char gear = buffer[21];
|
char gear = buffer[21];
|
||||||
float flaps = *((float*)(buffer + 22));
|
float flaps = *((float*)(buffer + 22));
|
||||||
unsigned char aircraft = 0;
|
unsigned char aircraft = 0;
|
||||||
if (size == 27)
|
if (size >= 27)
|
||||||
{
|
{
|
||||||
aircraft = buffer[26];
|
aircraft = buffer[26];
|
||||||
}
|
}
|
||||||
|
float spdbrk = -998;
|
||||||
|
if (size >= 31)
|
||||||
|
{
|
||||||
|
spdbrk = *((float*)(buffer + 27));
|
||||||
|
}
|
||||||
|
|
||||||
float thrArray[8];
|
float thrArray[8];
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
@@ -213,6 +218,10 @@ namespace XPC
|
|||||||
{
|
{
|
||||||
DataManager::Set(DREF_FlapSetting, flaps, aircraft);
|
DataManager::Set(DREF_FlapSetting, flaps, aircraft);
|
||||||
}
|
}
|
||||||
|
if (spdbrk < -999.5 || spdbrk > -997.5)
|
||||||
|
{
|
||||||
|
DataManager::Set(DREF_SpeedBrakeSet, spdbrk, aircraft);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageHandlers::HandleData(Message& msg)
|
void MessageHandlers::HandleData(Message& msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user