Skip to content

Commit 6eab0dd

Browse files
D.R.racerDRracer
D.R.racer
authored andcommitted
Add parentheses - be more explicit in error codes' masking and comparison
1 parent 0aeb74e commit 6eab0dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Firmware/mmu2_error_converter.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ uint8_t PrusaErrorCodeIndex(uint16_t ec) {
8484
// Need to be placed before TMC-related errors in order to process couples of error bits between single ones
8585
// and to keep the code size down.
8686
if (ec & (uint16_t)ErrorCode::TMC_PULLEY_BIT) {
87-
if (ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
87+
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
8888
return FindErrorIndex(ERR_ELECTRICAL_PULLEY_SELFTEST_FAILED);
8989
} else if (ec & (uint16_t)ErrorCode::TMC_SELECTOR_BIT) {
90-
if (ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
90+
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
9191
return FindErrorIndex(ERR_ELECTRICAL_SELECTOR_SELFTEST_FAILED);
9292
} else if (ec & (uint16_t)ErrorCode::TMC_IDLER_BIT) {
93-
if (ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
93+
if ((ec & (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION) == (uint16_t)ErrorCode::MMU_SOLDERING_NEEDS_ATTENTION)
9494
return FindErrorIndex(ERR_ELECTRICAL_IDLER_SELFTEST_FAILED);
9595
}
9696

0 commit comments

Comments
 (0)