diff --git a/Marlin/src/HAL/LPC1768/include/SPI.h b/Marlin/src/HAL/LPC1768/include/SPI.h index af085f29a90b..3bc0299b14d8 100644 --- a/Marlin/src/HAL/LPC1768/include/SPI.h +++ b/Marlin/src/HAL/LPC1768/include/SPI.h @@ -39,7 +39,7 @@ class SPISettings { class SPIClass { public: void begin(); - void beginTransaction(SPISettings); + void beginTransaction(const SPISettings&); void endTransaction() {}; uint8_t transfer(uint8_t data); uint16_t transfer16(uint16_t data); diff --git a/Marlin/src/HAL/STM32F1/SPI.cpp b/Marlin/src/HAL/STM32F1/SPI.cpp index 8eb8f9aa88c9..991ceb3148ee 100644 --- a/Marlin/src/HAL/STM32F1/SPI.cpp +++ b/Marlin/src/HAL/STM32F1/SPI.cpp @@ -243,7 +243,7 @@ void SPIClass::setDataMode(uint8_t dataMode) { _currentSetting->spi_d->regs->CR1 = cr1 | (dataMode & (SPI_CR1_CPOL|SPI_CR1_CPHA)); } -void SPIClass::beginTransaction(uint8_t pin, SPISettings settings) { +void SPIClass::beginTransaction(uint8_t pin, const SPISettings &settings) { setBitOrder(settings.bitOrder); setDataMode(settings.dataMode); setDataSize(settings.dataSize); @@ -251,7 +251,7 @@ void SPIClass::beginTransaction(uint8_t pin, SPISettings settings) { begin(); } -void SPIClass::beginTransactionSlave(SPISettings settings) { +void SPIClass::beginTransactionSlave(const SPISettings &settings) { setBitOrder(settings.bitOrder); setDataMode(settings.dataMode); setDataSize(settings.dataSize); @@ -266,7 +266,7 @@ void SPIClass::endTransaction() { } uint16_t SPIClass::read() { while (!spi_is_rx_nonempty(_currentSetting->spi_d)) { /* nada */ } - return (uint16)spi_rx_reg(_currentSetting->spi_d); + return (uint16_t)spi_rx_reg(_currentSetting->spi_d); } void SPIClass::read(uint8_t *buf, uint32_t len) { diff --git a/Marlin/src/HAL/STM32F1/SPI.h b/Marlin/src/HAL/STM32F1/SPI.h index 0162ac13bb17..dc2a21586560 100644 --- a/Marlin/src/HAL/STM32F1/SPI.h +++ b/Marlin/src/HAL/STM32F1/SPI.h @@ -126,6 +126,7 @@ class SPISettings { bitOrder = inBitOrder; dataMode = inDataMode; dataSize = inDataSize; + //state = SPI_STATE_IDLE; } uint32_t clock; uint32_t dataSize; @@ -187,11 +188,11 @@ class SPIClass { */ void end(); - void beginTransaction(SPISettings settings) { beginTransaction(BOARD_SPI_DEFAULT_SS, settings); } - void beginTransaction(uint8_t pin, SPISettings settings); + void beginTransaction(const SPISettings &settings) { beginTransaction(BOARD_SPI_DEFAULT_SS, settings); } + void beginTransaction(uint8_t pin, const SPISettings &settings); void endTransaction(); - void beginTransactionSlave(SPISettings settings); + void beginTransactionSlave(const SPISettings &settings); void setClockDivider(uint32_t clockDivider); void setBitOrder(BitOrder bitOrder); diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp index d5449f863e08..26ca8b2604e9 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp @@ -807,7 +807,7 @@ UnwResult UnwStartThumb(UnwState * const state) { case 2: /* MOV */ UnwPrintd5("MOV r%d, r%d\t; r%d %s", rhd, rhs, rhd, M_Origin2Str(state->regData[rhs].o)); state->regData[rhd].v = state->regData[rhs].v; - state->regData[rhd].o = state->regData[rhd].o; + state->regData[rhd].o = state->regData[rhs].o; break; case 3: /* BX */ diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 47b5f51d2c0f..6dc76947e54f 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -30,6 +30,14 @@ #include "MarlinCore.h" +#include "HAL/shared/Delay.h" +#include "HAL/shared/esp_wifi.h" + +#ifdef ARDUINO + #include +#endif +#include + #include "core/utility.h" #include "lcd/ultralcd.h" #include "module/motion.h" @@ -43,15 +51,8 @@ #include "module/printcounter.h" // PrintCounter or Stopwatch #include "feature/closedloop.h" -#include "HAL/shared/Delay.h" -#include "HAL/shared/esp_wifi.h" - #include "module/stepper/indirection.h" -#ifdef ARDUINO - #include -#endif -#include #include "libs/nozzle.h" #include "gcode/gcode.h" diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 812ff5471fab..7050caa1f072 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -245,10 +245,11 @@ extern uint8_t marlin_debug_flags; #define SERIAL_ECHOLIST(pre,V...) do{ SERIAL_ECHOPGM(pre); _SLST_N(NUM_ARGS(V),V); }while(0) #define SERIAL_ECHOLIST_N(N,V...) _SLST_N(N,LIST_N(N,V)) -#define SERIAL_ECHO_P(P) (serialprintPGM(P)) +#define SERIAL_ECHOPGM_P(P) (serialprintPGM(P)) +#define SERIAL_ECHOLNPGM_P(P) (serialprintPGM(P "\n")) -#define SERIAL_ECHOPGM(S) (SERIAL_ECHO_P(PSTR(S))) -#define SERIAL_ECHOLNPGM(S) (SERIAL_ECHO_P(PSTR(S "\n"))) +#define SERIAL_ECHOPGM(S) (serialprintPGM(PSTR(S))) +#define SERIAL_ECHOLNPGM(S) (serialprintPGM(PSTR(S "\n"))) #define SERIAL_ECHOPAIR_F_P(P,V...) do{ serialprintPGM(P); SERIAL_ECHO_F(V); }while(0) #define SERIAL_ECHOLNPAIR_F_P(V...) do{ SERIAL_ECHOPAIR_F_P(V); SERIAL_EOL(); }while(0) diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 72336f7cc1c6..df845c593c91 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -3224,31 +3224,33 @@ void MarlinSettings::reset() { #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) say_M906(forReplay); - #if AXIS_IS_TMC(X) - SERIAL_ECHOPAIR_P(SP_X_STR, stepperX.getMilliamps()); - #endif - #if AXIS_IS_TMC(Y) - SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY.getMilliamps()); - #endif - #if AXIS_IS_TMC(Z) - SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ.getMilliamps()); - #endif - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_P( + #if AXIS_IS_TMC(X) + SP_X_STR, stepperX.getMilliamps(), + #endif + #if AXIS_IS_TMC(Y) + SP_Y_STR, stepperY.getMilliamps(), + #endif + #if AXIS_IS_TMC(Z) + SP_Z_STR, stepperZ.getMilliamps() + #endif + ); #endif #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) say_M906(forReplay); SERIAL_ECHOPGM(" I1"); - #if AXIS_IS_TMC(X2) - SERIAL_ECHOPAIR_P(SP_X_STR, stepperX2.getMilliamps()); - #endif - #if AXIS_IS_TMC(Y2) - SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY2.getMilliamps()); - #endif - #if AXIS_IS_TMC(Z2) - SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ2.getMilliamps()); - #endif - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_P( + #if AXIS_IS_TMC(X2) + SP_X_STR, stepperX2.getMilliamps(), + #endif + #if AXIS_IS_TMC(Y2) + SP_Y_STR, stepperY2.getMilliamps(), + #endif + #if AXIS_IS_TMC(Z2) + SP_Z_STR, stepperZ2.getMilliamps() + #endif + ); #endif #if AXIS_IS_TMC(Z3) @@ -3451,9 +3453,9 @@ void MarlinSettings::reset() { if (chop_x || chop_y || chop_z) { say_M569(forReplay); - if (chop_x) SERIAL_ECHO_P(SP_X_STR); - if (chop_y) SERIAL_ECHO_P(SP_Y_STR); - if (chop_z) SERIAL_ECHO_P(SP_Z_STR); + if (chop_x) SERIAL_ECHOPGM_P(SP_X_STR); + if (chop_y) SERIAL_ECHOPGM_P(SP_Y_STR); + if (chop_z) SERIAL_ECHOPGM_P(SP_Z_STR); SERIAL_EOL(); } @@ -3475,9 +3477,9 @@ void MarlinSettings::reset() { if (chop_x2 || chop_y2 || chop_z2) { say_M569(forReplay, PSTR("I1")); - if (chop_x2) SERIAL_ECHO_P(SP_X_STR); - if (chop_y2) SERIAL_ECHO_P(SP_Y_STR); - if (chop_z2) SERIAL_ECHO_P(SP_Z_STR); + if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR); + if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR); + if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR); SERIAL_EOL(); }