Skip to content

Commit

Permalink
misc. cleanup, semi-elated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 3, 2024
1 parent bb013e4 commit b55d461
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 31 deletions.
2 changes: 2 additions & 0 deletions Marlin/src/inc/Changes.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@
#error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING is now CTC_A10S_A13."
#elif defined(Z_PROBE_END_SCRIPT)
#error "Z_PROBE_END_SCRIPT is now EVENT_GCODE_AFTER_G29."
#elif defined(WIFI_SERIAL)
#error "WIFI_SERIAL is now WIFI_SERIAL_PORT."
#endif

// Changes to Probe Temp Compensation (#17392)
Expand Down
12 changes: 9 additions & 3 deletions Marlin/src/lcd/extui/mks_ui/mks_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@
#define ESTATE(S) (READ(S##_PIN) == S##_ENDSTOP_HIT_STATE)

void test_gpio_readlevel_L() {
WRITE(WIFI_IO0_PIN, HIGH);
#if PIN_EXISTS(WIFI_IO0)
WRITE(WIFI_IO0_PIN, HIGH);
#endif
delay(10);
pw_det_sta = (READ(MKS_TEST_POWER_LOSS_PIN) == LOW);
pw_off_sta = (READ(MKS_TEST_PS_ON_PIN) == LOW);
Expand Down Expand Up @@ -132,7 +134,9 @@
}

void test_gpio_readlevel_H() {
WRITE(WIFI_IO0_PIN, LOW);
#if PIN_EXISTS(WIFI_IO0)
WRITE(WIFI_IO0_PIN, LOW);
#endif
delay(10);
pw_det_sta = (READ(MKS_TEST_POWER_LOSS_PIN) == HIGH);
pw_off_sta = (READ(MKS_TEST_PS_ON_PIN) == HIGH);
Expand Down Expand Up @@ -169,7 +173,9 @@
void init_test_gpio() {
endstops.init();

SET_OUTPUT(WIFI_IO0_PIN);
#if PIN_EXISTS(WIFI_IO0)
SET_OUTPUT(WIFI_IO0_PIN);
#endif

#if PIN_EXISTS(MT_DET_1)
SET_INPUT_PULLUP(MT_DET_1_PIN);
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/lcd/extui/mks_ui/wifi_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,9 @@ void mks_esp_wifi_init() {
SET_OUTPUT(WIFI_RESET_PIN);
WIFI_SET();
SET_OUTPUT(WIFI_IO1_PIN);
SET_INPUT_PULLUP(WIFI_IO0_PIN);
#if PIN_EXISTS(WIFI_IO0)
SET_INPUT_PULLUP(WIFI_IO0_PIN);
#endif
WIFI_IO1_SET();

esp_state = TRANSFER_IDLE;
Expand Down
14 changes: 8 additions & 6 deletions Marlin/src/lcd/extui/mks_ui/wifi_upload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,12 +650,14 @@ void resetWiFiForUpload(int begin_or_end) {
//#if 0
uint32_t start = getWifiTick();

if (begin_or_end == 0) {
SET_OUTPUT(WIFI_IO0_PIN);
WRITE(WIFI_IO0_PIN, LOW);
}
else
SET_INPUT_PULLUP(WIFI_IO0_PIN);
#if PIN_EXISTS(WIFI_IO0)
if (begin_or_end == 0) {
SET_OUTPUT(WIFI_IO0_PIN);
WRITE(WIFI_IO0_PIN, LOW);
}
else
SET_INPUT_PULLUP(WIFI_IO0_PIN);
#endif

WIFI_RESET();
while (getWifiTickDiff(start, getWifiTick()) < 500) { /* nada */ }
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,14 @@
#define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9

//
// MKS Testing for code in lcd/extui/mks_ui
//
#if ENABLED(MKS_TEST)
#define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
#define MKS_TEST_PS_ON_PIN PB0 // PW_OFF
#endif

#else
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PB2 // PW_OFF
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,14 @@
#define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9

//
// MKS Testing for code in lcd/extui/mks_ui
//
#if ENABLED(MKS_TEST)
#define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
#define MKS_TEST_PS_ON_PIN PB2 // PW_OFF
#endif

#else
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PB2 // PW_OFF
Expand Down
17 changes: 9 additions & 8 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
//
// Onboard I2C EEPROM
//
#define IIC_BL24CXX_EEPROM // Use I2C EEPROM onboard IC (AT24C04C, Size 4K, PageSize 16B)
#define MARLIN_EEPROM_SIZE 0x1000 // 4K
#define IIC_EEPROM_SDA PB7
#define IIC_EEPROM_SCL PB6
#define EEPROM_DEVICE_ADDRESS 0xA0
#define IIC_BL24CXX_EEPROM // Use I2C EEPROM onboard IC (AT24C04C, Size 4K, PageSize 16B)
#define MARLIN_EEPROM_SIZE 0x1000 // 4K
#define IIC_EEPROM_SDA PB7
#define IIC_EEPROM_SCL PB6
#define EEPROM_DEVICE_ADDRESS 0xA0

//
// SPI
Expand Down Expand Up @@ -412,12 +412,13 @@
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_MOSI_PIN PB15
#endif

//
// MKS WIFI pins
//
#if ENABLED(MKS_WIFI_MODULE)
#define WIFI_RESET_PIN PA5
#define WIFI_SERIAL 1 // USART1
#define WIFI_SERIAL_PORT 1 // USART1
#define WIFI_IO1_PIN PC7
#define WIFI_IO0_PIN NC // N.C.
#endif // MKS_WIFI_MODULE
#define WIFI_IO0_PIN -1 // N.C.
#endif
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
//
// MKS WIFI MODULE
//
//#define WIFI_SERIAL 1// USART1
//#define WIFI_SERIAL_PORT 1 // USART1
#if ENABLED(MKS_WIFI_MODULE)
#define WIFI_IO0_PIN PB14 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PB15 // MKS ESP WIFI IO1 PIN
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/pins/stm32f4/pins_MKS_MONSTER8_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@
#define KILL_PIN_STATE HIGH
#endif

// Random Info
#define USB_SERIAL -1 // USB Serial

/**
* ------ ------
* (BEEPER) PB2 | 1 2 | PE10 (BTN_ENC) (SPI1 MISO) PA6 | 1 2 | PA5 (SPI1 SCK)
Expand Down
20 changes: 11 additions & 9 deletions Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,27 @@
#define KILL_PIN_STATE HIGH
#endif

// Random Info
#define USB_SERIAL -1 // USB Serial
#define WIFI_SERIAL 3 // USART3
#define MKS_WIFI_MODULE_SERIAL 1 // USART1
#define MKS_WIFI_MODULE_SPI 2 // SPI2

#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif

// MKS WIFI MODULE
//
// MKS WiFi Module
//
#if ENABLED(MKS_WIFI_MODULE)
#define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9
#define MKS_WIFI_MODULE_SERIAL 1 // USART1
#define MKS_WIFI_MODULE_SPI 2 // SPI2
#else
#define WIFI_SERIAL_PORT 3 // USART3
#endif

// MKS TEST
#if ENABLED(MKS_TEST)
//
// MKS Testing for code in lcd/extui/mks_ui
//
#if ALL(TFT_LVGL_UI, MKS_TEST)
#define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET
#define MKS_TEST_PS_ON_PIN PB2 // PW_OFF
#endif
Expand Down

0 comments on commit b55d461

Please sign in to comment.