From: Uwe Hermann Date: Fri, 21 Aug 2015 12:50:04 +0000 (+0200) Subject: nunchuk: Fix inverted button press logic. X-Git-Tag: libsigrokdecode-0.4.0~91 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=aac0ac249169a8774b30a2f3458a056ae2c80c63;p=libsigrokdecode.git nunchuk: Fix inverted button press logic. The buttons are pressed if the respective bit is 0. --- diff --git a/decoders/nunchuk/pd.py b/decoders/nunchuk/pd.py index afcf1de..0861cba 100644 --- a/decoders/nunchuk/pd.py +++ b/decoders/nunchuk/pd.py @@ -128,8 +128,8 @@ class Decoder(srd.Decoder): t = (self.sx, self.sy, self.ax, self.ay, self.az, self.bz, self.bc) if -1 in t: return - bz = 'pressed' if self.bz == 1 else 'not pressed' - bc = 'pressed' if self.bc == 1 else 'not pressed' + bz = 'pressed' if self.bz == 0 else 'not pressed' + bc = 'pressed' if self.bc == 0 else 'not pressed' s = 'Analog stick: %d/%d, accelerometer: %d/%d/%d, Z: %s, C: %s' % \ (self.sx, self.sy, self.ax, self.ay, self.az, bz, bc) self.putb([13, [s]])