Skip to content

Commit

Permalink
*sync with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
moonglow committed Oct 26, 2021
1 parent ba14950 commit cf819b9
Show file tree
Hide file tree
Showing 122 changed files with 1,460 additions and 775 deletions.
3 changes: 2 additions & 1 deletion Marlin/.github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
name: PR Bad Target

on:
pull_request:
pull_request_target:
types: [opened]
branches:
- 1.0.x
- 1.1.x
Expand Down
16 changes: 14 additions & 2 deletions Marlin/Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -1407,12 +1407,24 @@
//#define INVERT_K_DIR false

// @section extruder

// For direct drive extruder v9 set to true, for geared extruder set to false.
#if ANY(FF_DREAMER_MACHINE, FF_INVENTOR_MACHINE)
#if ENABLED(FF_EXTRUDER_SWAP)
#if ENABLED(FF_DREAMER_OLD_MB)
#define INVERT_E0_DIR true
#else
#define INVERT_E0_DIR false
#endif
#define INVERT_E1_DIR false
#else
#define INVERT_E0_DIR false
#if ENABLED(FF_DREAMER_OLD_MB)
#define INVERT_E1_DIR true
#else
#define INVERT_E1_DIR false
#endif
#endif
#else
#define INVERT_E0_DIR true
#define INVERT_E1_DIR true
#endif
Expand Down Expand Up @@ -1487,7 +1499,7 @@

#define Z_MIN_POS 0
#if ENABLED(FF_INVENTOR_MACHINE)
#define Z_MAX_POS 155
#define Z_MAX_POS 160
#else
#define Z_MAX_POS 140
#endif
Expand Down
1 change: 1 addition & 0 deletions Marlin/Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2324,6 +2324,7 @@
*/
//#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 A0" // Extra G-code to run while executing tool-change command T0
//#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1
//#define EVENT_GCODE_TOOLCHANGE_ALWAYS_RUN // Always execute above G-code sequences. Use with caution!

