omit sending hat if direction is not changed

This commit is contained in:
2020-12-31 20:42:28 +09:00
parent 8261199b9f
commit c3f1842b86

View File

@@ -36,6 +36,7 @@ struct arrow newestArrow;
#define ButtonInfoTableSize 9
struct ButtonInfo buttonInfoTable[ButtonInfoTableSize];
Hat last = Hat::CENTER;
void perms() {
if(val == 0){
@@ -103,7 +104,6 @@ void setup()
oldestArrow.arrowSymbol = Hat::CENTER;
newestArrow.older = &oldestArrow;
newestArrow.newer = NULL;
}
void handleButtonInput(ButtonInfo *but){
@@ -158,8 +158,10 @@ void loop()
arrowTable[i].prev = arrowTable[i].current;
}
SwitchControlLibrary().MoveHat(static_cast<uint8_t>(newestArrow.older->arrowSymbol));
if(newestArrow.older->arrowSymbol != last){
last = newestArrow.older->arrowSymbol;
SwitchControlLibrary().MoveHat(static_cast<uint8_t>(newestArrow.older->arrowSymbol));
}
}