🧑‍💻 Apply simplified ?:

This commit is contained in:
Scott Lahteine 2023-04-14 18:09:16 -05:00
parent 92721d1bf7
commit 6d819eb8d4
5 changed files with 8 additions and 8 deletions

View file

@ -601,8 +601,8 @@
case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break; case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
case TMC_GLOBAL_SCALER: case TMC_GLOBAL_SCALER:
{ {
uint16_t value = st.GLOBAL_SCALER(); const uint16_t value = st.GLOBAL_SCALER();
SERIAL_ECHO(value ? value : 256); SERIAL_ECHO(value ?: 256);
SERIAL_ECHOPGM("/256"); SERIAL_ECHOPGM("/256");
} }
break; break;

View file

@ -629,14 +629,14 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
#endif #endif
} }
else { else {
write_byte(alt_label ? alt_label : 'X'); write_byte(alt_label ?: 'X');
write_str(dtostrf(pos.x, -4, 0, str), 4); 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_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); write_str(dtostrf(pos.z, -5, 1, str), 5);
} }

View file

@ -125,7 +125,7 @@ class CommandProcessor : public CLCD::CommandFifo {
} }
inline CommandProcessor& set_button_style_callback(const btn_style_func_t *func) { 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; return *this;
} }

View file

@ -41,7 +41,7 @@ namespace FTDI {
#endif #endif
// Play the note // 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); CLCD::mem_write_8(REG::PLAY, 1);
} }

View file

@ -39,7 +39,7 @@ void DialogBoxBaseClass::drawMessage(T message, const int16_t font) {
.cmd(CLEAR(true,true,true)) .cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled)) .cmd(COLOR_RGB(bg_text_enabled))
.tag(0); .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); cmd.colors(normal_btn);
} }