Skip to content

Commit

Permalink
fix cppcheck errors
Browse files Browse the repository at this point in the history
  • Loading branch information
k3kukua committed Jun 7, 2024
1 parent f9a4f98 commit c7c8583
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion firmware/keira/src/utils/combo/concurrent_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void ComboConcurrentButtons::loopAction(State& state) {
if (buttonStage.isReleased()) {
return;
}
_StateButtons& buttonStates = *reinterpret_cast<_StateButtons*>(&state);
const _StateButtons& buttonStates = *reinterpret_cast<const _StateButtons*>(&state);
switch (buttonStage.getStage()) {
case WAITING:
checkAllButtonsPressed(buttonStates);
Expand Down
4 changes: 2 additions & 2 deletions firmware/keira/src/utils/combo/one_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ void ComboOneButton::loopAction(State& state) {
if (buttonStage.isReleased()) {
return;
}
_StateButtons& buttonStates = *reinterpret_cast<_StateButtons*>(&state);
ButtonState& bs = buttonStates[buttonStage.getButton()];
const _StateButtons& buttonStates = *reinterpret_cast<const _StateButtons*>(&state);
const ButtonState& bs = buttonStates[buttonStage.getButton()];
switch (buttonStage.getStage()) {
case WAITING:
if (bs.justPressed) {
Expand Down
4 changes: 2 additions & 2 deletions firmware/keira/src/utils/combo/one_hold_down_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ void ComboOneHoldDownButton::loopAction(State& state) {
if (buttonStage.isReleased()) {
return;
}
_StateButtons& buttonStates = *reinterpret_cast<_StateButtons*>(&state);
const _StateButtons& buttonStates = *reinterpret_cast<const _StateButtons*>(&state);
if (checkNonTargetButtons && buttonStage.isPressed() && !isCompleted() &&
isNonTargetButtonPressed(buttonStage.getButton(), buttonStates)) {
resetAction();
onReset();
return;
}
ButtonState& bs = buttonStates[buttonStage.getButton()];
const ButtonState& bs = buttonStates[buttonStage.getButton()];
switch (buttonStage.getStage()) {
case WAITING:
if (bs.justPressed) {
Expand Down
4 changes: 2 additions & 2 deletions firmware/keira/src/utils/combo/sequence_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void ComboButtonSequence::loopAction(State& state) {
if (areAllButtonsProcessed()) {
return;
}
_StateButtons& buttonStates = *reinterpret_cast<_StateButtons*>(&state);
const _StateButtons& buttonStates = *reinterpret_cast<const _StateButtons*>(&state);
if (firstComboButtonAlreadyPressed && !isCompleted()) {
if (buttonStage.isWaiting() && isTimeout(buttonStage.getPrevReleaseTime()) ||
buttonStage.isPressed() && isTimeout(buttonStage.getPressTime()) ||
Expand All @@ -52,7 +52,7 @@ void ComboButtonSequence::loopAction(State& state) {
}
}

ButtonState& bs = buttonStates[buttonStage.getButton()];
const ButtonState& bs = buttonStates[buttonStage.getButton()];
switch (buttonStage.getStage()) {
case WAITING:
if (bs.justPressed) {
Expand Down

0 comments on commit c7c8583

Please sign in to comment.