1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 21:36:21 +00:00

🎨 Update MKSPWC, some other pins (#22557)

This commit is contained in:
Scott Lahteine 2021-08-13 16:32:25 -05:00 committed by Scott Lahteine
parent e62486a610
commit eb0d80cb19
41 changed files with 279 additions and 321 deletions

View File

@ -367,6 +367,7 @@
//#define PSU_NAME "Power Supply" //#define PSU_NAME "Power Supply"
#if ENABLED(PSU_CONTROL) #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_CONFIRM // Confirm dialog when power off
//#define PS_OFF_SOUND // Beep 1s 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 #define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box

View File

@ -594,18 +594,14 @@
SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS); SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS);
SPI_Enable(SPI0); SPI_Enable(SPI0);
SET_OUTPUT(DAC0_SYNC); SET_OUTPUT(DAC0_SYNC_PIN);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
SET_OUTPUT(DAC1_SYNC); OUT_WRITE(DAC1_SYNC_PIN, HIGH);
WRITE(DAC1_SYNC, HIGH);
#endif #endif
SET_OUTPUT(SPI_EEPROM1_CS); WRITE(DAC0_SYNC_PIN, HIGH);
SET_OUTPUT(SPI_EEPROM2_CS); OUT_WRITE(SPI_EEPROM1_CS_PIN, HIGH);
SET_OUTPUT(SPI_FLASH_CS); OUT_WRITE(SPI_EEPROM2_CS_PIN, HIGH);
WRITE(DAC0_SYNC, HIGH); OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
WRITE(SPI_EEPROM1_CS, HIGH);
WRITE(SPI_EEPROM2_CS, HIGH);
WRITE(SPI_FLASH_CS, HIGH);
WRITE(SD_SS_PIN, HIGH); WRITE(SD_SS_PIN, HIGH);
OUT_WRITE(SDSS, LOW); OUT_WRITE(SDSS, LOW);

View File

@ -44,7 +44,7 @@ bool PersistentStore::access_start() {
SET_OUTPUT(BOARD_SPI1_SCK_PIN); SET_OUTPUT(BOARD_SPI1_SCK_PIN);
SET_OUTPUT(BOARD_SPI1_MOSI_PIN); SET_OUTPUT(BOARD_SPI1_MOSI_PIN);
SET_INPUT(BOARD_SPI1_MISO_PIN); SET_INPUT(BOARD_SPI1_MISO_PIN);
SET_OUTPUT(SPI_EEPROM1_CS); SET_OUTPUT(SPI_EEPROM1_CS_PIN);
#endif #endif
spiInit(0); spiInit(0);
#endif #endif

View File

@ -49,8 +49,8 @@ static void _eeprom_begin(uint8_t * const pos, const uint8_t cmd) {
(unsigned(pos) >> 8) & 0xFF, // Address High (unsigned(pos) >> 8) & 0xFF, // Address High
unsigned(pos) & 0xFF // Address Low unsigned(pos) & 0xFF // Address Low
}; };
WRITE(SPI_EEPROM1_CS, HIGH); // Usually free already WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Usually free already
WRITE(SPI_EEPROM1_CS, LOW); // Activate the Bus WRITE(SPI_EEPROM1_CS_PIN, LOW); // Activate the Bus
spiSend(SPI_CHAN_EEPROM1, eeprom_temp, 3); spiSend(SPI_CHAN_EEPROM1, eeprom_temp, 3);
// Leave the Bus in-use // 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 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; return v;
} }
void eeprom_write_byte(uint8_t *pos, uint8_t value) { void eeprom_write_byte(uint8_t *pos, uint8_t value) {
const uint8_t eeprom_temp = CMD_WREN; 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 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 delay(1); // For a small amount of time
_eeprom_begin(pos, CMD_WRITE); // Set write address and begin transmission _eeprom_begin(pos, CMD_WRITE); // Set write address and begin transmission
spiSend(SPI_CHAN_EEPROM1, value); // Send the value to be written 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 delay(EEPROM_WRITE_DELAY); // Give page write time to complete
} }

View File

@ -1192,7 +1192,7 @@ void setup() {
#if HAS_SUICIDE #if HAS_SUICIDE
SETUP_LOG("SUICIDE_PIN"); SETUP_LOG("SUICIDE_PIN");
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE);
#endif #endif
#ifdef JTAGSWD_RESET #ifdef JTAGSWD_RESET

View File

@ -84,7 +84,7 @@ extern bool wait_for_heatup;
bool pin_is_protected(const pin_t pin); bool pin_is_protected(const pin_t pin);
#if HAS_SUICIDE #if HAS_SUICIDE
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); } inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_STATE); }
#endif #endif
#if HAS_KILL #if HAS_KILL

View File

