Skip to content

Commit b1ea331

Browse files
authored
Use memcmp to compare arrays
1 parent 8afbd83 commit b1ea331

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/Fightstick/Fightstick.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void loop()
124124
bleGamepad.setHats(hatValues[0], hatValues[1], hatValues[2], hatValues[3]);
125125

126126
// Update previous states to current states and send report
127-
if (currentButtonStates != previousButtonStates || currentHatStates != previousHatStates)
127+
if ((memcmp((const void *)currentButtonStates, (const void *)previousButtonStates, sizeof(currentButtonStates)) != 0) && (memcmp((const void *)currentHatStates, (const void *)previousHatStates, sizeof(currentHatStates)) != 0))
128128
{
129129
for (byte currentIndex = 0; currentIndex < numOfButtons; currentIndex++)
130130
{

0 commit comments

Comments
 (0)