/**
* Tool Sensors detect when tools have been picked up or dropped.
Expand Down
4 changes: 3 additions & 1 deletion Marlin/Marlin/src/HAL/AVR/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
#include "../../inc/MarlinConfig.h"

void spiBegin() {
OUT_WRITE(SD_SS_PIN, HIGH);
#if PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif
SET_OUTPUT(SD_SCK_PIN);
SET_INPUT(SD_MISO_PIN);
SET_OUTPUT(SD_MOSI_PIN);
Expand Down
28 changes: 26 additions & 2 deletions Marlin/Marlin/src/HAL/ESP32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include <esp_adc_cal.h>
#include <HardwareSerial.h>

#if ENABLED(USE_ESP32_TASK_WDT)
#include <esp_task_wdt.h>
#endif

#if ENABLED(WIFISUPPORT)
#include <ESPAsyncWebServer.h>
#include "wifi.h"
Expand Down Expand Up @@ -90,8 +94,24 @@ volatile int numPWMUsed = 0,

#endif

void HAL_init_board() {
#if ENABLED(USE_ESP32_EXIO)
HardwareSerial YSerial2(2);

void Write_EXIO(uint8_t IO, uint8_t v) {
if (ISRS_ENABLED()) {
DISABLE_ISRS();
YSerial2.write(0x80 | (((char)v) << 5) | (IO - 100));
ENABLE_ISRS();
}
else
YSerial2.write(0x80 | (((char)v) << 5) | (IO - 100));
}
#endif

void HAL_init_board() {
#if ENABLED(USE_ESP32_TASK_WDT)
esp_task_wdt_init(10, true);
#endif
#if ENABLED(ESP3D_WIFISUPPORT)
esp3dlib.init();
#elif ENABLED(WIFISUPPORT)
Expand Down Expand Up @@ -127,7 +147,11 @@ void HAL_init_board() {
// Initialize the i2s peripheral only if the I2S stepper stream is enabled.
// The following initialization is performed after Serial1 and Serial2 are defined as
// their native pins might conflict with the i2s stream even when they are remapped.
TERN_(I2S_STEPPER_STREAM, i2s_init());
#if ENABLED(USE_ESP32_EXIO)
YSerial2.begin(460800 * 3, SERIAL_8N1, 16, 17);
#elif ENABLED(I2S_STEPPER_STREAM)
i2s_init();
#endif
}

void HAL_idletask() {
Expand Down
4 changes: 4 additions & 0 deletions Marlin/Marlin/src/HAL/ESP32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ void HAL_idletask();
inline void HAL_init() {}
void HAL_init_board();

#if ENABLED(USE_ESP32_EXIO)
void Write_EXIO(uint8_t IO, uint8_t v);
#endif

//
// Delay in cycles (used by DELAY_NS / DELAY_US)
//
Expand Down
6 changes: 2 additions & 4 deletions Marlin/Marlin/src/HAL/ESP32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ static SPISettings spiConfig;
// ------------------------

void spiBegin() {
#if !PIN_EXISTS(SD_SS)
#error "SD_SS_PIN not defined!"
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif

OUT_WRITE(SD_SS_PIN, HIGH);
}

void spiInit(uint8_t spiRate) {
Expand Down
6 changes: 6 additions & 0 deletions Marlin/Marlin/src/HAL/ESP32/esp32.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x180000,
app1, app, ota_1, 0x190000, 0x180000,
spiffs, data, spiffs, 0x310000, 0xF0000,
20 changes: 13 additions & 7 deletions Marlin/Marlin/src/HAL/ESP32/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@
// Set pin as input with pullup mode
#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT)

// Read a pin wrapper
#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO))

// Write to a pin wrapper
#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v))

// Set pin as input wrapper
#if ENABLED(USE_ESP32_EXIO)
// Read a pin wrapper
#define READ(IO) digitalRead(IO)
// Write to a pin wrapper
#define WRITE(IO, v) (IO >= 100 ? Write_EXIO(IO, v) : digitalWrite(IO, v))
#else
// Read a pin wrapper
#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO))
// Write to a pin wrapper
#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v))
#endif

// Set pin as input wrapper (0x80 | (v << 5) | (IO - 100))
#define SET_INPUT(IO) _SET_INPUT(IO)

// Set pin as input with pullup wrapper
Expand Down
3 changes: 3 additions & 0 deletions Marlin/Marlin/src/HAL/ESP32/i2s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include "../../inc/MarlinConfigPre.h"

#if DISABLED(USE_ESP32_EXIO)

#include "i2s.h"

#include "../shared/Marduino.h"
Expand Down Expand Up @@ -340,4 +342,5 @@ void i2s_push_sample() {
dma.current[dma.rw_pos++] = i2s_port_data;
}

#endif // !USE_ESP32_EXIO
#endif // ARDUINO_ARCH_ESP32
2 changes: 1 addition & 1 deletion Marlin/Marlin/src/HAL/ESP32/watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
extern "C" {
#endif

esp_err_t esp_task_wdt_reset();
esp_err_t esp_task_wdt_reset();

#ifdef __cplusplus
}
Expand Down
4 changes: 3 additions & 1 deletion Marlin/Marlin/src/HAL/STM32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ static SPISettings spiConfig;
#include "../shared/Delay.h"

void spiBegin(void) {
OUT_WRITE(SD_SS_PIN, HIGH);
#if PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif
OUT_WRITE(SD_SCK_PIN, HIGH);
SET_INPUT(SD_MISO_PIN);
OUT_WRITE(SD_MOSI_PIN, HIGH);
Expand Down
5 changes: 2 additions & 3 deletions Marlin/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ static SPISettings spiConfig;

// Initialize SPI bus
void spiBegin() {
#if !PIN_EXISTS(SD_SS)
#error "SD_SS_PIN not defined!"
#if PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif
OUT_WRITE(SD_SS_PIN, HIGH);
SET_OUTPUT(SD_SCK_PIN);
SET_INPUT(SD_MISO_PIN);
SET_OUTPUT(SD_MOSI_PIN);
Expand Down
5 changes: 2 additions & 3 deletions Marlin/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@
static SPISettings spiConfig;

void spiBegin() {
#if !PIN_EXISTS(SD_SS)
#error "SD_SS_PIN not defined!"
#if PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif
OUT_WRITE(SD_SS_PIN, HIGH);
SET_OUTPUT(SD_SCK_PIN);
SET_INPUT(SD_MISO_PIN);
SET_OUTPUT(SD_MOSI_PIN);
Expand Down
7 changes: 2 additions & 5 deletions Marlin/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@ static SPISettings spiConfig;
// ------------------------

void spiBegin() {
#ifndef SD_SS_PIN
#error "SD_SS_PIN is not defined!"
#if PIN_EXISTS(SD_SS)
OUT_WRITE(SD_SS_PIN, HIGH);
#endif

OUT_WRITE(SD_SS_PIN, HIGH);

//SET_OUTPUT(SD_SCK_PIN);
//SET_INPUT(SD_MISO_PIN);
//SET_OUTPUT(SD_MOSI_PIN);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Marlin/src/HAL/shared/Marduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#endif

#ifndef FORCE_INLINE
#define FORCE_INLINE inline __attribute__((always_inline))
#define FORCE_INLINE __attribute__((always_inline)) inline
#endif

#include "progmem.h"
4 changes: 4 additions & 0 deletions Marlin/Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
#define BOARD_ZONESTAR_ZM3E2 4055 // Zonestar ZM3E2 (STM32F103RCT6)
#define BOARD_ZONESTAR_ZM3E4 4056 // Zonestar ZM3E4 V1 (STM32F103VCT6)
#define BOARD_ZONESTAR_ZM3E4V2 4057 // Zonestar ZM3E4 V2 (STM32F103VCT6)
#define BOARD_ERYONE_ERY32_MINI 4058 // Eryone Ery32 mini (STM32F103VET6)

//
// ARM Cortex-M4F
Expand Down Expand Up @@ -402,6 +403,7 @@
#define BOARD_TH3D_EZBOARD_LITE_V2 4232 // TH3D EZBoard Lite v2.0
#define BOARD_INDEX_REV03 4233 // Index PnP Controller REV03 (STM32F407VET6/VGT6)
#define BOARD_MKS_ROBIN_NANO_V1_3_F4 4234 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VET6)
#define BOARD_MKS_EAGLE 4235 // MKS Eagle (STM32F407VET6)
#define BOARD_FF_MOTHERBOARD 4250 // FlashForge board ( STM32F407ZG )

//
Expand All @@ -423,6 +425,8 @@
#define BOARD_MRR_ESPE 6002 // MRR ESPE based on ESP32 (with I2S stepper stream)
#define BOARD_E4D_BOX 6003 // E4d@BOX
#define BOARD_FYSETC_E4 6004 // FYSETC E4
#define BOARD_PANDA_ZHU 6005 // Panda_ZHU
#define BOARD_PANDA_M4 6006 // Panda_M4

//
// SAMD51 ARM Cortex M4
Expand Down
4 changes: 2 additions & 2 deletions Marlin/Marlin/src/gcode/calibrate/G33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ float dcr;

void ac_home() {
endstops.enable(true);
TERN_(SENSORLESS_HOMING, probe.set_homing_current(true));
TERN_(HAS_DELTA_SENSORLESS_PROBING, probe.set_homing_current(true));
home_delta();
TERN_(SENSORLESS_HOMING, probe.set_homing_current(false));
TERN_(HAS_DELTA_SENSORLESS_PROBING, probe.set_homing_current(false));
endstops.not_homing();
}

Expand Down
1 change: 1 addition & 0 deletions Marlin/Marlin/src/gcode/sd/M1001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/printcounter.h"
#include "../../module/temperature.h"
#include "../../sd/cardreader.h"

#ifdef SD_FINISHED_RELEASECOMMAND
Expand Down
16 changes: 7 additions & 9 deletions Marlin/Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,15 @@
#define HID_E6 6
#define HID_E7 7

#define ANY_TEMP_SENSOR_IS(n) (n == TEMP_SENSOR_0 || n == TEMP_SENSOR_1 || n == TEMP_SENSOR_2 || n == TEMP_SENSOR_3 \
|| n == TEMP_SENSOR_4 || n == TEMP_SENSOR_5 || n == TEMP_SENSOR_6 || n == TEMP_SENSOR_7 \
|| n == TEMP_SENSOR_BED \
|| n == TEMP_SENSOR_PROBE \
|| n == TEMP_SENSOR_CHAMBER \
|| n == TEMP_SENSOR_COOLER \
|| n == TEMP_SENSOR_REDUNDANT )
#if ANY_TEMP_SENSOR_IS(1000)
#define _SENSOR_IS(I,N) || (TEMP_SENSOR_##N == I)
#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I)
#define ANY_THERMISTOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N) \
_SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \
_SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) )

#if ANY_THERMISTOR_IS(1000)
#define HAS_USER_THERMISTORS 1
#endif
#undef ANY_TEMP_SENSOR_IS

#if TEMP_SENSOR_REDUNDANT
#define _HEATER_ID(M) HID_##M
Expand Down
Loading

0 comments on commit cf819b9

Please sign in to comment.