From eb0d80cb196f6735db80897f4623a548555e16dd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 13 Aug 2021 16:32:25 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Update=20MKSPWC,=20some=20other?= =?UTF-8?q?=20pins=20(#22557)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 1 + Marlin/src/HAL/DUE/HAL_SPI.cpp | 16 ++--- Marlin/src/HAL/STM32F1/eeprom_wired.cpp | 2 +- Marlin/src/HAL/shared/eeprom_if_spi.cpp | 12 ++-- Marlin/src/MarlinCore.cpp | 2 +- Marlin/src/MarlinCore.h | 2 +- Marlin/src/feature/dac/dac_dac084s085.cpp | 42 +++++++------- Marlin/src/gcode/control/M80_M81.cpp | 2 +- Marlin/src/inc/SanityCheck.h | 7 +++ .../src/lcd/extui/dgus/mks/DGUSDisplayDef.h | 6 +- .../lcd/extui/dgus/mks/DGUSScreenHandler.cpp | 6 +- .../lcd/extui/mks_ui/printer_operation.cpp | 6 +- Marlin/src/libs/W25Qxx.cpp | 48 ++++++--------- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 8 +-- Marlin/src/pins/lpc1768/pins_MKS_SBASE.h | 12 ++-- Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h | 12 ++-- Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h | 12 ++-- Marlin/src/pins/pinsDebug_list.h | 20 +++---- Marlin/src/pins/pins_postprocess.h | 4 +- Marlin/src/pins/ramps/pins_FYSETC_F6_13.h | 2 +- Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h | 4 +- Marlin/src/pins/sam/pins_ALLIGATOR_R2.h | 10 ++-- Marlin/src/pins/sam/pins_RURAMPS4D_11.h | 6 +- Marlin/src/pins/sam/pins_RURAMPS4D_13.h | 6 +- Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h | 8 +-- Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h | 4 +- Marlin/src/pins/stm32f1/pins_CHITU3D_common.h | 8 +-- Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h | 6 +- Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h | 16 ++--- Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h | 16 ++--- Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h | 8 +-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 26 ++++----- .../pins/stm32f1/pins_MKS_ROBIN_E3_common.h | 12 ++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 14 +++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h | 43 +++++++------- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 44 +++++++------- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h | 31 +++++----- Marlin/src/pins/stm32f4/pins_LERDGE_S.h | 8 +-- Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h | 28 ++++----- .../src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h | 58 +++++++++---------- .../src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h | 22 +++---- 41 files changed, 279 insertions(+), 321 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d01fc98b40..763c143158 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -367,6 +367,7 @@ //#define PSU_NAME "Power Supply" #if ENABLED(PSU_CONTROL) + //#define MKS_PWC // Using the MKS PWC add-on //#define PS_OFF_CONFIRM // Confirm dialog when power off //#define PS_OFF_SOUND // Beep 1s when power off #define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box diff --git a/Marlin/src/HAL/DUE/HAL_SPI.cpp b/Marlin/src/HAL/DUE/HAL_SPI.cpp index d3d76e94e5..c5e8f2433d 100644 --- a/Marlin/src/HAL/DUE/HAL_SPI.cpp +++ b/Marlin/src/HAL/DUE/HAL_SPI.cpp @@ -594,18 +594,14 @@ SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS); SPI_Enable(SPI0); - SET_OUTPUT(DAC0_SYNC); + SET_OUTPUT(DAC0_SYNC_PIN); #if HAS_MULTI_EXTRUDER - SET_OUTPUT(DAC1_SYNC); - WRITE(DAC1_SYNC, HIGH); + OUT_WRITE(DAC1_SYNC_PIN, HIGH); #endif - SET_OUTPUT(SPI_EEPROM1_CS); - SET_OUTPUT(SPI_EEPROM2_CS); - SET_OUTPUT(SPI_FLASH_CS); - WRITE(DAC0_SYNC, HIGH); - WRITE(SPI_EEPROM1_CS, HIGH); - WRITE(SPI_EEPROM2_CS, HIGH); - WRITE(SPI_FLASH_CS, HIGH); + WRITE(DAC0_SYNC_PIN, HIGH); + OUT_WRITE(SPI_EEPROM1_CS_PIN, HIGH); + OUT_WRITE(SPI_EEPROM2_CS_PIN, HIGH); + OUT_WRITE(SPI_FLASH_CS_PIN, HIGH); WRITE(SD_SS_PIN, HIGH); OUT_WRITE(SDSS, LOW); diff --git a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp b/Marlin/src/HAL/STM32F1/eeprom_wired.cpp index 0ad69065cf..4cac36554f 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_wired.cpp @@ -44,7 +44,7 @@ bool PersistentStore::access_start() { SET_OUTPUT(BOARD_SPI1_SCK_PIN); SET_OUTPUT(BOARD_SPI1_MOSI_PIN); SET_INPUT(BOARD_SPI1_MISO_PIN); - SET_OUTPUT(SPI_EEPROM1_CS); + SET_OUTPUT(SPI_EEPROM1_CS_PIN); #endif spiInit(0); #endif diff --git a/Marlin/src/HAL/shared/eeprom_if_spi.cpp b/Marlin/src/HAL/shared/eeprom_if_spi.cpp index 6aa6e09096..72c35addcb 100644 --- a/Marlin/src/HAL/shared/eeprom_if_spi.cpp +++ b/Marlin/src/HAL/shared/eeprom_if_spi.cpp @@ -49,8 +49,8 @@ static void _eeprom_begin(uint8_t * const pos, const uint8_t cmd) { (unsigned(pos) >> 8) & 0xFF, // Address High unsigned(pos) & 0xFF // Address Low }; - WRITE(SPI_EEPROM1_CS, HIGH); // Usually free already - WRITE(SPI_EEPROM1_CS, LOW); // Activate the Bus + WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Usually free already + WRITE(SPI_EEPROM1_CS_PIN, LOW); // Activate the Bus spiSend(SPI_CHAN_EEPROM1, eeprom_temp, 3); // Leave the Bus in-use } @@ -60,23 +60,23 @@ uint8_t eeprom_read_byte(uint8_t *pos) { const uint8_t v = spiRec(SPI_CHAN_EEPROM1); // After READ a value sits on the Bus - WRITE(SPI_EEPROM1_CS, HIGH); // Done with device + WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with device return v; } void eeprom_write_byte(uint8_t *pos, uint8_t value) { const uint8_t eeprom_temp = CMD_WREN; - WRITE(SPI_EEPROM1_CS, LOW); + WRITE(SPI_EEPROM1_CS_PIN, LOW); spiSend(SPI_CHAN_EEPROM1, &eeprom_temp, 1); // Write Enable - WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus + WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus delay(1); // For a small amount of time _eeprom_begin(pos, CMD_WRITE); // Set write address and begin transmission spiSend(SPI_CHAN_EEPROM1, value); // Send the value to be written - WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus + WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus delay(EEPROM_WRITE_DELAY); // Give page write time to complete } diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 3a1ac6fd04..39ff4393d7 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1192,7 +1192,7 @@ void setup() { #if HAS_SUICIDE SETUP_LOG("SUICIDE_PIN"); - OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); + OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE); #endif #ifdef JTAGSWD_RESET diff --git a/Marlin/src/MarlinCore.h b/Marlin/src/MarlinCore.h index d7ab11d046..6147d43f17 100644 --- a/Marlin/src/MarlinCore.h +++ b/Marlin/src/MarlinCore.h @@ -84,7 +84,7 @@ extern bool wait_for_heatup; bool pin_is_protected(const pin_t pin); #if HAS_SUICIDE - inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); } + inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_STATE); } #endif #if HAS_KILL diff --git a/Marlin/src/feature/dac/dac_dac084s085.cpp b/Marlin/src/feature/dac/dac_dac084s085.cpp index 649aa5561b..b88aaf802b 100644 --- a/Marlin/src/feature/dac/dac_dac084s085.cpp +++ b/Marlin/src/feature/dac/dac_dac084s085.cpp @@ -20,35 +20,35 @@ void dac084s085::begin() { uint8_t externalDac_buf[] = { 0x20, 0x00 }; // all off // All SPI chip-select HIGH - SET_OUTPUT(DAC0_SYNC); + SET_OUTPUT(DAC0_SYNC_PIN); #if HAS_MULTI_EXTRUDER - SET_OUTPUT(DAC1_SYNC); + SET_OUTPUT(DAC1_SYNC_PIN); #endif cshigh(); spiBegin(); //init onboard DAC DELAY_US(2); - WRITE(DAC0_SYNC, LOW); + WRITE(DAC0_SYNC_PIN, LOW); DELAY_US(2); - WRITE(DAC0_SYNC, HIGH); + WRITE(DAC0_SYNC_PIN, HIGH); DELAY_US(2); - WRITE(DAC0_SYNC, LOW); + WRITE(DAC0_SYNC_PIN, LOW); spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf)); - WRITE(DAC0_SYNC, HIGH); + WRITE(DAC0_SYNC_PIN, HIGH); #if HAS_MULTI_EXTRUDER //init Piggy DAC DELAY_US(2); - WRITE(DAC1_SYNC, LOW); + WRITE(DAC1_SYNC_PIN, LOW); DELAY_US(2); - WRITE(DAC1_SYNC, HIGH); + WRITE(DAC1_SYNC_PIN, HIGH); DELAY_US(2); - WRITE(DAC1_SYNC, LOW); + WRITE(DAC1_SYNC_PIN, LOW); spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf)); - WRITE(DAC1_SYNC, HIGH); + WRITE(DAC1_SYNC_PIN, HIGH); #endif return; @@ -66,18 +66,18 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) { cshigh(); if (channel > 3) { // DAC Piggy E1,E2,E3 - WRITE(DAC1_SYNC, LOW); + WRITE(DAC1_SYNC_PIN, LOW); DELAY_US(2); - WRITE(DAC1_SYNC, HIGH); + WRITE(DAC1_SYNC_PIN, HIGH); DELAY_US(2); - WRITE(DAC1_SYNC, LOW); + WRITE(DAC1_SYNC_PIN, LOW); } else { // DAC onboard X,Y,Z,E0 - WRITE(DAC0_SYNC, LOW); + WRITE(DAC0_SYNC_PIN, LOW); DELAY_US(2); - WRITE(DAC0_SYNC, HIGH); + WRITE(DAC0_SYNC_PIN, HIGH); DELAY_US(2); - WRITE(DAC0_SYNC, LOW); + WRITE(DAC0_SYNC_PIN, LOW); } DELAY_US(2); @@ -85,13 +85,13 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) { } void dac084s085::cshigh() { - WRITE(DAC0_SYNC, HIGH); + WRITE(DAC0_SYNC_PIN, HIGH); #if HAS_MULTI_EXTRUDER - WRITE(DAC1_SYNC, HIGH); + WRITE(DAC1_SYNC_PIN, HIGH); #endif - WRITE(SPI_EEPROM1_CS, HIGH); - WRITE(SPI_EEPROM2_CS, HIGH); - WRITE(SPI_FLASH_CS, HIGH); + WRITE(SPI_EEPROM1_CS_PIN, HIGH); + WRITE(SPI_EEPROM2_CS_PIN, HIGH); + WRITE(SPI_FLASH_CS_PIN, HIGH); WRITE(SD_SS_PIN, HIGH); } diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index f6ce9a9c87..62142abb79 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -60,7 +60,7 @@ * a print without suicide... */ #if HAS_SUICIDE - OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); + OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE); #endif TERN_(HAS_LCD_MENU, ui.reset_status()); diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 9b731a7c73..817bce28bc 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3475,6 +3475,13 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #endif #endif +/** + * Validate MKS_PWC + */ +#if ENABLED(MKS_PWC) && PSU_ACTIVE_STATE != HIGH + #error "MKS_PWC requires PSU_ACTIVE_STATE to be set HIGH." +#endif + /** * Ensure this option is set intentionally */ diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h index c78e35e75b..407782f559 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.h @@ -28,9 +28,9 @@ #define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500) #if ENABLED(DGUS_MKS_RUNOUT_SENSOR) - #define MT_DET_1_PIN 1 - #define MT_DET_2_PIN 2 - #define MT_DET_PIN_INVERTING false + #define MT_DET_1_PIN 1 + #define MT_DET_2_PIN 2 + #define MT_DET_PIN_STATE LOW #endif #define MKS_FINSH diff --git a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp index 8c806f0ecd..c80191c8e5 100644 --- a/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp @@ -1495,17 +1495,17 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) { break; case UNRUNOUT_STATUS: - if (READ(MT_DET_1_PIN) == LOW) + if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE) runout_mks.runout_status = RUNOUT_STATUS; break; case RUNOUT_BEGIN_STATUS: - if (READ(MT_DET_1_PIN) == HIGH) + if (READ(MT_DET_1_PIN) != MT_DET_PIN_STATE) runout_mks.runout_status = RUNOUT_WAITTING_STATUS; break; case RUNOUT_WAITTING_STATUS: - if (READ(MT_DET_1_PIN) == LOW) + if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE) runout_mks.runout_status = RUNOUT_BEGIN_STATUS; break; diff --git a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp index 1bb17bb4f2..362fdeb43d 100644 --- a/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp +++ b/Marlin/src/lcd/extui/mks_ui/printer_operation.cpp @@ -163,7 +163,7 @@ void filament_check() { #endif #if PIN_EXISTS(MT_DET_1) static int fil_det_count_1 = 0; - if (READ(MT_DET_1_PIN) == MT_DET_PIN_INVERTING) + if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE) fil_det_count_1++; else if (fil_det_count_1 > 0) fil_det_count_1--; @@ -171,7 +171,7 @@ void filament_check() { #if PIN_EXISTS(MT_DET_2) static int fil_det_count_2 = 0; - if (READ(MT_DET_2_PIN) == MT_DET_PIN_INVERTING) + if (READ(MT_DET_2_PIN) == MT_DET_PIN_STATE) fil_det_count_2++; else if (fil_det_count_2 > 0) fil_det_count_2--; @@ -179,7 +179,7 @@ void filament_check() { #if PIN_EXISTS(MT_DET_3) static int fil_det_count_3 = 0; - if (READ(MT_DET_3_PIN) == MT_DET_PIN_INVERTING) + if (READ(MT_DET_3_PIN) == MT_DET_PIN_STATE) fil_det_count_3++; else if (fil_det_count_3 > 0) fil_det_count_3--; diff --git a/Marlin/src/libs/W25Qxx.cpp b/Marlin/src/libs/W25Qxx.cpp index 56581ed46e..b458a7c965 100644 --- a/Marlin/src/libs/W25Qxx.cpp +++ b/Marlin/src/libs/W25Qxx.cpp @@ -28,26 +28,14 @@ W25QXXFlash W25QXX; -#ifndef SPI_FLASH_MISO_PIN - #define SPI_FLASH_MISO_PIN W25QXX_MISO_PIN -#endif -#ifndef SPI_FLASH_MOSI_PIN - #define SPI_FLASH_MOSI_PIN W25QXX_MOSI_PIN -#endif -#ifndef SPI_FLASH_SCK_PIN - #define SPI_FLASH_SCK_PIN W25QXX_SCK_PIN -#endif -#ifndef SPI_FLASH_CS_PIN - #define SPI_FLASH_CS_PIN W25QXX_CS_PIN -#endif #ifndef NC #define NC -1 #endif MarlinSPI W25QXXFlash::mySPI(SPI_FLASH_MOSI_PIN, SPI_FLASH_MISO_PIN, SPI_FLASH_SCK_PIN, NC); -#define W25QXX_CS_H OUT_WRITE(SPI_FLASH_CS_PIN, HIGH) -#define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW) +#define SPI_FLASH_CS_H() OUT_WRITE(SPI_FLASH_CS_PIN, HIGH) +#define SPI_FLASH_CS_L() OUT_WRITE(SPI_FLASH_CS_PIN, LOW) bool flash_dma_mode = true; @@ -134,24 +122,24 @@ void W25QXXFlash::spi_flash_SendBlock(uint8_t token, const uint8_t *buf) { uint16_t W25QXXFlash::W25QXX_ReadID(void) { uint16_t Temp = 0; - W25QXX_CS_L; + SPI_FLASH_CS_L(); spi_flash_Send(0x90); spi_flash_Send(0x00); spi_flash_Send(0x00); spi_flash_Send(0x00); Temp |= spi_flash_Rec() << 8; Temp |= spi_flash_Rec(); - W25QXX_CS_H; + SPI_FLASH_CS_H(); return Temp; } void W25QXXFlash::SPI_FLASH_WriteEnable(void) { // Select the FLASH: Chip Select low - W25QXX_CS_L; + SPI_FLASH_CS_L(); // Send "Write Enable" instruction spi_flash_Send(W25X_WriteEnable); // Deselect the FLASH: Chip Select high - W25QXX_CS_H; + SPI_FLASH_CS_H(); } /******************************************************************************* @@ -167,7 +155,7 @@ void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) { uint8_t FLASH_Status = 0; // Select the FLASH: Chip Select low - W25QXX_CS_L; + SPI_FLASH_CS_L(); // Send "Read Status Register" instruction spi_flash_Send(W25X_ReadStatusReg); @@ -179,7 +167,7 @@ void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) { while ((FLASH_Status & WIP_Flag) == 0x01); // Write in progress // Deselect the FLASH: Chip Select high - W25QXX_CS_H; + SPI_FLASH_CS_H(); } void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) { @@ -188,7 +176,7 @@ void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) { // Sector Erase // Select the FLASH: Chip Select low - W25QXX_CS_L; + SPI_FLASH_CS_L(); // Send Sector Erase instruction spi_flash_Send(W25X_SectorErase); // Send SectorAddr high nybble address byte @@ -199,14 +187,14 @@ void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) { spi_flash_Send(SectorAddr & 0xFF); // Deselect the FLASH: Chip Select high - W25QXX_CS_H; + SPI_FLASH_CS_H(); // Wait the end of Flash writing SPI_FLASH_WaitForWriteEnd(); } void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) { SPI_FLASH_WriteEnable(); - W25QXX_CS_L; + SPI_FLASH_CS_L(); // Send Sector Erase instruction spi_flash_Send(W25X_BlockErase); // Send SectorAddr high nybble address byte @@ -216,7 +204,7 @@ void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) { // Send SectorAddr low nybble address byte spi_flash_Send(BlockAddr & 0xFF); - W25QXX_CS_H; + SPI_FLASH_CS_H(); SPI_FLASH_WaitForWriteEnd(); } @@ -234,12 +222,12 @@ void W25QXXFlash::SPI_FLASH_BulkErase(void) { // Bulk Erase // Select the FLASH: Chip Select low - W25QXX_CS_L; + SPI_FLASH_CS_L(); // Send Bulk Erase instruction spi_flash_Send(W25X_ChipErase); // Deselect the FLASH: Chip Select high - W25QXX_CS_H; + SPI_FLASH_CS_H(); // Wait the end of Flash writing SPI_FLASH_WaitForWriteEnd(); } @@ -262,7 +250,7 @@ void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint SPI_FLASH_WriteEnable(); // Select the FLASH: Chip Select low - W25QXX_CS_L; + SPI_FLASH_CS_L(); // Send "Write to Memory " instruction spi_flash_Send(W25X_PageProgram); // Send WriteAddr high nybble address byte to write to @@ -283,7 +271,7 @@ void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint } // Deselect the FLASH: Chip Select high - W25QXX_CS_H; + SPI_FLASH_CS_H(); // Wait the end of Flash writing SPI_FLASH_WaitForWriteEnd(); @@ -366,7 +354,7 @@ void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t *pBuffer, uint32_t WriteAddr, ui *******************************************************************************/ void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) { // Select the FLASH: Chip Select low - W25QXX_CS_L; + SPI_FLASH_CS_L(); // Send "Read from Memory " instruction spi_flash_Send(W25X_ReadData); @@ -389,7 +377,7 @@ void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint else spi_flash_Read(pBuffer, NumByteToRead); - W25QXX_CS_H; + SPI_FLASH_CS_H(); } #endif // HAS_SPI_FLASH diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index a0f8c1648c..1b3cf15e5a 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -416,10 +416,10 @@ #if HAS_SPI_FLASH #define SPI_DEVICE 1 #define SPI_FLASH_SIZE 0x1000000 // 16MB - #define W25QXX_CS_PIN 31 - #define W25QXX_MOSI_PIN SD_MOSI_PIN - #define W25QXX_MISO_PIN SD_MISO_PIN - #define W25QXX_SCK_PIN SD_SCK_PIN + #define SPI_FLASH_CS_PIN 31 + #define SPI_FLASH_MOSI_PIN SD_MOSI_PIN + #define SPI_FLASH_MISO_PIN SD_MISO_PIN + #define SPI_FLASH_SCK_PIN SD_SCK_PIN #endif #define TFT_BUFFER_SIZE 0xFFFF diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index 4c2b606929..44dbaacb73 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -138,14 +138,10 @@ // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #ifndef PS_ON_PIN - #define PS_ON_PIN P0_25 // SERVO - #endif - #ifndef KILL_PIN - #define KILL_PIN P1_29 // Z+ - #define KILL_PIN_STATE HIGH - #endif +#if ENABLED(MKS_PWC) + #define PS_ON_PIN P0_25 // SERVO + #define KILL_PIN P1_29 // Z+ + #define KILL_PIN_STATE HIGH #endif // diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 0c3f44ceb7..8808c3a228 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -218,14 +218,10 @@ // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #ifndef PS_ON_PIN - #define PS_ON_PIN P2_00 // SERVO - #endif - #ifndef KILL_PIN - #define KILL_PIN P1_24 // Z+ - #define KILL_PIN_STATE HIGH - #endif +#if ENABLED(MKS_PWC) + #define PS_ON_PIN P2_00 // SERVO + #define KILL_PIN P1_24 // Z+ + #define KILL_PIN_STATE HIGH #endif // diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index 4020ac23c6..7547279bbd 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -229,14 +229,10 @@ // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #ifndef PS_ON_PIN - #define PS_ON_PIN P2_00 // Suggestion (SERVO) - #endif - #ifndef KILL_PIN - #define KILL_PIN P1_24 // Suggestion (Z+) - #define KILL_PIN_STATE HIGH - #endif +#if ENABLED(MKS_PWC) + #define PS_ON_PIN P2_00 // SERVO + #define KILL_PIN P1_24 // Z+ + #define KILL_PIN_STATE HIGH #endif // diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 8b1cad3a7c..78ee71749d 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -291,11 +291,11 @@ #if PIN_EXISTS(DAC_DISABLE) REPORT_NAME_DIGITAL(__LINE__, DAC_DISABLE_PIN) #endif -#if defined(DAC0_SYNC) && DAC0_SYNC >= 0 - REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC) +#if PIN_EXISTS(DAC0_SYNC) + REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC_PIN) #endif -#if defined(DAC1_SYNC) && DAC1_SYNC >= 0 - REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC) +#if PIN_EXISTS(DAC1_SYNC) + REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC_PIN) #endif #if PIN_EXISTS(DEBUG) REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN) @@ -974,14 +974,14 @@ #if defined(SPARE_IO) && SPARE_IO >= 0 REPORT_NAME_DIGITAL(__LINE__, SPARE_IO) #endif -#if defined(SPI_EEPROM1_CS) && SPI_EEPROM1_CS >= 0 - REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS) +#if PIN_EXISTS(SPI_EEPROM1_CS) + REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS_PIN) #endif -#if defined(SPI_EEPROM2_CS) && SPI_EEPROM2_CS >= 0 - REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS) +#if PIN_EXISTS(SPI_EEPROM2_CS) + REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS_PIN) #endif -#if defined(SPI_FLASH_CS) && SPI_FLASH_CS >= 0 - REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS) +#if PIN_EXISTS(SPI_FLASH_CS) + REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS_PIN) #endif #if PIN_EXISTS(SPINDLE_DIR) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_DIR_PIN) diff --git a/Marlin/src/pins/pins_postprocess.h b/Marlin/src/pins/pins_postprocess.h index f7152770e5..fc82e600df 100644 --- a/Marlin/src/pins/pins_postprocess.h +++ b/Marlin/src/pins/pins_postprocess.h @@ -391,8 +391,8 @@ #ifndef SUICIDE_PIN #define SUICIDE_PIN -1 #endif -#ifndef SUICIDE_PIN_INVERTING - #define SUICIDE_PIN_INVERTING false +#ifndef SUICIDE_PIN_STATE + #define SUICIDE_PIN_STATE LOW #endif #ifndef NUM_SERVO_PLUGS diff --git a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h index 6133a6417e..8756a33218 100644 --- a/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/ramps/pins_FYSETC_F6_13.h @@ -34,7 +34,7 @@ #endif #define RESET_PIN 30 -#define SPI_FLASH_CS 83 +#define SPI_FLASH_CS_PIN 83 // // Servos diff --git a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h index 05de208ca1..def71fefc1 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_CREALITY.h @@ -63,6 +63,6 @@ #define EXP4_PIN 12 // PS_ON_PIN #define SUICIDE_PIN 12 // Used by CR2020 Industrial series -#ifndef SUICIDE_PIN_INVERTING - #define SUICIDE_PIN_INVERTING true +#ifndef SUICIDE_PIN_STATE + #define SUICIDE_PIN_STATE HIGH #endif diff --git a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h index c273edfc6b..70c3853dc9 100644 --- a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h +++ b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h @@ -123,20 +123,20 @@ #define SPI_CHAN_DAC 1 -#define DAC0_SYNC 53 // PB14 -#define DAC1_SYNC 6 // PC24 +#define DAC0_SYNC_PIN 53 // PB14 +#define DAC1_SYNC_PIN 6 // PC24 // 64K SPI EEPROM #define SPI_EEPROM #define SPI_CHAN_EEPROM1 2 -#define SPI_EEPROM1_CS 25 // PD0 +#define SPI_EEPROM1_CS_PIN 25 // PD0 // 2K SPI EEPROM -#define SPI_EEPROM2_CS 26 // PD1 +#define SPI_EEPROM2_CS_PIN 26 // PD1 // FLASH SPI // 32Mb -#define SPI_FLASH_CS 23 // PA14 +#define SPI_FLASH_CS_PIN 23 // PA14 // // LCD / Controller diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h index b5569c810d..5e612d3e8c 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h @@ -190,11 +190,11 @@ //#define EEPROM_SD // EEPROM on SDCARD //#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_CHAN_EEPROM1 ? -//#define SPI_EEPROM1_CS ? +//#define SPI_EEPROM1_CS_PIN ? // 2K EEPROM -//#define SPI_EEPROM2_CS ? +//#define SPI_EEPROM2_CS_PIN ? // 32Mb FLASH -//#define SPI_FLASH_CS ? +//#define SPI_FLASH_CS_PIN ? // // LCD / Controller diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h index b06de1bc69..37a76c5278 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h @@ -176,11 +176,11 @@ //#define EEPROM_SD // EEPROM on SDCARD //#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_CHAN_EEPROM1 ? -//#define SPI_EEPROM1_CS ? +//#define SPI_EEPROM1_CS_PIN ? // 2K EEPROM -//#define SPI_EEPROM2_CS ? +//#define SPI_EEPROM2_CS_PIN ? // 32Mb FLASH -//#define SPI_FLASH_CS ? +//#define SPI_FLASH_CS_PIN ? // // LCD / Controller diff --git a/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h b/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h index a655d0121c..fd30c2b69a 100644 --- a/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h +++ b/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h @@ -137,13 +137,13 @@ // SPI Buses // -#define DAC0_SYNC 53 // PB14 +#define DAC0_SYNC_PIN 53 // PB14 #define SPI_CHAN_DAC 1 #define SPI_CHAN_EEPROM1 -1 -#define SPI_EEPROM1_CS -1 -#define SPI_EEPROM2_CS -1 -#define SPI_FLASH_CS -1 +#define SPI_EEPROM1_CS_PIN -1 +#define SPI_EEPROM2_CS_PIN -1 +#define SPI_FLASH_CS_PIN -1 #define SD_SCK_PIN 76 #define SD_MISO_PIN 74 diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h index 63ad06dc57..bd5f2068f1 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h @@ -179,6 +179,6 @@ #endif #define SUICIDE_PIN PC13 -#ifndef SUICIDE_PIN_INVERTING - #define SUICIDE_PIN_INVERTING false +#ifndef SUICIDE_PIN_STATE + #define SUICIDE_PIN_STATE LOW #endif diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h index 0319afa5e9..989b7eec6f 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_common.h @@ -120,10 +120,10 @@ #endif // SPI 2 -#define W25QXX_CS_PIN PB12 -#define W25QXX_MOSI_PIN PB15 -#define W25QXX_MISO_PIN PB14 -#define W25QXX_SCK_PIN PB13 +#define SPI_FLASH_CS_PIN PB12 +#define SPI_FLASH_MOSI_PIN PB15 +#define SPI_FLASH_MISO_PIN PB14 +#define SPI_FLASH_SCK_PIN PB13 // // TFT with FSMC interface diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h index d106c98e13..f971f65628 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4210.h @@ -61,13 +61,13 @@ // SPI //#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_CHAN_EEPROM1 ? - //#define SPI_EEPROM1_CS ? + //#define SPI_EEPROM1_CS_PIN ? // 2K EEPROM - //#define SPI_EEPROM2_CS ? + //#define SPI_EEPROM2_CS_PIN ? // 32Mb FLASH - //#define SPI_FLASH_CS ? + //#define SPI_FLASH_CS_PIN ? #endif // diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index 2dea59ef41..21bbd23ca9 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -73,10 +73,10 @@ #if HAS_SPI_FLASH // SPI 2 - #define W25QXX_CS_PIN PB12 // SPI2_NSS / Flash chip-select - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif // @@ -222,9 +222,11 @@ //#define PS_ON_PIN PA3 // PW_CN /PW_OFF #endif -#define MT_DET_1_PIN PA4 // MT_DET -#define MT_DET_2_PIN PE6 // FALA_CRTL -#define MT_DET_PIN_INVERTING false +#if HAS_TFT_LVGL_UI + #define MT_DET_1_PIN PA4 // MT_DET + #define MT_DET_2_PIN PE6 + #define MT_DET_PIN_STATE LOW +#endif // // LED / NEOPixel diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index f9ec42b68e..c9d16b16b0 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -170,18 +170,18 @@ #if ENABLED(SPI_EEPROM) // SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits) #define SPI_CHAN_EEPROM1 1 - #define SPI_EEPROM1_CS PC5 // pin 34 - #define EEPROM_SCK BOARD_SPI1_SCK_PIN // PA5 pin 30 - #define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31 - #define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32 + #define SPI_EEPROM1_CS_PIN PC5 // pin 34 + #define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 pin 30 + #define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 pin 31 + #define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32 #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... #elif HAS_SPI_FLASH #define SPI_FLASH_SIZE 0x40000U // limit to 256KB (M993 will reboot with 512) - #define W25QXX_CS_PIN PC5 - #define W25QXX_MOSI_PIN PA7 - #define W25QXX_MISO_PIN PA6 - #define W25QXX_SCK_PIN PA5 + #define SPI_FLASH_CS_PIN PC5 + #define SPI_FLASH_MOSI_PIN PA7 + #define SPI_FLASH_MISO_PIN PA6 + #define SPI_FLASH_SCK_PIN PA5 #elif ENABLED(FLASH_EEPROM_EMULATION) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) #define EEPROM_PAGE_SIZE (0x800U) // 2KB diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index 4d798ffe28..889e1f5e07 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -275,8 +275,8 @@ #define HAS_SPI_FLASH 1 #if HAS_SPI_FLASH #define SPI_FLASH_SIZE 0x800000 // 8MB - #define W25QXX_CS_PIN PG9 - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PG9 + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index 2fc99f2971..ba51980065 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -183,19 +183,19 @@ // Misc. Functions // #if HAS_TFT_LVGL_UI - #if ENABLED(PSU_CONTROL) // MKSPWC - #define SUICIDE_PIN PB2 // PW_OFF - #define SUICIDE_PIN_INVERTING false - #define KILL_PIN PA2 // PW_DET + #if ENABLED(MKS_PWC) + #define SUICIDE_PIN PB2 + #define SUICIDE_PIN_STATE LOW + #define KILL_PIN PA2 #define KILL_PIN_STATE HIGH #endif - #define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN - #define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE + #define MT_DET_1_PIN PA4 + #define MT_DET_PIN_STATE LOW - #define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN - #define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN - #define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN + #define WIFI_IO0_PIN PC13 + #define WIFI_IO1_PIN PC7 + #define WIFI_RESET_PIN PE9 #if ENABLED(MKS_TEST) #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET @@ -363,10 +363,10 @@ #define HAS_SPI_FLASH 1 #if HAS_SPI_FLASH #define SPI_FLASH_SIZE 0x1000000 // 16MB - #define W25QXX_CS_PIN PB12 - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif #ifndef BEEPER_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index da7ba05795..5a35932801 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -129,14 +129,10 @@ // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #ifndef PS_ON_PIN - #define PS_ON_PIN PA14 // PW_OFF - #endif - #ifndef KILL_PIN - #define KILL_PIN PB10 // PW_DET - #define KILL_PIN_STATE HIGH - #endif +#if ENABLED(MKS_PWC) + #define PS_ON_PIN PA14 // PW_OFF + #define KILL_PIN PB10 // PW_DET + #define KILL_PIN_STATE HIGH #endif /** diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index d4a2f59b42..ae45d8b6d1 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -119,8 +119,10 @@ #define POWER_LOSS_PIN PA2 // PW_DET #define PS_ON_PIN PA3 // PW_OFF -#define MT_DET_1_PIN PA4 -#define MT_DET_PIN_INVERTING false +#if HAS_TFT_LVGL_UI + #define MT_DET_1_PIN PA4 // MT_DET + #define MT_DET_PIN_STATE LOW +#endif #define WIFI_IO0_PIN PC13 @@ -194,8 +196,8 @@ #define HAS_SPI_FLASH 1 #if HAS_SPI_FLASH #define SPI_FLASH_SIZE 0x1000000 // 16MB - #define W25QXX_CS_PIN PB12 // Flash chip-select - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 // Flash chip-select + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index 2a5c9f7273..975ecb8bd5 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -130,33 +130,30 @@ // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #if HAS_TFT_LVGL_UI - #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." +#if ENABLED(MKS_PWC) + #if ENABLED(TFT_LVGL_UI) + #undef PSU_CONTROL + #undef MKS_PWC + #define SUICIDE_PIN PB2 + #define SUICIDE_PIN_STATE LOW + #else + #define PS_ON_PIN PB2 // PW_OFF #endif - #ifndef PS_ON_PIN - #define PS_ON_PIN PB2 // SUICIDE - #endif - #ifndef KILL_PIN - #define KILL_PIN PA2 - #define KILL_PIN_STATE HIGH - #endif -#else - #define SUICIDE_PIN PB2 - #define SUICIDE_PIN_INVERTING false + #define KILL_PIN PA2 + #define KILL_PIN_STATE HIGH #endif // // Misc. Functions // #if HAS_TFT_LVGL_UI - #define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN - #define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN - #define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE + #define MT_DET_1_PIN PA4 + #define MT_DET_2_PIN PE6 + #define MT_DET_PIN_STATE LOW - #define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN - #define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN - #define WIFI_RESET_PIN PA5 // MKS ESP WIFI RESET PIN + #define WIFI_IO0_PIN PC13 + #define WIFI_IO1_PIN PC7 + #define WIFI_RESET_PIN PA5 #else //#define POWER_LOSS_PIN PA2 // PW_DET //#define PS_ON_PIN PB2 // PW_OFF @@ -221,8 +218,8 @@ #define HAS_SPI_FLASH 1 #if HAS_SPI_FLASH #define SPI_FLASH_SIZE 0x1000000 // 16MB - #define W25QXX_CS_PIN PB12 - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 31ce016e67..49d5476fec 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -194,34 +194,30 @@ // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #if HAS_TFT_LVGL_UI - #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." +#if ENABLED(MKS_PWC) + #if ENABLED(TFT_LVGL_UI) + #undef PSU_CONTROL + #undef MKS_PWC + #define SUICIDE_PIN PB2 + #define SUICIDE_PIN_STATE LOW + #else + #define PS_ON_PIN PB2 // PW_OFF #endif - #ifndef PS_ON_PIN - #define PS_ON_PIN PB2 // SUICIDE - #endif - #ifndef KILL_PIN - #define KILL_PIN PA2 - #define KILL_PIN_STATE HIGH - #endif -#else - #define SUICIDE_PIN PB2 - #define SUICIDE_PIN_INVERTING false + #define KILL_PIN PA2 + #define KILL_PIN_STATE HIGH #endif // // Misc. Functions // #if HAS_TFT_LVGL_UI + #define MT_DET_1_PIN PA4 + #define MT_DET_2_PIN PE6 + #define MT_DET_PIN_STATE LOW - #define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN - #define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN - #define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE - - #define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN - #define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN - #define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN + #define WIFI_IO0_PIN PC13 + #define WIFI_IO1_PIN PC7 + #define WIFI_RESET_PIN PE9 #if ENABLED(MKS_TEST) #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET @@ -390,10 +386,10 @@ #define HAS_SPI_FLASH 1 #if HAS_SPI_FLASH #define SPI_FLASH_SIZE 0x1000000 // 16MB - #define W25QXX_CS_PIN PB12 - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif #ifndef BEEPER_PIN diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index 2f62563edb..d752d52a3a 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -186,20 +186,17 @@ // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #if HAS_TFT_LVGL_UI - #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." +#if ENABLED(MKS_PWC) + #if ENABLED(TFT_LVGL_UI) + #undef PSU_CONTROL + #undef MKS_PWC + #define SUICIDE_PIN PG11 + #define SUICIDE_PIN_STATE LOW + #else + #define PS_ON_PIN PG11 // PW_OFF #endif - #ifndef PS_ON_PIN - #define PS_ON_PIN PG11 // SUICIDE - #endif - #ifndef KILL_PIN - #define KILL_PIN PA2 - #define KILL_PIN_STATE HIGH - #endif -#else - #define SUICIDE_PIN PG11 - #define SUICIDE_PIN_INVERTING false + #define KILL_PIN PA2 + #define KILL_PIN_STATE HIGH #endif // @@ -318,8 +315,8 @@ #define HAS_SPI_FLASH 1 #if HAS_SPI_FLASH #define SPI_FLASH_SIZE 0x1000000 // 16MB - #define W25QXX_CS_PIN PB12 // Flash chip-select - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 // Flash chip-select + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 65db99025c..4707a16e14 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -179,10 +179,10 @@ #if ENABLED(SPI_EEPROM) // Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf #define SPI_CHAN_EEPROM1 1 - #define SPI_EEPROM1_CS PB12 // datasheet: /CS pin, found with multimeter, not tested - #define EEPROM_SCK PB13 // datasheet: CLK pin, found with multimeter, not tested - #define EEPROM_MISO PB14 // datasheet: DO pin, found with multimeter, not tested - #define EEPROM_MOSI PB15 // datasheet: DI pin, found with multimeter, not tested + #define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested + #define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested + #define EEPROM_MISO_PIN PB14 // datasheet: DO pin, found with multimeter, not tested + #define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... #else diff --git a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h index 2db5584109..5c66685629 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_MONSTER8.h @@ -210,32 +210,24 @@ // // Misc. Functions // -#define MT_DET_1 PC5 // Y+ -#define MT_DET_2 PB12 // Z+ - +#define PW_DET PC5 // Y+ +#define PW_OFF PB12 // Z+ +#define MT_DET_1_PIN PW_DET +#define MT_DET_2_PIN PW_OFF #ifndef FIL_RUNOUT_PIN - #define FIL_RUNOUT_PIN MT_DET_1 + #define FIL_RUNOUT_PIN MT_DET_1_PIN #endif #ifndef FIL_RUNOUT2_PIN - #define FIL_RUNOUT2_PIN MT_DET_2 + #define FIL_RUNOUT2_PIN MT_DET_2_PIN #endif // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #ifndef PS_ON_PIN - #define PS_ON_PIN MT_DET_2 // Z+ - #endif - #ifndef KILL_PIN - #define KILL_PIN MT_DET_1 // Y+ - #define KILL_PIN_STATE HIGH - #endif -#else - #define PW_DET MT_DET_1 - #define PW_OFF MT_DET_2 - #define POWER_LOSS_PIN PW_DET - #define PS_ON_PIN PW_OFF +#if ENABLED(MKS_PWC) + #define PS_ON_PIN PW_OFF + #define KILL_PIN PW_DET + #define KILL_PIN_STATE HIGH #endif // Random Info diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index eff941b957..9193a85511 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -178,9 +178,11 @@ // // Misc. Functions // -#define MT_DET_1_PIN PA4 -#define MT_DET_2_PIN PE6 -#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE +#if HAS_TFT_LVGL_UI + #define MT_DET_1_PIN PA4 // MT_DET + #define MT_DET_2_PIN PE6 + #define MT_DET_PIN_STATE LOW +#endif #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN MT_DET_1_PIN @@ -189,35 +191,29 @@ #define FIL_RUNOUT2_PIN MT_DET_2_PIN #endif -// -// Enable MKSPWC support -// +#ifndef POWER_LOSS_PIN + #define POWER_LOSS_PIN PA13 // PW_DET +#endif + //#define SUICIDE_PIN PB2 //#define LED_PIN PB2 //#define KILL_PIN PA2 -//#define KILL_PIN_STATE HIGH +//#define KILL_PIN_STATE LOW // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - #if HAS_TFT_LVGL_UI - #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." +#if ENABLED(MKS_PWC) + #if ENABLED(TFT_LVGL_UI) + #undef PSU_CONTROL + #undef MKS_PWC + #define SUICIDE_PIN PB2 + #define SUICIDE_PIN_STATE LOW + #else + #define PS_ON_PIN PB2 // PW_OFF #endif - #ifndef PS_ON_PIN - #define PS_ON_PIN PB2 // SUICIDE - #endif - #ifndef KILL_PIN - #define KILL_PIN PA13 // PW_DET - #define KILL_PIN_STATE HIGH - #endif -#else - #define SUICIDE_PIN PB2 - #define SUICIDE_PIN_INVERTING false -#endif - -#ifndef POWER_LOSS_PIN - #define POWER_LOSS_PIN PA13 // PW_DET + #define KILL_PIN PA13 // PW_DET + #define KILL_PIN_STATE HIGH #endif // Random Info @@ -232,9 +228,9 @@ // MKS WIFI MODULE #if ENABLED(MKS_WIFI_MODULE) - #define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN - #define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN - #define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN + #define WIFI_IO0_PIN PC13 + #define WIFI_IO1_PIN PC7 + #define WIFI_RESET_PIN PE9 #endif // MKS TEST @@ -276,10 +272,10 @@ #define SPI_DEVICE 2 #define SPI_FLASH_SIZE 0x1000000 #if ENABLED(SPI_FLASH) - #define W25QXX_CS_PIN PB12 - #define W25QXX_MOSI_PIN PC3 - #define W25QXX_MISO_PIN PC2 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 + #define SPI_FLASH_MOSI_PIN PC3 + #define SPI_FLASH_MISO_PIN PC2 + #define SPI_FLASH_SCK_PIN PB13 #endif /** diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 2e47f98e9f..c2809c8553 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -195,18 +195,18 @@ // // Misc. Functions // +//#define POWER_LOSS_PIN PA2 // PW_DET //#define PS_ON_PIN PA3 // PW_OFF // // Power Supply Control // -#if ENABLED(PSU_CONTROL) // MKSPWC - //#define SUICIDE_PIN PB2 // LED - //#define KILL_PIN PA2 // PW_DET - //#define KILL_PIN_STATE HIGH +#if ENABLED(MKS_PWC) + #define SUICIDE_PIN PB2 + #define KILL_PIN PA2 + #define KILL_PIN_STATE LOW #else - //#define POWER_LOSS_PIN PA2 // PW_DET - //#define LED_PIN PB2 + #define LED_PIN PB2 #endif #ifndef SDCARD_CONNECTION @@ -251,14 +251,14 @@ // // LCD / Controller #define SPI_FLASH -#define HAS_SPI_FLASH 1 +#define HAS_SPI_FLASH 1 #define SPI_DEVICE 2 #define SPI_FLASH_SIZE 0x1000000 #if ENABLED(SPI_FLASH) - #define W25QXX_CS_PIN PB12 - #define W25QXX_MOSI_PIN PB15 - #define W25QXX_MISO_PIN PB14 - #define W25QXX_SCK_PIN PB13 + #define SPI_FLASH_CS_PIN PB12 + #define SPI_FLASH_MOSI_PIN PB15 + #define SPI_FLASH_MISO_PIN PB14 + #define SPI_FLASH_SCK_PIN PB13 #endif /**