@ -20,35 +20,35 @@ void dac084s085::begin() {
uint8_t externalDac_buf[] = { 0x20, 0x00 }; // all off uint8_t externalDac_buf[] = { 0x20, 0x00 }; // all off
// All SPI chip-select HIGH // All SPI chip-select HIGH
SET_OUTPUT(DAC0_SYNC); SET_OUTPUT(DAC0_SYNC_PIN);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
SET_OUTPUT(DAC1_SYNC); SET_OUTPUT(DAC1_SYNC_PIN);
#endif #endif
cshigh(); cshigh();
spiBegin(); spiBegin();
//init onboard DAC //init onboard DAC
DELAY_US(2); DELAY_US(2);
WRITE(DAC0_SYNC, LOW); WRITE(DAC0_SYNC_PIN, LOW);
DELAY_US(2); DELAY_US(2);
WRITE(DAC0_SYNC, HIGH); WRITE(DAC0_SYNC_PIN, HIGH);
DELAY_US(2); DELAY_US(2);
WRITE(DAC0_SYNC, LOW); WRITE(DAC0_SYNC_PIN, LOW);
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf)); spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
WRITE(DAC0_SYNC, HIGH); WRITE(DAC0_SYNC_PIN, HIGH);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
//init Piggy DAC //init Piggy DAC
DELAY_US(2); DELAY_US(2);
WRITE(DAC1_SYNC, LOW); WRITE(DAC1_SYNC_PIN, LOW);
DELAY_US(2); DELAY_US(2);
WRITE(DAC1_SYNC, HIGH); WRITE(DAC1_SYNC_PIN, HIGH);
DELAY_US(2); DELAY_US(2);
WRITE(DAC1_SYNC, LOW); WRITE(DAC1_SYNC_PIN, LOW);
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf)); spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
WRITE(DAC1_SYNC, HIGH); WRITE(DAC1_SYNC_PIN, HIGH);
#endif #endif
return; return;
@ -66,18 +66,18 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
cshigh(); cshigh();
if (channel > 3) { // DAC Piggy E1,E2,E3 if (channel > 3) { // DAC Piggy E1,E2,E3
WRITE(DAC1_SYNC, LOW); WRITE(DAC1_SYNC_PIN, LOW);
DELAY_US(2); DELAY_US(2);
WRITE(DAC1_SYNC, HIGH); WRITE(DAC1_SYNC_PIN, HIGH);
DELAY_US(2); DELAY_US(2);
WRITE(DAC1_SYNC, LOW); WRITE(DAC1_SYNC_PIN, LOW);
} }
else { // DAC onboard X,Y,Z,E0 else { // DAC onboard X,Y,Z,E0
WRITE(DAC0_SYNC, LOW); WRITE(DAC0_SYNC_PIN, LOW);
DELAY_US(2); DELAY_US(2);
WRITE(DAC0_SYNC, HIGH); WRITE(DAC0_SYNC_PIN, HIGH);
DELAY_US(2); DELAY_US(2);
WRITE(DAC0_SYNC, LOW); WRITE(DAC0_SYNC_PIN, LOW);
} }
DELAY_US(2); DELAY_US(2);
@ -85,13 +85,13 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
} }
void dac084s085::cshigh() { void dac084s085::cshigh() {
WRITE(DAC0_SYNC, HIGH); WRITE(DAC0_SYNC_PIN, HIGH);
#if HAS_MULTI_EXTRUDER #if HAS_MULTI_EXTRUDER
WRITE(DAC1_SYNC, HIGH); WRITE(DAC1_SYNC_PIN, HIGH);
#endif #endif
WRITE(SPI_EEPROM1_CS, HIGH); WRITE(SPI_EEPROM1_CS_PIN, HIGH);
WRITE(SPI_EEPROM2_CS, HIGH); WRITE(SPI_EEPROM2_CS_PIN, HIGH);
WRITE(SPI_FLASH_CS, HIGH); WRITE(SPI_FLASH_CS_PIN, HIGH);
WRITE(SD_SS_PIN, HIGH); WRITE(SD_SS_PIN, HIGH);
} }

View File

@ -60,7 +60,7 @@
* a print without suicide... * a print without suicide...
*/ */
#if HAS_SUICIDE #if HAS_SUICIDE
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE);
#endif #endif
TERN_(HAS_LCD_MENU, ui.reset_status()); TERN_(HAS_LCD_MENU, ui.reset_status());

View File

@ -3475,6 +3475,13 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#endif #endif
#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 * Ensure this option is set intentionally
*/ */

View File

@ -28,9 +28,9 @@
#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500) #define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500)
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR) #if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
#define MT_DET_1_PIN 1 #define MT_DET_1_PIN 1
#define MT_DET_2_PIN 2 #define MT_DET_2_PIN 2
#define MT_DET_PIN_INVERTING false #define MT_DET_PIN_STATE LOW
#endif #endif
#define MKS_FINSH #define MKS_FINSH

View File

