Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Apply simplified ?:
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 17, 2023
1 parent 02178bd commit d399101
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/feature/tmc_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@
case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
case TMC_GLOBAL_SCALER:
{
uint16_t value = st.GLOBAL_SCALER();
SERIAL_ECHO(value ? value : 256);
const uint16_t value = st.GLOBAL_SCALER();
SERIAL_ECHO(value ?: 256);
SERIAL_ECHOPGM("/256");
}
break;
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,14 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
#endif
}
else {
write_byte(alt_label ? alt_label : 'X');
write_byte(alt_label ?: 'X');
write_str(dtostrf(pos.x, -4, 0, str), 4);

write_byte(alt_label ? alt_label : 'Y');
write_byte(alt_label ?: 'Y');
write_str(dtostrf(pos.y, -4, 0, str), 4);
}

write_byte(alt_label ? alt_label : 'Z');
write_byte(alt_label ?: 'Z');
write_str(dtostrf(pos.z, -5, 1, str), 5);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class CommandProcessor : public CLCD::CommandFifo {
}

inline CommandProcessor& set_button_style_callback(const btn_style_func_t *func) {
_btn_style_callback = func ? func : default_button_style_func;
_btn_style_callback = func ?: default_button_style_func;
return *this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace FTDI {
#endif

// Play the note
CLCD::mem_write_16(REG::SOUND, (note == REST) ? 0 : (((note ? note : NOTE_C4) << 8) | effect));
CLCD::mem_write_16(REG::SOUND, (note == REST) ? 0 : (((note ?: NOTE_C4) << 8) | effect));
CLCD::mem_write_8(REG::PLAY, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void DialogBoxBaseClass::drawMessage(T message, const int16_t font) {
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0);
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,6), message, OPT_CENTER, font ? font : font_large);
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,6), message, OPT_CENTER, font ?: font_large);
cmd.colors(normal_btn);
}

Expand Down

0 comments on commit d399101

Please sign in to comment.