Apply TERN to compact code (#17619)

This commit is contained in:
Scott Lahteine
2020-04-22 16:35:03 -05:00
committed by GitHub
parent 88bdd26c99
commit 6d90d1e1f5
162 changed files with 1493 additions and 3530 deletions

View File

@ -211,11 +211,7 @@ void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause
// Nothing below here is compiled because NVIC_SystemReset loops forever
for (;;) {
#if ENABLED(USE_WATCHDOG)
watchdog_init();
#endif
}
for (;;) { TERN_(USE_WATCHDOG, watchdog_init()); }
}
extern "C" {

View File

@ -70,9 +70,7 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
void HAL_clear_reset_source(void) {
#if ENABLED(USE_WATCHDOG)
watchdog_clear_timeout_flag();
#endif
TERN_(USE_WATCHDOG, watchdog_clear_timeout_flag());
}
uint8_t HAL_get_reset_source(void) {

View File

@ -44,10 +44,9 @@ public:
MarlinSerial(LPC_UART_TypeDef *UARTx) :
HardwareSerial<RX_BUFFER_SIZE, TX_BUFFER_SIZE>(UARTx)
#if ENABLED(EMERGENCY_PARSER)
, emergency_state(EmergencyParser::State::EP_RESET)
, emergency_state(EmergencyParser::State::EP_RESET)
#endif
{
}
{ }
void end() {}

View File

@ -60,9 +60,7 @@ class libServo: public Servo {
if (attach(servo_info[servoIndex].Pin.nbr) >= 0) { // try to reattach
write(value);
safe_delay(servo_delay[servoIndex]); // delay to allow servo to reach position
#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
detach();
#endif
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
}
}