Add support for speed brakes to plugin HandleCtrl function.

This commit is contained in:
Jason Watkins
2015-05-05 08:52:57 -07:00
parent 8f4d50929f
commit 3030f67a9d
3 changed files with 17 additions and 4 deletions

View File

@@ -169,7 +169,7 @@ namespace XPC
std::size_t size = msg.GetSize();
//Legacy packets that don't specify an aircraft number should be 26 bytes long.
//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
Log::FormatLine("[CTRL] ERROR: Unexpected message length (%i)", size);
@@ -185,10 +185,15 @@ namespace XPC
char gear = buffer[21];
float flaps = *((float*)(buffer + 22));
unsigned char aircraft = 0;
if (size == 27)
if (size >= 27)
{
aircraft = buffer[26];
}
float spdbrk = -998;
if (size >= 31)
{
spdbrk = *((float*)(buffer + 27));
}
float thrArray[8];
for (int i = 0; i < 8; ++i)
@@ -213,6 +218,10 @@ namespace XPC
{
DataManager::Set(DREF_FlapSetting, flaps, aircraft);
}
if (spdbrk < -999.5 || spdbrk > -997.5)
{
DataManager::Set(DREF_SpeedBrakeSet, spdbrk, aircraft);
}
}
void MessageHandlers::HandleData(Message& msg)