From b1ea33154657625c78ef76ce0133deec00c48a8b Mon Sep 17 00:00:00 2001 From: lemmingDev Date: Fri, 24 Jan 2025 17:33:01 +0900 Subject: [PATCH] Use memcmp to compare arrays --- examples/Fightstick/Fightstick.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Fightstick/Fightstick.ino b/examples/Fightstick/Fightstick.ino index c6736ec..3ca830e 100644 --- a/examples/Fightstick/Fightstick.ino +++ b/examples/Fightstick/Fightstick.ino @@ -124,7 +124,7 @@ void loop() bleGamepad.setHats(hatValues[0], hatValues[1], hatValues[2], hatValues[3]); // Update previous states to current states and send report - if (currentButtonStates != previousButtonStates || currentHatStates != previousHatStates) + if ((memcmp((const void *)currentButtonStates, (const void *)previousButtonStates, sizeof(currentButtonStates)) != 0) && (memcmp((const void *)currentHatStates, (const void *)previousHatStates, sizeof(currentHatStates)) != 0)) { for (byte currentIndex = 0; currentIndex < numOfButtons; currentIndex++) {