+ def output_full_block_if_possible(self):
+ # For now, only output summary annotation if all values are available.
+ t = (self.sx, self.sy, self.ax, self.ay, self.az, self.bz, self.bc)
+ if -1 in t:
+ return
+
+ s = 'Analog stick X position: 0x%02x\n' % self.sx
+ s += 'Analog stick Y position: 0x%02x\n' % self.sy
+ s += 'Z button: %spressed\n' % ('' if (self.bz == 0) else 'not ')
+ s += 'C button: %spressed\n' % ('' if (self.bc == 0) else 'not ')
+ s += 'Accelerometer X value: 0x%03x\n' % self.ax
+ s += 'Accelerometer Y value: 0x%03x\n' % self.ay
+ s += 'Accelerometer Z value: 0x%03x\n' % self.az
+ self.put(self.block_start_sample, self.block_end_sample,
+ self.out_ann, [0, [s]])
+
+ s = 'SX = 0x%02x, SY = 0x%02x, AX = 0x%02x, AY = 0x%02x, ' \
+ 'AZ = 0x%02x, BZ = 0x%02x, BC = 0x%02x' % (self.sx, \
+ self.sy, self.ax, self.ay, self.az, self.bz, self.bc)
+ self.put(self.block_start_sample, self.block_end_sample,
+ self.out_ann, [1, [s]])
+