Skip to content

Commit

Permalink
🎨 Misc. cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and Andy-Big committed Jul 11, 2023
1 parent e83d8ad commit 6dd77df
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/LPC1768/tft/tft_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TFT_SPI {
static bool isBusy();
static void Abort();

static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT);
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
static void DataTransferAbort();

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TFT_SPI {
static bool isBusy();
static void Abort();

static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT);
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd();
static void DataTransferAbort();

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/tft/tft_fsmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void TFT_FSMC::Init() {
Timing.DataLatency = 17;
Timing.AccessMode = FSMC_ACCESS_MODE_A;
// Write Timing
// Can be decreases from 8-15-8 to 0-0-1 with risk of stability loss
// Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss
ExtTiming.AddressSetupTime = 8;
ExtTiming.AddressHoldTime = 15;
ExtTiming.DataSetupTime = 8;
Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/HAL/STM32/tft/tft_fsmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
#endif

#ifndef HAL_SRAM_MODULE_ENABLED
#error "SRAM module disabled for the STM32 framework (HAL_SRAM_MODULE_ENABLED)! Please consult the development team."
#endif

#ifndef LCD_READ_ID
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
#endif
Expand Down Expand Up @@ -69,8 +73,8 @@ class TFT_FSMC {
static bool isBusy();
static void Abort();

static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {}
static void DataTransferEnd() {};
static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {}
static void DataTransferEnd() {}

static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); }
static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/tft/tft_ltdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TFT_LTDC {
static bool isBusy();
static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ }

static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {}
static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {}
static void DataTransferEnd() {};

static void WriteData(uint16_t Data);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/tft/tft_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TFT_SPI {
static bool isBusy();
static void Abort();

static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT);
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); };
static void DataTransferAbort();

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32F1/MarlinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb
// Not every MarlinSerial port should handle emergency parsing.
// It would not make sense to parse GCode from TMC responses, for example.
constexpr bool serial_handles_emergency(int port) {
return false
return (false
#ifdef SERIAL_PORT
|| (SERIAL_PORT) == port
#endif
Expand All @@ -87,7 +87,7 @@ constexpr bool serial_handles_emergency(int port) {
#ifdef LCD_SERIAL_PORT
|| (LCD_SERIAL_PORT) == port
#endif
;
);
}

#define DEFINE_HWSERIAL_MARLIN(name, n) \
Expand Down
9 changes: 7 additions & 2 deletions Marlin/src/HAL/STM32F1/sdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,13 @@ bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
}

bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
uint32_t retries = SDIO_READ_RETRIES;
while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
uint8_t retries = SDIO_READ_RETRIES;
while (retries--) {
if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
#if SD_RETRY_DELAY_MS
delay(SD_RETRY_DELAY_MS);
#endif
}
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*
*/

#ifdef __STM32F1__

#include "../../../inc/MarlinConfig.h"

#if HAS_FSMC_TFT
Expand Down Expand Up @@ -262,3 +264,5 @@ void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count)
}

#endif // HAS_FSMC_TFT

#endif // __STM32F1__
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/tft/tft_fsmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TFT_FSMC {
static bool isBusy();
static void Abort();

static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT) {};
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) {};
static void DataTransferEnd() {};

static void WriteData(uint16_t Data) { Transmit(Data); }
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/HAL/STM32F1/tft/tft_spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*
*/

#ifdef __STM32F1__

#include "../../../inc/MarlinConfig.h"

#if HAS_SPI_TFT
Expand Down Expand Up @@ -165,3 +167,5 @@ void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count)
}

#endif // HAS_SPI_TFT

#endif // __STM32F1__
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/tft/tft_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TFT_SPI {
static bool isBusy();
static void Abort();

static void DataTransferBegin(uint16_t DataWidth = DATA_SIZE_16BIT);
static void DataTransferBegin(uint16_t DataWidth=DATA_SIZE_16BIT);
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); };
static void DataTransferAbort();

Expand Down
6 changes: 5 additions & 1 deletion Marlin/src/HAL/STM32F1/tft/xpt2046.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*
*/

#ifdef __STM32F1__

#include "../../../inc/MarlinConfig.h"

#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
Expand Down Expand Up @@ -141,4 +143,6 @@ uint16_t XPT2046::SoftwareIO(uint16_t data) {
return result;
}

#endif // HAS_TFT_XPT2046
#endif // HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS

#endif // __STM32F1__
1 change: 0 additions & 1 deletion Marlin/src/feature/mmu/mmu2-serial-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,3 @@ Eject filament

- MMU <= 'E*Filament index*\n'
- MMU => 'ok\n'

2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft_io/st7789v.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static const uint16_t st7789v_init[] = {

/**
* LCM Control
*
*
* Default Power-on Value: 0x2C / 00101100b
* MY Inversion: 0
* RGB/BGR Inversion: 1
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/tft_io/tft_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TFT_IO {
inline static void Abort() { io.Abort(); }
inline static uint32_t GetID() { return io.GetID(); }

inline static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT) { io.DataTransferBegin(DataWidth); }
inline static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) { io.DataTransferBegin(DataWidth); }
inline static void DataTransferEnd() { io.DataTransferEnd(); }

inline static void WriteData(uint16_t Data) { io.WriteData(Data); }
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ void Endstops::update() {
#endif
)) { SBI(live_state, X_ENDSTOP); hit = true; }
#if ENABLED(X_DUAL_ENDSTOPS)
if (tmc_spi_homing.x && stepperX2.test_stall_status()) { SBI(live_state, X2_ENDSTOP); hit = true; }
if (tmc_spi_homing.x && stepperX2.test_stall_status()) { SBI(live_state, X2_ENDSTOP); hit = true; }
#endif
#endif
#if Y_SPI_SENSORLESS
Expand All @@ -1157,7 +1157,7 @@ void Endstops::update() {
#endif
)) { SBI(live_state, Y_ENDSTOP); hit = true; }
#if ENABLED(Y_DUAL_ENDSTOPS)
if (tmc_spi_homing.y && stepperY2.test_stall_status()) { SBI(live_state, Y2_ENDSTOP); hit = true; }
if (tmc_spi_homing.y && stepperY2.test_stall_status()) { SBI(live_state, Y2_ENDSTOP); hit = true; }
#endif
#endif
#if Z_SPI_SENSORLESS
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/endstops.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ enum EndstopEnum : char {
#if HAS_X_MIN || HAS_X_MAX
, X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN)
#if ENABLED(X_DUAL_ENDSTOPS)
, X2_ENDSTOP = TERN(X_HOME_TO_MAX, X2_MAX, X2_MIN)
, X2_ENDSTOP = TERN(X_HOME_TO_MAX, X2_MAX, X2_MIN)
#endif
#endif
#if HAS_Y_MIN || HAS_Y_MAX
Expand Down
1 change: 0 additions & 1 deletion Marlin/src/module/tool_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
}
}


#endif // TOOL_SENSOR

#if ENABLED(SWITCHING_TOOLHEAD)
Expand Down
8 changes: 3 additions & 5 deletions Marlin/src/pins/ramps/pins_VORON.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@

#define BOARD_INFO_NAME "VORON Design v2"

#define MOSFET_C_PIN 11

#include "pins_RAMPS.h"

//
// Heaters / Fans
//
#undef FAN0_PIN
#define MOSFET_C_PIN 11
#define FAN0_PIN 5 // Using the pin for the controller fan since controller fan is always on.
#define CONTROLLER_FAN_PIN 8

Expand All @@ -50,6 +46,8 @@
#define E1_AUTO_FAN_PIN 6 // Servo pin 6 for E3D Fan (same pin for both extruders since it's the same fan)
#endif

#include "pins_RAMPS.h"

//
// LCDs and Controllers
//
Expand Down

0 comments on commit 6dd77df

Please sign in to comment.