@ -1495,17 +1495,17 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) {
break; break;
case UNRUNOUT_STATUS: 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; runout_mks.runout_status = RUNOUT_STATUS;
break; break;
case RUNOUT_BEGIN_STATUS: 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; runout_mks.runout_status = RUNOUT_WAITTING_STATUS;
break; break;
case RUNOUT_WAITTING_STATUS: 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; runout_mks.runout_status = RUNOUT_BEGIN_STATUS;
break; break;

View File

@ -163,7 +163,7 @@ void filament_check() {
#endif #endif
#if PIN_EXISTS(MT_DET_1) #if PIN_EXISTS(MT_DET_1)
static int fil_det_count_1 = 0; 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++; fil_det_count_1++;
else if (fil_det_count_1 > 0) else if (fil_det_count_1 > 0)
fil_det_count_1--; fil_det_count_1--;
@ -171,7 +171,7 @@ void filament_check() {
#if PIN_EXISTS(MT_DET_2) #if PIN_EXISTS(MT_DET_2)
static int fil_det_count_2 = 0; 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++; fil_det_count_2++;
else if (fil_det_count_2 > 0) else if (fil_det_count_2 > 0)
fil_det_count_2--; fil_det_count_2--;
@ -179,7 +179,7 @@ void filament_check() {
#if PIN_EXISTS(MT_DET_3) #if PIN_EXISTS(MT_DET_3)
static int fil_det_count_3 = 0; 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++; fil_det_count_3++;
else if (fil_det_count_3 > 0) else if (fil_det_count_3 > 0)
fil_det_count_3--; fil_det_count_3--;

View File

@ -28,26 +28,14 @@
W25QXXFlash W25QXX; 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 #ifndef NC
#define NC -1 #define NC -1
#endif #endif
MarlinSPI W25QXXFlash::mySPI(SPI_FLASH_MOSI_PIN, SPI_FLASH_MISO_PIN, SPI_FLASH_SCK_PIN, NC); 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 SPI_FLASH_CS_H() OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
#define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW) #define SPI_FLASH_CS_L() OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
bool flash_dma_mode = true; 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 W25QXXFlash::W25QXX_ReadID(void) {
uint16_t Temp = 0; uint16_t Temp = 0;
W25QXX_CS_L; SPI_FLASH_CS_L();
spi_flash_Send(0x90); spi_flash_Send(0x90);
spi_flash_Send(0x00); spi_flash_Send(0x00);
spi_flash_Send(0x00); spi_flash_Send(0x00);
spi_flash_Send(0x00); spi_flash_Send(0x00);
Temp |= spi_flash_Rec() << 8; Temp |= spi_flash_Rec() << 8;
Temp |= spi_flash_Rec(); Temp |= spi_flash_Rec();
W25QXX_CS_H; SPI_FLASH_CS_H();
return Temp; return Temp;
} }
void W25QXXFlash::SPI_FLASH_WriteEnable(void) { void W25QXXFlash::SPI_FLASH_WriteEnable(void) {
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
W25QXX_CS_L; SPI_FLASH_CS_L();
// Send "Write Enable" instruction // Send "Write Enable" instruction
spi_flash_Send(W25X_WriteEnable); spi_flash_Send(W25X_WriteEnable);
// Deselect the FLASH: Chip Select high // 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; uint8_t FLASH_Status = 0;
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
W25QXX_CS_L; SPI_FLASH_CS_L();
// Send "Read Status Register" instruction // Send "Read Status Register" instruction
spi_flash_Send(W25X_ReadStatusReg); spi_flash_Send(W25X_ReadStatusReg);
@ -179,7 +167,7 @@ void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) {
while ((FLASH_Status & WIP_Flag) == 0x01); // Write in progress while ((FLASH_Status & WIP_Flag) == 0x01); // Write in progress
// Deselect the FLASH: Chip Select high // Deselect the FLASH: Chip Select high
W25QXX_CS_H; SPI_FLASH_CS_H();
} }
void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) { void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
@ -188,7 +176,7 @@ void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
// Sector Erase // Sector Erase
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
W25QXX_CS_L; SPI_FLASH_CS_L();
// Send Sector Erase instruction // Send Sector Erase instruction
spi_flash_Send(W25X_SectorErase); spi_flash_Send(W25X_SectorErase);
// Send SectorAddr high nybble address byte // Send SectorAddr high nybble address byte
@ -199,14 +187,14 @@ void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
spi_flash_Send(SectorAddr & 0xFF); spi_flash_Send(SectorAddr & 0xFF);
// Deselect the FLASH: Chip Select high // Deselect the FLASH: Chip Select high
W25QXX_CS_H; SPI_FLASH_CS_H();
// Wait the end of Flash writing // Wait the end of Flash writing
SPI_FLASH_WaitForWriteEnd(); SPI_FLASH_WaitForWriteEnd();
} }
void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) { void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
SPI_FLASH_WriteEnable(); SPI_FLASH_WriteEnable();
W25QXX_CS_L; SPI_FLASH_CS_L();
// Send Sector Erase instruction // Send Sector Erase instruction
spi_flash_Send(W25X_BlockErase); spi_flash_Send(W25X_BlockErase);
// Send SectorAddr high nybble address byte // Send SectorAddr high nybble address byte
@ -216,7 +204,7 @@ void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
// Send SectorAddr low nybble address byte // Send SectorAddr low nybble address byte
spi_flash_Send(BlockAddr & 0xFF); spi_flash_Send(BlockAddr & 0xFF);
W25QXX_CS_H; SPI_FLASH_CS_H();
SPI_FLASH_WaitForWriteEnd(); SPI_FLASH_WaitForWriteEnd();
} }
@ -234,12 +222,12 @@ void W25QXXFlash::SPI_FLASH_BulkErase(void) {
// Bulk Erase // Bulk Erase
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
W25QXX_CS_L; SPI_FLASH_CS_L();
// Send Bulk Erase instruction // Send Bulk Erase instruction
spi_flash_Send(W25X_ChipErase); spi_flash_Send(W25X_ChipErase);
// Deselect the FLASH: Chip Select high // Deselect the FLASH: Chip Select high
W25QXX_CS_H; SPI_FLASH_CS_H();
// Wait the end of Flash writing // Wait the end of Flash writing
SPI_FLASH_WaitForWriteEnd(); SPI_FLASH_WaitForWriteEnd();
} }
@ -262,7 +250,7 @@ void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint
SPI_FLASH_WriteEnable(); SPI_FLASH_WriteEnable();
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
W25QXX_CS_L; SPI_FLASH_CS_L();
// Send "Write to Memory " instruction // Send "Write to Memory " instruction
spi_flash_Send(W25X_PageProgram); spi_flash_Send(W25X_PageProgram);
// Send WriteAddr high nybble address byte to write to // 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 // Deselect the FLASH: Chip Select high
W25QXX_CS_H; SPI_FLASH_CS_H();
// Wait the end of Flash writing // Wait the end of Flash writing
SPI_FLASH_WaitForWriteEnd(); 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) { void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
// Select the FLASH: Chip Select low // Select the FLASH: Chip Select low
W25QXX_CS_L; SPI_FLASH_CS_L();
// Send "Read from Memory " instruction // Send "Read from Memory " instruction
spi_flash_Send(W25X_ReadData); spi_flash_Send(W25X_ReadData);
@ -389,7 +377,7 @@ void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint
else else
spi_flash_Read(pBuffer, NumByteToRead); spi_flash_Read(pBuffer, NumByteToRead);
W25QXX_CS_H; SPI_FLASH_CS_H();
} }
#endif // HAS_SPI_FLASH #endif // HAS_SPI_FLASH

