🎨 Misc. 'else' cleanup
This commit is contained in:
parent
750a8dbe7f
commit
ff1ecb00cc
|
@ -372,9 +372,9 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
|
||||||
if (MemoryIncrease == DMA_PINC_ENABLE) {
|
if (MemoryIncrease == DMA_PINC_ENABLE) {
|
||||||
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
|
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
|
||||||
Data += width * height;
|
Data += width * height;
|
||||||
} else {
|
|
||||||
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
|
||||||
y_cur += height;
|
y_cur += height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,14 +143,16 @@ namespace DirectStepping {
|
||||||
// special case for 8-bit, check if rolled back to 0
|
// special case for 8-bit, check if rolled back to 0
|
||||||
if (Cfg::DIRECTIONAL || !write_page_size) { // full 256 bytes
|
if (Cfg::DIRECTIONAL || !write_page_size) { // full 256 bytes
|
||||||
if (write_byte_idx) return true;
|
if (write_byte_idx) return true;
|
||||||
} else {
|
|
||||||
if (write_byte_idx < write_page_size) return true;
|
|
||||||
}
|
}
|
||||||
} else if (Cfg::DIRECTIONAL) {
|
else if (write_byte_idx < write_page_size)
|
||||||
if (write_byte_idx != Cfg::PAGE_SIZE) return true;
|
return true;
|
||||||
} else {
|
|
||||||
if (write_byte_idx < write_page_size) return true;
|
|
||||||
}
|
}
|
||||||
|
else if (Cfg::DIRECTIONAL) {
|
||||||
|
if (write_byte_idx != Cfg::PAGE_SIZE)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (write_byte_idx < write_page_size)
|
||||||
|
return true;
|
||||||
|
|
||||||
state = State::CHECKSUM;
|
state = State::CHECKSUM;
|
||||||
return true;
|
return true;
|
||||||
|
@ -161,11 +163,10 @@ namespace DirectStepping {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case State::UNFAIL:
|
case State::UNFAIL:
|
||||||
if (c == 0) {
|
if (c == 0)
|
||||||
set_page_state(write_page_idx, PageState::FREE);
|
set_page_state(write_page_idx, PageState::FREE);
|
||||||
} else {
|
else
|
||||||
fatal_error = true;
|
fatal_error = true;
|
||||||
}
|
|
||||||
state = State::MONITOR;
|
state = State::MONITOR;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,9 +171,9 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
|
||||||
|
|
||||||
const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10;
|
const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10;
|
||||||
|
|
||||||
if (mydata.t_tag && !t_ok) {
|
if (mydata.t_tag && !t_ok)
|
||||||
cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING));
|
cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING));
|
||||||
} else if (getActualTemp_celsius(e) > 100) {
|
else if (getActualTemp_celsius(e) > 100) {
|
||||||
cmd.cmd(COLOR_RGB(0xFF0000))
|
cmd.cmd(COLOR_RGB(0xFF0000))
|
||||||
.text(CAUTION_LBL_POS, GET_TEXT_F(MSG_CAUTION))
|
.text(CAUTION_LBL_POS, GET_TEXT_F(MSG_CAUTION))
|
||||||
.colors(normal_btn)
|
.colors(normal_btn)
|
||||||
|
|
|
@ -111,16 +111,17 @@ void FilesScreen::drawFileButton(int x, int y, int w, int h, const char *filenam
|
||||||
cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color));
|
cmd.cmd(COLOR_RGB(is_highlighted ? fg_action : bg_color));
|
||||||
cmd.font(font_medium).rectangle(bx, by, bw, bh);
|
cmd.font(font_medium).rectangle(bx, by, bw, bh);
|
||||||
cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled));
|
cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled));
|
||||||
#if ENABLED(SCROLL_LONG_FILENAMES)
|
if (TERN0(SCROLL_LONG_FILENAMES, is_highlighted)) {
|
||||||
if (is_highlighted) {
|
#if ENABLED(SCROLL_LONG_FILENAMES)
|
||||||
cmd.cmd(SAVE_CONTEXT());
|
cmd.cmd(SAVE_CONTEXT());
|
||||||
cmd.cmd(SCISSOR_XY(x,y));
|
cmd.cmd(SCISSOR_XY(x,y));
|
||||||
cmd.cmd(SCISSOR_SIZE(w,h));
|
cmd.cmd(SCISSOR_SIZE(w,h));
|
||||||
cmd.cmd(MACRO(0));
|
cmd.cmd(MACRO(0));
|
||||||
cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
|
cmd.text(bx, by, bw, bh, filename, OPT_CENTERY | OPT_NOFIT);
|
||||||
} else
|
#endif
|
||||||
#endif
|
}
|
||||||
draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
|
else
|
||||||
|
draw_text_with_ellipsis(cmd, bx,by, bw - (is_dir ? 20 : 0), bh, filename, OPT_CENTERY, font_medium);
|
||||||
if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX);
|
if (is_dir && !is_highlighted) cmd.text(bx, by, bw, bh, F("> "), OPT_CENTERY | OPT_RIGHTX);
|
||||||
#if ENABLED(SCROLL_LONG_FILENAMES)
|
#if ENABLED(SCROLL_LONG_FILENAMES)
|
||||||
if (is_highlighted) cmd.cmd(RESTORE_CONTEXT());
|
if (is_highlighted) cmd.cmd(RESTORE_CONTEXT());
|
||||||
|
|
|
@ -53,42 +53,45 @@ void WifiSerial::init(PinName _rx, PinName _tx) {
|
||||||
WifiSerial::WifiSerial(void *peripheral) {
|
WifiSerial::WifiSerial(void *peripheral) {
|
||||||
// If PIN_SERIALy_RX is not defined assume half-duplex
|
// If PIN_SERIALy_RX is not defined assume half-duplex
|
||||||
_serial.pin_rx = NC;
|
_serial.pin_rx = NC;
|
||||||
|
if (false) {
|
||||||
|
// for else if / else below...
|
||||||
|
}
|
||||||
// If Serial is defined in variant set
|
// If Serial is defined in variant set
|
||||||
// the Rx/Tx pins for com port if defined
|
// the Rx/Tx pins for com port if defined
|
||||||
#if defined(Serial) && defined(PIN_SERIAL_TX)
|
#if defined(Serial) && defined(PIN_SERIAL_TX)
|
||||||
if ((void *)this == (void *)&Serial) {
|
else if ((void *)this == (void *)&Serial) {
|
||||||
#ifdef PIN_SERIAL_RX
|
#ifdef PIN_SERIAL_RX
|
||||||
setRx(PIN_SERIAL_RX);
|
setRx(PIN_SERIAL_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL_TX);
|
setTx(PIN_SERIAL_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_SERIAL1_TX) && defined(USART1_BASE)
|
#if defined(PIN_SERIAL1_TX) && defined(USART1_BASE)
|
||||||
if (peripheral == USART1) {
|
else if (peripheral == USART1) {
|
||||||
#ifdef PIN_SERIAL1_RX
|
#ifdef PIN_SERIAL1_RX
|
||||||
setRx(PIN_SERIAL1_RX);
|
setRx(PIN_SERIAL1_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL1_TX);
|
setTx(PIN_SERIAL1_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_SERIAL2_TX) && defined(USART2_BASE)
|
#if defined(PIN_SERIAL2_TX) && defined(USART2_BASE)
|
||||||
if (peripheral == USART2) {
|
else if (peripheral == USART2) {
|
||||||
#ifdef PIN_SERIAL2_RX
|
#ifdef PIN_SERIAL2_RX
|
||||||
setRx(PIN_SERIAL2_RX);
|
setRx(PIN_SERIAL2_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL2_TX);
|
setTx(PIN_SERIAL2_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_SERIAL3_TX) && defined(USART3_BASE)
|
#if defined(PIN_SERIAL3_TX) && defined(USART3_BASE)
|
||||||
if (peripheral == USART3) {
|
else if (peripheral == USART3) {
|
||||||
#ifdef PIN_SERIAL3_RX
|
#ifdef PIN_SERIAL3_RX
|
||||||
setRx(PIN_SERIAL3_RX);
|
setRx(PIN_SERIAL3_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL3_TX);
|
setTx(PIN_SERIAL3_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_SERIAL4_TX
|
#ifdef PIN_SERIAL4_TX
|
||||||
if (false
|
else if (false
|
||||||
#ifdef USART4_BASE
|
#ifdef USART4_BASE
|
||||||
|| peripheral == USART4
|
|| peripheral == USART4
|
||||||
#elif defined(UART4_BASE)
|
#elif defined(UART4_BASE)
|
||||||
|
@ -99,10 +102,10 @@ WifiSerial::WifiSerial(void *peripheral) {
|
||||||
setRx(PIN_SERIAL4_RX);
|
setRx(PIN_SERIAL4_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL4_TX);
|
setTx(PIN_SERIAL4_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_SERIAL5_TX
|
#ifdef PIN_SERIAL5_TX
|
||||||
if (false
|
else if (false
|
||||||
#ifdef USART5_BASE
|
#ifdef USART5_BASE
|
||||||
|| peripheral == USART5
|
|| peripheral == USART5
|
||||||
#elif defined(UART5_BASE)
|
#elif defined(UART5_BASE)
|
||||||
|
@ -113,18 +116,18 @@ WifiSerial::WifiSerial(void *peripheral) {
|
||||||
setRx(PIN_SERIAL5_RX);
|
setRx(PIN_SERIAL5_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL5_TX);
|
setTx(PIN_SERIAL5_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_SERIAL6_TX) && defined(USART6_BASE)
|
#if defined(PIN_SERIAL6_TX) && defined(USART6_BASE)
|
||||||
if (peripheral == USART6) {
|
else if (peripheral == USART6) {
|
||||||
#ifdef PIN_SERIAL6_RX
|
#ifdef PIN_SERIAL6_RX
|
||||||
setRx(PIN_SERIAL6_RX);
|
setRx(PIN_SERIAL6_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL6_TX);
|
setTx(PIN_SERIAL6_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_SERIAL7_TX
|
#ifdef PIN_SERIAL7_TX
|
||||||
if (false
|
else if (false
|
||||||
#ifdef USART7_BASE
|
#ifdef USART7_BASE
|
||||||
|| peripheral == USART7
|
|| peripheral == USART7
|
||||||
#elif defined(UART7_BASE)
|
#elif defined(UART7_BASE)
|
||||||
|
@ -135,10 +138,10 @@ WifiSerial::WifiSerial(void *peripheral) {
|
||||||
setRx(PIN_SERIAL7_RX);
|
setRx(PIN_SERIAL7_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL7_TX);
|
setTx(PIN_SERIAL7_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_SERIAL8_TX
|
#ifdef PIN_SERIAL8_TX
|
||||||
if (false
|
else if (false
|
||||||
#ifdef USART8_BASE
|
#ifdef USART8_BASE
|
||||||
|| peripheral == USART8
|
|| peripheral == USART8
|
||||||
#elif defined(UART8_BASE)
|
#elif defined(UART8_BASE)
|
||||||
|
@ -149,18 +152,18 @@ WifiSerial::WifiSerial(void *peripheral) {
|
||||||
setRx(PIN_SERIAL8_RX);
|
setRx(PIN_SERIAL8_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL8_TX);
|
setTx(PIN_SERIAL8_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_SERIAL9_TX) && defined(UART9_BASE)
|
#if defined(PIN_SERIAL9_TX) && defined(UART9_BASE)
|
||||||
if (peripheral == UART9) {
|
else if (peripheral == UART9) {
|
||||||
#ifdef PIN_SERIAL9_RX
|
#ifdef PIN_SERIAL9_RX
|
||||||
setRx(PIN_SERIAL9_RX);
|
setRx(PIN_SERIAL9_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL9_TX);
|
setTx(PIN_SERIAL9_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef PIN_SERIAL10_TX
|
#ifdef PIN_SERIAL10_TX
|
||||||
if (false
|
else if (false
|
||||||
#ifdef USART10_BASE
|
#ifdef USART10_BASE
|
||||||
|| peripheral == USART10
|
|| peripheral == USART10
|
||||||
#elif defined(UART10_BASE)
|
#elif defined(UART10_BASE)
|
||||||
|
@ -171,18 +174,18 @@ WifiSerial::WifiSerial(void *peripheral) {
|
||||||
setRx(PIN_SERIAL10_RX);
|
setRx(PIN_SERIAL10_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIAL10_TX);
|
setTx(PIN_SERIAL10_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PIN_SERIALLP1_TX) && defined(LPUART1_BASE)
|
#if defined(PIN_SERIALLP1_TX) && defined(LPUART1_BASE)
|
||||||
if (peripheral == LPUART1) {
|
else if (peripheral == LPUART1) {
|
||||||
#ifdef PIN_SERIALLP1_RX
|
#ifdef PIN_SERIALLP1_RX
|
||||||
setRx(PIN_SERIALLP1_RX);
|
setRx(PIN_SERIALLP1_RX);
|
||||||
#endif
|
#endif
|
||||||
setTx(PIN_SERIALLP1_TX);
|
setTx(PIN_SERIALLP1_TX);
|
||||||
} else
|
}
|
||||||
#endif
|
#endif
|
||||||
// else get the pins of the first peripheral occurrence in PinMap
|
// else get the pins of the first peripheral occurrence in PinMap
|
||||||
{
|
else {
|
||||||
_serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
|
_serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
|
||||||
_serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
|
_serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue