Skip to content

Commit

Permalink
Remove some static casts to make code nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin committed Nov 16, 2023
1 parent 2508afa commit 990842f
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,8 @@ static uint8_t getCurrentPosition(EndpointId endpoint)
// way of knowing the position of the barrier. Let's guess that the barrier is
// open so that we don't leave the barrier open when it should be closed.
uint8_t currentPositionFromAttribute = emAfPluginBarrierControlServerGetBarrierPosition(endpoint);
return ((currentPositionFromAttribute == BarrierControl::Position::kUnknown)
? static_cast<uint8_t>(BarrierControl::Position::kOpen)
: currentPositionFromAttribute);
return ((currentPositionFromAttribute == BarrierControl::Position::kUnknown) ? BarrierControl::Position::kOpen
: currentPositionFromAttribute);
}

static uint32_t calculateDelayMs(EndpointId endpoint, uint8_t targetPosition, bool * opening)
Expand Down Expand Up @@ -300,7 +299,7 @@ void emberAfBarrierControlClusterServerTickCallback(EndpointId endpoint)
emAfPluginBarrierControlServerSetBarrierPosition(endpoint,
(emAfPluginBarrierControlServerIsPartialBarrierSupported(endpoint)
? state.currentPosition
: static_cast<uint8_t>(BarrierControl::Position::kUnknown)));
: BarrierControl::Position::kUnknown));
setMovingState(endpoint,
(state.increasing ? BarrierControl::MovingState::kOpening : BarrierControl::MovingState::kClosing));

Expand Down

0 comments on commit 990842f

Please sign in to comment.