From 755eef040f0f2d2e11ebd3bd4d619faa77e60960 Mon Sep 17 00:00:00 2001 From: Mark Mine Date: Mon, 27 Aug 2001 22:36:58 +0000 Subject: [PATCH] Optimized joybox and radamec code --- direct/src/directdevices/DirectDeviceManager.py | 2 +- direct/src/directdevices/DirectJoybox.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/direct/src/directdevices/DirectDeviceManager.py b/direct/src/directdevices/DirectDeviceManager.py index 2909e25abb..634ebbb32c 100644 --- a/direct/src/directdevices/DirectDeviceManager.py +++ b/direct/src/directdevices/DirectDeviceManager.py @@ -99,7 +99,7 @@ class DirectAnalogs(AnalogNode, PandaObject): def disable(self): self.nodePath.reparentTo(base.dataUnused) - def normalize(self, val, minVal = -1, maxVal = -1): + def normalize(self, val, minVal = -1, maxVal = 1): # First record sign if val < 0: sign = -1 diff --git a/direct/src/directdevices/DirectJoybox.py b/direct/src/directdevices/DirectJoybox.py index 0fe410bee3..ace0c72ab6 100644 --- a/direct/src/directdevices/DirectJoybox.py +++ b/direct/src/directdevices/DirectJoybox.py @@ -161,8 +161,7 @@ class DirectJoybox(PandaObject): val = max(val - ANALOG_DEADBAND, 0.0) # Now clamp value between minVal and maxVal val = CLAMP(val, ANALOG_MIN, ANALOG_MAX) - self.aList[chan] = (((maxVal - minVal) * ((val - ANALOG_MIN) / ANALOG_RANGE)) - + minVal) + self.aList[chan] = (2.0 * ((val - ANALOG_MIN) / ANALOG_RANGE)) - 1 # Update buttons for i in range(len(self.buttons)): try: