0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-31 14:12:52 +00:00

🎨 Misc. cleanup

This commit is contained in:
Scott Lahteine 2023-03-28 05:39:35 -05:00
parent 70063fb652
commit de0cd66070
20 changed files with 43 additions and 26 deletions

View file

@ -69,7 +69,7 @@ public:
static bool isBusy(); static bool isBusy();
static void Abort(); 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 DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
static void DataTransferAbort(); static void DataTransferAbort();

View file

@ -52,7 +52,7 @@ public:
static bool isBusy(); static bool isBusy();
static void Abort(); static void Abort();
static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT); static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd(); static void DataTransferEnd();
static void DataTransferAbort(); static void DataTransferAbort();

View file

@ -71,7 +71,7 @@ void TFT_FSMC::Init() {
Timing.DataLatency = 17; Timing.DataLatency = 17;
Timing.AccessMode = FSMC_ACCESS_MODE_A; Timing.AccessMode = FSMC_ACCESS_MODE_A;
// Write Timing // 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.AddressSetupTime = 8;
ExtTiming.AddressHoldTime = 15; ExtTiming.AddressHoldTime = 15;
ExtTiming.DataSetupTime = 8; ExtTiming.DataSetupTime = 8;

View file

@ -31,6 +31,10 @@
#error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware." #error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
#endif #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 #ifndef LCD_READ_ID
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
#endif #endif
@ -69,8 +73,8 @@ class TFT_FSMC {
static bool isBusy(); static bool isBusy();
static void Abort(); static void Abort();
static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {} static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {}
static void DataTransferEnd() {}; static void DataTransferEnd() {}
static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); } static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); }
static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); } static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); }

View file

@ -58,7 +58,7 @@ class TFT_LTDC {
static bool isBusy(); static bool isBusy();
static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ } 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 DataTransferEnd() {};
static void WriteData(uint16_t Data); static void WriteData(uint16_t Data);

View file

@ -60,7 +60,7 @@ public:
static bool isBusy(); static bool isBusy();
static void Abort(); 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 DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); };
static void DataTransferAbort(); static void DataTransferAbort();

View file

@ -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. // Not every MarlinSerial port should handle emergency parsing.
// It would not make sense to parse GCode from TMC responses, for example. // It would not make sense to parse GCode from TMC responses, for example.
constexpr bool serial_handles_emergency(int port) { constexpr bool serial_handles_emergency(int port) {
return false return (false
#ifdef SERIAL_PORT #ifdef SERIAL_PORT
|| (SERIAL_PORT) == port || (SERIAL_PORT) == port
#endif #endif
@ -87,7 +87,7 @@ constexpr bool serial_handles_emergency(int port) {
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
|| (LCD_SERIAL_PORT) == port || (LCD_SERIAL_PORT) == port
#endif #endif
; );
} }
#define DEFINE_HWSERIAL_MARLIN(name, n) \ #define DEFINE_HWSERIAL_MARLIN(name, n) \

View file

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

View file

@ -20,6 +20,8 @@
* *
*/ */
#ifdef __STM32F1__
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_FSMC_TFT #if HAS_FSMC_TFT
@ -262,3 +264,5 @@ void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count)
} }
#endif // HAS_FSMC_TFT #endif // HAS_FSMC_TFT
#endif // __STM32F1__

View file

@ -65,7 +65,7 @@ class TFT_FSMC {
static bool isBusy(); static bool isBusy();
static void Abort(); static void Abort();
static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT) {}; static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) {};
static void DataTransferEnd() {}; static void DataTransferEnd() {};
static void WriteData(uint16_t Data) { Transmit(Data); } static void WriteData(uint16_t Data) { Transmit(Data); }

View file

@ -20,6 +20,8 @@
* *
*/ */
#ifdef __STM32F1__
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_SPI_TFT #if HAS_SPI_TFT
@ -165,3 +167,5 @@ void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count)
} }
#endif // HAS_SPI_TFT #endif // HAS_SPI_TFT
#endif // __STM32F1__

View file

@ -76,7 +76,7 @@ public:
static bool isBusy(); static bool isBusy();
static void Abort(); 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 DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); };
static void DataTransferAbort(); static void DataTransferAbort();

View file

@ -20,6 +20,8 @@
* *
*/ */
#ifdef __STM32F1__
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS #if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
@ -141,4 +143,6 @@ uint16_t XPT2046::SoftwareIO(uint16_t data) {
return result; return result;
} }
#endif // HAS_TFT_XPT2046 #endif // HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
#endif // __STM32F1__

View file

@ -91,4 +91,3 @@ Eject filament
- MMU <= 'E*Filament index*\n' - MMU <= 'E*Filament index*\n'
- MMU => 'ok\n' - MMU => 'ok\n'

View file

@ -145,7 +145,7 @@ static const uint16_t st7789v_init[] = {
/** /**
* LCM Control * LCM Control
* *
* Default Power-on Value: 0x2C / 00101100b * Default Power-on Value: 0x2C / 00101100b
* MY Inversion: 0 * MY Inversion: 0
* RGB/BGR Inversion: 1 * RGB/BGR Inversion: 1

View file

@ -62,7 +62,7 @@ public:
inline static void Abort() { io.Abort(); } inline static void Abort() { io.Abort(); }
inline static uint32_t GetID() { return io.GetID(); } 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 DataTransferEnd() { io.DataTransferEnd(); }
inline static void WriteData(uint16_t Data) { io.WriteData(Data); } inline static void WriteData(uint16_t Data) { io.WriteData(Data); }

View file

@ -1143,7 +1143,7 @@ void Endstops::update() {
#endif #endif
)) { SBI(live_state, X_ENDSTOP); hit = true; } )) { SBI(live_state, X_ENDSTOP); hit = true; }
#if ENABLED(X_DUAL_ENDSTOPS) #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
#endif #endif
#if Y_SPI_SENSORLESS #if Y_SPI_SENSORLESS
@ -1155,7 +1155,7 @@ void Endstops::update() {
#endif #endif
)) { SBI(live_state, Y_ENDSTOP); hit = true; } )) { SBI(live_state, Y_ENDSTOP); hit = true; }
#if ENABLED(Y_DUAL_ENDSTOPS) #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
#endif #endif
#if Z_SPI_SENSORLESS #if Z_SPI_SENSORLESS

View file

@ -86,7 +86,7 @@ enum EndstopEnum : char {
#if HAS_X_MIN || HAS_X_MAX #if HAS_X_MIN || HAS_X_MAX
, X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN) , X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN)
#if ENABLED(X_DUAL_ENDSTOPS) #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
#endif #endif
#if HAS_Y_MIN || HAS_Y_MAX #if HAS_Y_MIN || HAS_Y_MAX

View file

@ -435,7 +435,6 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
} }
} }
#endif // TOOL_SENSOR #endif // TOOL_SENSOR
#if ENABLED(SWITCHING_TOOLHEAD) #if ENABLED(SWITCHING_TOOLHEAD)

View file

@ -29,14 +29,10 @@
#define BOARD_INFO_NAME "VORON Design v2" #define BOARD_INFO_NAME "VORON Design v2"
#define MOSFET_C_PIN 11
#include "pins_RAMPS.h"
// //
// Heaters / Fans // 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 FAN0_PIN 5 // Using the pin for the controller fan since controller fan is always on.
#define CONTROLLER_FAN_PIN 8 #define CONTROLLER_FAN_PIN 8
@ -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) #define E1_AUTO_FAN_PIN 6 // Servo pin 6 for E3D Fan (same pin for both extruders since it's the same fan)
#endif #endif
#include "pins_RAMPS.h"
// //
// LCDs and Controllers // LCDs and Controllers
// //