Skip to content

Commit

Permalink
fix: assignment error and missing casts
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Hirschenberger committed May 21, 2024
1 parent 05681f4 commit abcf733
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/BlinkMarinePkpCanOpen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ Pkp::returnState_e Pkp::setKeyStateOverride(uint8_t keyIndex, int8_t overrideKey
Pkp::returnState_e Pkp::_decodeKeyStates(const uint8_t data[8]) {

for (int i = 0; i < PKP_MAX_KEY_AMOUNT; i++) {
_keyPressed[i] = checkBit(data[i > 7], i % 8);
_keyPressed[i] = checkBit(data[i > 7 ? 1 : 0], i % 8);
if (_lastKeyPressed[i] != _keyPressed[i]) {
if (_keyMode[i] == KEY_MODE_MOMENTARY) {
_keyState[i] = _keyPressed[i];
Expand All @@ -456,13 +456,11 @@ Pkp::returnState_e Pkp::_decodeKeyStates(const uint8_t data[8]) {
}
_lastKeyPressed[i] = _keyPressed[i];
}

if (_overrideKeyState[i] >= 0) {
_keyState[i] = _overrideKeyState;
_keyState[i] = (uint8_t)_overrideKeyState[i];
}
}


return _update(UT_KEY_LEDS);
}

Expand Down
2 changes: 1 addition & 1 deletion src/BlinkMarinePkpCanOpen.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ constexpr size_t PKP_MAX_WIRED_IN_AMOUNT = 4;
constexpr size_t PKP_MAX_ROTARY_ENCODER_AMOUNT = 2;

//Definition for message transmitting callback function(pointer)
typedef uint16_t (*CanMsgTxCallback)(const struct can_frame& txMsg);
typedef uint8_t (*CanMsgTxCallback)(const struct can_frame& txMsg);

//Class definitions
class Pkp {
Expand Down

0 comments on commit abcf733

Please sign in to comment.