From e9e95d988bad57ee724ece90d83a25569a453617 Mon Sep 17 00:00:00 2001 From: Jason Watkins Date: Tue, 5 May 2015 13:00:59 -0700 Subject: [PATCH] Added support for setting speed brakes to Python client --- Python/src/xplaneConnect.py | 9 ++++++--- TestScripts/Python Tests/Tests.py | 32 ++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Python/src/xplaneConnect.py b/Python/src/xplaneConnect.py index 9a38c82..5138d55 100644 --- a/Python/src/xplaneConnect.py +++ b/Python/src/xplaneConnect.py @@ -174,10 +174,11 @@ class XPlaneConnect(object): * Throttle [-1, 1] * Gear (0=up, 1=down) * Flaps [0, 1] + * Speedbrakes [-0.5, 1.5] ac: The aircraft to set the control surfaces of. 0 is the main/player aircraft. ''' # Preconditions - if len(values) < 1 or len(values) > 6: + if len(values) < 1 or len(values) > 7: raise ValueError("Must have between 0 and 6 items in values.") if ac < 0 or ac > 20: raise ValueError("Aircraft number must be between 0 and 20.") @@ -189,11 +190,13 @@ class XPlaneConnect(object): if i < len(values): val = values[i] if i == 4: - val = -1 if val == -998 else val - buffer += struct.pack("B", val) + val = -1 if (abs(val + 998) < 1e-4) else val + buffer += struct.pack("b", val) else: buffer += struct.pack("