modify vr button log parse example

This commit is contained in:
yunfeibai
2017-05-10 15:33:58 -07:00
parent cfb8316297
commit c3e3e1e983

View File

@@ -93,11 +93,11 @@ for record in log:
for packedButtonIndex in range(firstPackedButtonIndex, firstPackedButtonIndex+numPackedButtons): for packedButtonIndex in range(firstPackedButtonIndex, firstPackedButtonIndex+numPackedButtons):
for packButtonShift in range(numGroupedButtons): for packButtonShift in range(numGroupedButtons):
buttonEvent = buttonMask & record[packedButtonIndex] buttonEvent = buttonMask & record[packedButtonIndex]
if buttonEvent == 1: if buttonEvent & 1:
buttonDownIndices.append(buttonIndex) buttonDownIndices.append(buttonIndex)
elif buttonEvent == 2: elif buttonEvent & 2:
buttonTriggeredIndices.append(buttonIndex) buttonTriggeredIndices.append(buttonIndex)
elif buttonEvent == 4: elif buttonEvent & 4:
buttonReleasedIndices.append(buttonIndex) buttonReleasedIndices.append(buttonIndex)
record[packedButtonIndex] = record[packedButtonIndex] >> 3 record[packedButtonIndex] = record[packedButtonIndex] >> 3
buttonIndex += 1 buttonIndex += 1