View File

@ -416,10 +416,10 @@
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_DEVICE 1 #define SPI_DEVICE 1
#define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN 31 #define SPI_FLASH_CS_PIN 31
#define W25QXX_MOSI_PIN SD_MOSI_PIN #define SPI_FLASH_MOSI_PIN SD_MOSI_PIN
#define W25QXX_MISO_PIN SD_MISO_PIN #define SPI_FLASH_MISO_PIN SD_MISO_PIN
#define W25QXX_SCK_PIN SD_SCK_PIN #define SPI_FLASH_SCK_PIN SD_SCK_PIN
#endif #endif
#define TFT_BUFFER_SIZE 0xFFFF #define TFT_BUFFER_SIZE 0xFFFF

View File

@ -138,14 +138,10 @@
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#ifndef PS_ON_PIN #define PS_ON_PIN P0_25 // SERVO
#define PS_ON_PIN P0_25 // SERVO #define KILL_PIN P1_29 // Z+
#endif #define KILL_PIN_STATE HIGH
#ifndef KILL_PIN
#define KILL_PIN P1_29 // Z+
#define KILL_PIN_STATE HIGH
#endif
#endif #endif
// //

View File

@ -218,14 +218,10 @@
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#ifndef PS_ON_PIN #define PS_ON_PIN P2_00 // SERVO
#define PS_ON_PIN P2_00 // SERVO #define KILL_PIN P1_24 // Z+
#endif #define KILL_PIN_STATE HIGH
#ifndef KILL_PIN
#define KILL_PIN P1_24 // Z+
#define KILL_PIN_STATE HIGH
#endif
#endif #endif
// //

View File

@ -229,14 +229,10 @@
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#ifndef PS_ON_PIN #define PS_ON_PIN P2_00 // SERVO
#define PS_ON_PIN P2_00 // Suggestion (SERVO) #define KILL_PIN P1_24 // Z+
#endif #define KILL_PIN_STATE HIGH
#ifndef KILL_PIN
#define KILL_PIN P1_24 // Suggestion (Z+)
#define KILL_PIN_STATE HIGH
#endif
#endif #endif
// //

View File

@ -291,11 +291,11 @@
#if PIN_EXISTS(DAC_DISABLE) #if PIN_EXISTS(DAC_DISABLE)
REPORT_NAME_DIGITAL(__LINE__, DAC_DISABLE_PIN) REPORT_NAME_DIGITAL(__LINE__, DAC_DISABLE_PIN)
#endif #endif
#if defined(DAC0_SYNC) && DAC0_SYNC >= 0 #if PIN_EXISTS(DAC0_SYNC)
REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC) REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC_PIN)
#endif #endif
#if defined(DAC1_SYNC) && DAC1_SYNC >= 0 #if PIN_EXISTS(DAC1_SYNC)
REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC) REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC_PIN)
#endif #endif
#if PIN_EXISTS(DEBUG) #if PIN_EXISTS(DEBUG)
REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN) REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN)
@ -974,14 +974,14 @@
#if defined(SPARE_IO) && SPARE_IO >= 0 #if defined(SPARE_IO) && SPARE_IO >= 0
REPORT_NAME_DIGITAL(__LINE__, SPARE_IO) REPORT_NAME_DIGITAL(__LINE__, SPARE_IO)
#endif #endif
#if defined(SPI_EEPROM1_CS) && SPI_EEPROM1_CS >= 0 #if PIN_EXISTS(SPI_EEPROM1_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS) REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS_PIN)
#endif #endif
#if defined(SPI_EEPROM2_CS) && SPI_EEPROM2_CS >= 0 #if PIN_EXISTS(SPI_EEPROM2_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS) REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS_PIN)
#endif #endif
#if defined(SPI_FLASH_CS) && SPI_FLASH_CS >= 0 #if PIN_EXISTS(SPI_FLASH_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS) REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS_PIN)
#endif #endif
#if PIN_EXISTS(SPINDLE_DIR) #if PIN_EXISTS(SPINDLE_DIR)
REPORT_NAME_DIGITAL(__LINE__, SPINDLE_DIR_PIN) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_DIR_PIN)

View File

@ -391,8 +391,8 @@
#ifndef SUICIDE_PIN #ifndef SUICIDE_PIN
#define SUICIDE_PIN -1 #define SUICIDE_PIN -1
#endif #endif
#ifndef SUICIDE_PIN_INVERTING #ifndef SUICIDE_PIN_STATE
#define SUICIDE_PIN_INVERTING false #define SUICIDE_PIN_STATE LOW
#endif #endif
#ifndef NUM_SERVO_PLUGS #ifndef NUM_SERVO_PLUGS

View File

@ -34,7 +34,7 @@
#endif #endif
#define RESET_PIN 30 #define RESET_PIN 30
#define SPI_FLASH_CS 83 #define SPI_FLASH_CS_PIN 83
// //
// Servos // Servos

View File

@ -63,6 +63,6 @@
#define EXP4_PIN 12 // PS_ON_PIN #define EXP4_PIN 12 // PS_ON_PIN
#define SUICIDE_PIN 12 // Used by CR2020 Industrial series #define SUICIDE_PIN 12 // Used by CR2020 Industrial series
#ifndef SUICIDE_PIN_INVERTING #ifndef SUICIDE_PIN_STATE
#define SUICIDE_PIN_INVERTING true #define SUICIDE_PIN_STATE HIGH
#endif #endif

View File

@ -123,20 +123,20 @@
#define SPI_CHAN_DAC 1 #define SPI_CHAN_DAC 1
#define DAC0_SYNC 53 // PB14 #define DAC0_SYNC_PIN 53 // PB14
#define DAC1_SYNC 6 // PC24 #define DAC1_SYNC_PIN 6 // PC24
// 64K SPI EEPROM // 64K SPI EEPROM
#define SPI_EEPROM #define SPI_EEPROM
#define SPI_CHAN_EEPROM1 2 #define SPI_CHAN_EEPROM1 2
#define SPI_EEPROM1_CS 25 // PD0 #define SPI_EEPROM1_CS_PIN 25 // PD0
// 2K SPI EEPROM // 2K SPI EEPROM
#define SPI_EEPROM2_CS 26 // PD1 #define SPI_EEPROM2_CS_PIN 26 // PD1
// FLASH SPI // FLASH SPI
// 32Mb // 32Mb
#define SPI_FLASH_CS 23 // PA14 #define SPI_FLASH_CS_PIN 23 // PA14
// //
// LCD / Controller // LCD / Controller

View File

@ -190,11 +190,11 @@
//#define EEPROM_SD // EEPROM on SDCARD //#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ? //#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ? //#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM // 2K EEPROM
//#define SPI_EEPROM2_CS ? //#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH // 32Mb FLASH
//#define SPI_FLASH_CS ? //#define SPI_FLASH_CS_PIN ?
// //
// LCD / Controller // LCD / Controller

View File

@ -176,11 +176,11 @@
//#define EEPROM_SD // EEPROM on SDCARD //#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ? //#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ? //#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM // 2K EEPROM
//#define SPI_EEPROM2_CS ? //#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH // 32Mb FLASH
//#define SPI_FLASH_CS ? //#define SPI_FLASH_CS_PIN ?
// //
// LCD / Controller // LCD / Controller

View File

@ -137,13 +137,13 @@
// SPI Buses // SPI Buses
// //
#define DAC0_SYNC 53 // PB14 #define DAC0_SYNC_PIN 53 // PB14
#define SPI_CHAN_DAC 1 #define SPI_CHAN_DAC 1
#define SPI_CHAN_EEPROM1 -1 #define SPI_CHAN_EEPROM1 -1
#define SPI_EEPROM1_CS -1 #define SPI_EEPROM1_CS_PIN -1
#define SPI_EEPROM2_CS -1 #define SPI_EEPROM2_CS_PIN -1
#define SPI_FLASH_CS -1 #define SPI_FLASH_CS_PIN -1
#define SD_SCK_PIN 76 #define SD_SCK_PIN 76
#define SD_MISO_PIN 74 #define SD_MISO_PIN 74

View File

@ -179,6 +179,6 @@
#endif #endif
#define SUICIDE_PIN PC13 #define SUICIDE_PIN PC13
#ifndef SUICIDE_PIN_INVERTING #ifndef SUICIDE_PIN_STATE
#define SUICIDE_PIN_INVERTING false #define SUICIDE_PIN_STATE LOW
#endif #endif

View File

@ -120,10 +120,10 @@
#endif #endif
// SPI 2 // SPI 2
#define W25QXX_CS_PIN PB12 #define SPI_FLASH_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
// //
// TFT with FSMC interface // TFT with FSMC interface

View File

@ -61,13 +61,13 @@
// SPI // SPI
//#define SPI_EEPROM // EEPROM on SPI-0 //#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ? //#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ? //#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM // 2K EEPROM
//#define SPI_EEPROM2_CS ? //#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH // 32Mb FLASH
//#define SPI_FLASH_CS ? //#define SPI_FLASH_CS_PIN ?
#endif #endif
// //

View File

@ -73,10 +73,10 @@
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
// SPI 2 // SPI 2
#define W25QXX_CS_PIN PB12 // SPI2_NSS / Flash chip-select #define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif
// //
@ -222,9 +222,11 @@
//#define PS_ON_PIN PA3 // PW_CN /PW_OFF //#define PS_ON_PIN PA3 // PW_CN /PW_OFF
#endif #endif
#define MT_DET_1_PIN PA4 // MT_DET #if HAS_TFT_LVGL_UI
#define MT_DET_2_PIN PE6 // FALA_CRTL #define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_PIN_INVERTING false #define MT_DET_2_PIN PE6
#define MT_DET_PIN_STATE LOW
#endif
// //
// LED / NEOPixel // LED / NEOPixel

View File

@ -170,18 +170,18 @@
#if ENABLED(SPI_EEPROM) #if ENABLED(SPI_EEPROM)
// SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits) // SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits)
#define SPI_CHAN_EEPROM1 1 #define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PC5 // pin 34 #define SPI_EEPROM1_CS_PIN PC5 // pin 34
#define EEPROM_SCK BOARD_SPI1_SCK_PIN // PA5 pin 30 #define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 pin 30
#define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31 #define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 pin 31
#define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32 #define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet) #define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#elif HAS_SPI_FLASH #elif HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x40000U // limit to 256KB (M993 will reboot with 512) #define SPI_FLASH_SIZE 0x40000U // limit to 256KB (M993 will reboot with 512)
#define W25QXX_CS_PIN PC5 #define SPI_FLASH_CS_PIN PC5
#define W25QXX_MOSI_PIN PA7 #define SPI_FLASH_MOSI_PIN PA7
#define W25QXX_MISO_PIN PA6 #define SPI_FLASH_MISO_PIN PA6
#define W25QXX_SCK_PIN PA5 #define SPI_FLASH_SCK_PIN PA5
#elif ENABLED(FLASH_EEPROM_EMULATION) #elif ENABLED(FLASH_EEPROM_EMULATION)
// SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h) // SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
#define EEPROM_PAGE_SIZE (0x800U) // 2KB #define EEPROM_PAGE_SIZE (0x800U) // 2KB

View File

@ -275,8 +275,8 @@
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x800000 // 8MB #define SPI_FLASH_SIZE 0x800000 // 8MB
#define W25QXX_CS_PIN PG9 #define SPI_FLASH_CS_PIN PG9
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif

View File

@ -183,19 +183,19 @@
// Misc. Functions // Misc. Functions
// //
#if HAS_TFT_LVGL_UI #if HAS_TFT_LVGL_UI
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#define SUICIDE_PIN PB2 // PW_OFF #define SUICIDE_PIN PB2
#define SUICIDE_PIN_INVERTING false #define SUICIDE_PIN_STATE LOW
#define KILL_PIN PA2 // PW_DET #define KILL_PIN PA2
#define KILL_PIN_STATE HIGH #define KILL_PIN_STATE HIGH
#endif #endif
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN #define MT_DET_1_PIN PA4
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE #define MT_DET_PIN_STATE LOW
#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN #define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN #define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN #define WIFI_RESET_PIN PE9
#if ENABLED(MKS_TEST) #if ENABLED(MKS_TEST)
#define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
@ -363,10 +363,10 @@
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 #define SPI_FLASH_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif
#ifndef BEEPER_PIN #ifndef BEEPER_PIN

View File

@ -129,14 +129,10 @@
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#ifndef PS_ON_PIN #define PS_ON_PIN PA14 // PW_OFF
#define PS_ON_PIN PA14 // PW_OFF #define KILL_PIN PB10 // PW_DET
#endif #define KILL_PIN_STATE HIGH
#ifndef KILL_PIN
#define KILL_PIN PB10 // PW_DET
#define KILL_PIN_STATE HIGH
#endif
#endif #endif
/** /**

View File

@ -119,8 +119,10 @@
#define POWER_LOSS_PIN PA2 // PW_DET #define POWER_LOSS_PIN PA2 // PW_DET
#define PS_ON_PIN PA3 // PW_OFF #define PS_ON_PIN PA3 // PW_OFF
#define MT_DET_1_PIN PA4 #if HAS_TFT_LVGL_UI
#define MT_DET_PIN_INVERTING false #define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_PIN_STATE LOW
#endif
#define WIFI_IO0_PIN PC13 #define WIFI_IO0_PIN PC13
@ -194,8 +196,8 @@
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 // Flash chip-select #define SPI_FLASH_CS_PIN PB12 // Flash chip-select
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif

View File

@ -130,33 +130,30 @@
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#if HAS_TFT_LVGL_UI #if ENABLED(TFT_LVGL_UI)
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." #undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PB2 // PW_OFF
#endif #endif
#ifndef PS_ON_PIN #define KILL_PIN PA2
#define PS_ON_PIN PB2 // SUICIDE #define KILL_PIN_STATE HIGH
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2
#define KILL_PIN_STATE HIGH
#endif
#else
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_INVERTING false
#endif #endif
// //
// Misc. Functions // Misc. Functions
// //
#if HAS_TFT_LVGL_UI #if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN #define MT_DET_1_PIN PA4
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN #define MT_DET_2_PIN PE6
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE #define MT_DET_PIN_STATE LOW
#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN #define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN #define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PA5 // MKS ESP WIFI RESET PIN #define WIFI_RESET_PIN PA5
#else #else
//#define POWER_LOSS_PIN PA2 // PW_DET //#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PB2 // PW_OFF //#define PS_ON_PIN PB2 // PW_OFF
@ -221,8 +218,8 @@
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 #define SPI_FLASH_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif

View File

@ -194,34 +194,30 @@
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#if HAS_TFT_LVGL_UI #if ENABLED(TFT_LVGL_UI)
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." #undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PB2 // PW_OFF
#endif #endif
#ifndef PS_ON_PIN #define KILL_PIN PA2
#define PS_ON_PIN PB2 // SUICIDE #define KILL_PIN_STATE HIGH
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2
#define KILL_PIN_STATE HIGH
#endif
#else
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_INVERTING false
#endif #endif
// //
// Misc. Functions // Misc. Functions
// //
#if HAS_TFT_LVGL_UI #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 WIFI_IO0_PIN PC13
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN #define WIFI_IO1_PIN PC7
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE #define WIFI_RESET_PIN PE9
#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
#if ENABLED(MKS_TEST) #if ENABLED(MKS_TEST)
#define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET #define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
@ -390,10 +386,10 @@
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 #define SPI_FLASH_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif
#ifndef BEEPER_PIN #ifndef BEEPER_PIN

View File

@ -186,20 +186,17 @@
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#if HAS_TFT_LVGL_UI #if ENABLED(TFT_LVGL_UI)
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." #undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PG11
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PG11 // PW_OFF
#endif #endif
#ifndef PS_ON_PIN #define KILL_PIN PA2
#define PS_ON_PIN PG11 // SUICIDE #define KILL_PIN_STATE HIGH
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2
#define KILL_PIN_STATE HIGH
#endif
#else
#define SUICIDE_PIN PG11
#define SUICIDE_PIN_INVERTING false
#endif #endif
// //
@ -318,8 +315,8 @@
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB #define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 // Flash chip-select #define SPI_FLASH_CS_PIN PB12 // Flash chip-select
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif

View File

@ -179,10 +179,10 @@
#if ENABLED(SPI_EEPROM) #if ENABLED(SPI_EEPROM)
// Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf // Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf
#define SPI_CHAN_EEPROM1 1 #define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PB12 // datasheet: /CS pin, found with multimeter, not tested #define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested
#define EEPROM_SCK PB13 // datasheet: CLK pin, found with multimeter, not tested #define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested
#define EEPROM_MISO PB14 // datasheet: DO pin, found with multimeter, not tested #define EEPROM_MISO_PIN PB14 // datasheet: DO pin, found with multimeter, not tested
#define EEPROM_MOSI PB15 // datasheet: DI 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 EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now... #define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#else #else

View File

@ -210,32 +210,24 @@
// //
// Misc. Functions // Misc. Functions
// //
#define MT_DET_1 PC5 // Y+ #define PW_DET PC5 // Y+
#define MT_DET_2 PB12 // Z+ #define PW_OFF PB12 // Z+
#define MT_DET_1_PIN PW_DET
#define MT_DET_2_PIN PW_OFF
#ifndef FIL_RUNOUT_PIN #ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN MT_DET_1 #define FIL_RUNOUT_PIN MT_DET_1_PIN
#endif #endif
#ifndef FIL_RUNOUT2_PIN #ifndef FIL_RUNOUT2_PIN
#define FIL_RUNOUT2_PIN MT_DET_2 #define FIL_RUNOUT2_PIN MT_DET_2_PIN
#endif #endif
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#ifndef PS_ON_PIN #define PS_ON_PIN PW_OFF
#define PS_ON_PIN MT_DET_2 // Z+ #define KILL_PIN PW_DET
#endif #define KILL_PIN_STATE HIGH
#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
#endif #endif
// Random Info // Random Info

View File

@ -178,9 +178,11 @@
// //
// Misc. Functions // Misc. Functions
// //
#define MT_DET_1_PIN PA4 #if HAS_TFT_LVGL_UI
#define MT_DET_2_PIN PE6 #define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE #define MT_DET_2_PIN PE6
#define MT_DET_PIN_STATE LOW
#endif
#ifndef FIL_RUNOUT_PIN #ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN MT_DET_1_PIN #define FIL_RUNOUT_PIN MT_DET_1_PIN
@ -189,35 +191,29 @@
#define FIL_RUNOUT2_PIN MT_DET_2_PIN #define FIL_RUNOUT2_PIN MT_DET_2_PIN
#endif #endif
// #ifndef POWER_LOSS_PIN
// Enable MKSPWC support #define POWER_LOSS_PIN PA13 // PW_DET
// #endif
//#define SUICIDE_PIN PB2 //#define SUICIDE_PIN PB2
//#define LED_PIN PB2 //#define LED_PIN PB2
//#define KILL_PIN PA2 //#define KILL_PIN PA2
//#define KILL_PIN_STATE HIGH //#define KILL_PIN_STATE LOW
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
#if HAS_TFT_LVGL_UI #if ENABLED(TFT_LVGL_UI)
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue." #undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PB2 // PW_OFF
#endif #endif
#ifndef PS_ON_PIN #define KILL_PIN PA13 // PW_DET
#define PS_ON_PIN PB2 // SUICIDE #define KILL_PIN_STATE HIGH
#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
#endif #endif
// Random Info // Random Info
@ -232,9 +228,9 @@
// MKS WIFI MODULE // MKS WIFI MODULE
#if ENABLED(MKS_WIFI_MODULE) #if ENABLED(MKS_WIFI_MODULE)
#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN #define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN #define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN #define WIFI_RESET_PIN PE9
#endif #endif
// MKS TEST // MKS TEST
@ -276,10 +272,10 @@
#define SPI_DEVICE 2 #define SPI_DEVICE 2
#define SPI_FLASH_SIZE 0x1000000 #define SPI_FLASH_SIZE 0x1000000
#if ENABLED(SPI_FLASH) #if ENABLED(SPI_FLASH)
#define W25QXX_CS_PIN PB12 #define SPI_FLASH_CS_PIN PB12
#define W25QXX_MOSI_PIN PC3 #define SPI_FLASH_MOSI_PIN PC3
#define W25QXX_MISO_PIN PC2 #define SPI_FLASH_MISO_PIN PC2
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif
/** /**

View File

@ -195,18 +195,18 @@
// //
// Misc. Functions // Misc. Functions
// //
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PA3 // PW_OFF //#define PS_ON_PIN PA3 // PW_OFF
// //
// Power Supply Control // Power Supply Control
// //
#if ENABLED(PSU_CONTROL) // MKSPWC #if ENABLED(MKS_PWC)
//#define SUICIDE_PIN PB2 // LED #define SUICIDE_PIN PB2
//#define KILL_PIN PA2 // PW_DET #define KILL_PIN PA2
//#define KILL_PIN_STATE HIGH #define KILL_PIN_STATE LOW
#else #else
//#define POWER_LOSS_PIN PA2 // PW_DET #define LED_PIN PB2
//#define LED_PIN PB2
#endif #endif
#ifndef SDCARD_CONNECTION #ifndef SDCARD_CONNECTION
@ -251,14 +251,14 @@
// //
// LCD / Controller // LCD / Controller
#define SPI_FLASH #define SPI_FLASH
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#define SPI_DEVICE 2 #define SPI_DEVICE 2
#define SPI_FLASH_SIZE 0x1000000 #define SPI_FLASH_SIZE 0x1000000
#if ENABLED(SPI_FLASH) #if ENABLED(SPI_FLASH)
#define W25QXX_CS_PIN PB12 #define SPI_FLASH_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define SPI_FLASH_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define SPI_FLASH_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13 #define SPI_FLASH_SCK_PIN PB13
#endif #endif
/** /**