Move setup logging to the top

2.0.x
Scott Lahteine 5 years ago
parent 1c43870cec
commit d8b8d88276

@ -875,6 +875,19 @@ void stop() {
*/ */
void setup() { void setup() {
#if ENABLED(MARLIN_DEV_MODE)
auto log_current_ms = [&](PGM_P const msg) {
SERIAL_ECHO_START();
SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHO("] ");
serialprintPGM(msg);
SERIAL_EOL();
};
#define SETUP_LOG(M) log_current_ms(PSTR(M))
#else
#define SETUP_LOG(...) NOOP
#endif
#define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0)
HAL_init(); HAL_init();
#if HAS_L64XX #if HAS_L64XX
@ -939,12 +952,13 @@ void setup() {
#if HAS_TMC_SPI #if HAS_TMC_SPI
#if DISABLED(TMC_USE_SW_SPI) #if DISABLED(TMC_USE_SW_SPI)
SPI.begin(); SETUP_RUN(SPI.begin());
#endif #endif
tmc_init_cs_pins(); SETUP_RUN(tmc_init_cs_pins());
#endif #endif
#ifdef BOARD_INIT #ifdef BOARD_INIT
SETUP_LOG("BOARD_INIT");
BOARD_INIT(); BOARD_INIT();
#endif #endif
@ -977,19 +991,6 @@ void setup() {
// UI must be initialized before EEPROM // UI must be initialized before EEPROM
// (because EEPROM code calls the UI). // (because EEPROM code calls the UI).
#if ENABLED(MARLIN_DEV_MODE)
auto log_current_ms = [&](PGM_P const msg) {
SERIAL_ECHO_START();
SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHO("] ");
serialprintPGM(msg);
SERIAL_EOL();
};
#define SETUP_LOG(M) log_current_ms(PSTR(M))
#else
#define SETUP_LOG(...) NOOP
#endif
#define SETUP_RUN(C) do{ SETUP_LOG(STRINGIFY(C)); C; }while(0)
// Set up LEDs early // Set up LEDs early
#if HAS_COLOR_LEDS #if HAS_COLOR_LEDS
SETUP_RUN(leds.setup()); SETUP_RUN(leds.setup());

Loading…
Cancel
Save