Skip to content

Commit

Permalink
Merge branch '2.0.x' into vanilla_fb_2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey1560 committed Jan 10, 2022
2 parents 4b9fce2 + e0f75d4 commit 96c1807
Show file tree
Hide file tree
Showing 254 changed files with 3,898 additions and 2,967 deletions.
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ applet/
*.rej
*.bak
*.idea
*.s
*.i
*.ii
*.swp
Expand Down Expand Up @@ -141,11 +140,8 @@ __vm/
vc-fileutils.settings

# Visual Studio Code
.vscode
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/*.db
.vscode/*
!.vscode/extensions.json

#Simulation
imgui.ini
Expand Down
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"marlinfirmware.auto-build",
"platformio.platformio-ide"
]
}
3 changes: 3 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2975,6 +2975,9 @@
//#define CHOPPER_TIMING_Z2 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_Z3 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_Z4 CHOPPER_TIMING_Z
//#define CHOPPER_TIMING_I CHOPPER_TIMING
//#define CHOPPER_TIMING_J CHOPPER_TIMING
//#define CHOPPER_TIMING_K CHOPPER_TIMING
//#define CHOPPER_TIMING_E CHOPPER_TIMING // For Extruders (override below)
//#define CHOPPER_TIMING_E1 CHOPPER_TIMING_E
//#define CHOPPER_TIMING_E2 CHOPPER_TIMING_E
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/AVR/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
#endif

enum { HasEmergencyParser = Cfg::EMERGENCYPARSER };
static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
static bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }

FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MarlinSerial {
static size_t write(const uint8_t c);
static void flushTX();

static inline bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }
static bool emergency_parser_enabled() { return Cfg::EMERGENCYPARSER; }

FORCE_INLINE static uint8_t dropped() { return Cfg::DROPPED_RX ? rx_dropped_bytes : 0; }
FORCE_INLINE static uint8_t buffer_overruns() { return Cfg::RX_OVERRUNS ? rx_buffer_overruns : 0; }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/MarlinSerialUSB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern "C" {
int udi_cdc_getc();
bool udi_cdc_is_tx_ready();
int udi_cdc_putc(int value);
};
}

// Pending character
static int pending_char = -1;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "../../../sd/cardreader.h"
extern "C" {
#include "sd_mmc_spi_mem.h"
#include "sd_mmc_spi_mem.h"
}

#define SD_MMC_BLOCK_SIZE 512
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/LPC1768/include/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class SPISettings {

//uint32_t spiRate() const { return spi_speed; }

static inline uint32_t spiRate2Clock(uint32_t spiRate) {
static uint32_t spiRate2Clock(uint32_t spiRate) {
uint32_t Marlin_speed[7]; // CPSR is always 2
Marlin_speed[0] = 8333333; //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED
Marlin_speed[1] = 4166667; //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/LPC1768/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class XPT2046 {
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();

static inline void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static inline void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class XPT2046 {
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();

static inline void DataTransferBegin();
static inline void DataTransferEnd();
static void DataTransferBegin();
static void DataTransferEnd();
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#if ENABLED(SDIO_SUPPORT)

#include "sdio.h"

#include <stdint.h>
#include <stdbool.h>

Expand All @@ -49,14 +51,6 @@
#error "SDIO only supported with STM32F103xE, STM32F103xG, STM32F4xx, or STM32F7xx."
#endif

// Fixed
#define SDIO_D0_PIN PC8
#define SDIO_D1_PIN PC9
#define SDIO_D2_PIN PC10
#define SDIO_D3_PIN PC11
#define SDIO_CK_PIN PC12
#define SDIO_CMD_PIN PD2

SD_HandleTypeDef hsd; // create SDIO structure
// F4 supports one DMA for RX and another for TX, but Marlin will never
// do read and write at same time, so we use the same DMA for both.
Expand Down
29 changes: 29 additions & 0 deletions Marlin/src/HAL/STM32/sdio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once

#define SDIO_D0_PIN PC8
#define SDIO_D1_PIN PC9
#define SDIO_D2_PIN PC10
#define SDIO_D3_PIN PC11
#define SDIO_CK_PIN PC12
#define SDIO_CMD_PIN PD2
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class XPT2046 {
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();

static inline void DataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
static inline void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static void DataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static uint16_t HardwareIO(uint16_t data);
static uint16_t SoftwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0) { return SPIx.Instance ? HardwareIO(data) : SoftwareIO(data); }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32F1/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class SPIClass {
/**
* @brief Wait until TXE (tx empty) flag is set and BSY (busy) flag unset.
*/
static inline void waitSpiTxEnd(spi_dev *spi_d) {
static void waitSpiTxEnd(spi_dev *spi_d) {
while (spi_is_tx_empty(spi_d) == 0) { /* nada */ } // wait until TXE=1
while (spi_is_busy(spi_d) != 0) { /* nada */ } // wait until BSY=0
}
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/HAL/STM32F1/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS];
#define M43_NEVER_TOUCH(Q) (Q >= 9 && Q <= 12) // SERIAL/USB pins PA9(TX) PA10(RX)
#endif

static inline int8_t get_pin_mode(pin_t pin) {
static int8_t get_pin_mode(pin_t pin) {
return VALID_PIN(pin) ? _GET_MODE(pin) : -1;
}

static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
static pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
if (!VALID_PIN(pin)) return -1;
int8_t adc_channel = int8_t(PIN_MAP[pin].adc_channel);
#ifdef NUM_ANALOG_INPUTS
Expand All @@ -67,7 +67,7 @@ static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
return pin_t(adc_channel);
}

static inline bool IS_ANALOG(pin_t pin) {
static bool IS_ANALOG(pin_t pin) {
if (!VALID_PIN(pin)) return false;
if (PIN_MAP[pin].adc_channel != ADCx) {
#ifdef NUM_ANALOG_INPUTS
Expand All @@ -78,11 +78,11 @@ static inline bool IS_ANALOG(pin_t pin) {
return false;
}

static inline bool GET_PINMODE(const pin_t pin) {
static bool GET_PINMODE(const pin_t pin) {
return VALID_PIN(pin) && !IS_INPUT(pin);
}

static inline bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
static bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
const pin_t pin = GET_ARRAY_PIN(array_pin);
return (!IS_ANALOG(pin)
#ifdef NUM_ANALOG_INPUTS
Expand All @@ -93,7 +93,7 @@ static inline bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {

#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density

static inline void pwm_details(const pin_t pin) {
static void pwm_details(const pin_t pin) {
if (PWM_PIN(pin)) {
timer_dev * const tdev = PIN_MAP[pin].timer_device;
const uint8_t channel = PIN_MAP[pin].timer_channel;
Expand All @@ -113,7 +113,7 @@ static inline void pwm_details(const pin_t pin) {
}
}

static inline void print_port(pin_t pin) {
static void print_port(pin_t pin) {
const char port = 'A' + char(pin >> 4); // pin div 16
const int16_t gbit = PIN_MAP[pin].gpio_bit;
char buffer[8];
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32F1/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class XPT2046 {
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();

static inline void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static inline void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
#endif
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/shared/eeprom_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ class PersistentStore {

// Write one or more bytes of data
// Return 'true' on write error
static inline bool write_data(const int pos, const uint8_t *value, const size_t size=sizeof(uint8_t)) {
static bool write_data(const int pos, const uint8_t *value, const size_t size=sizeof(uint8_t)) {
int data_pos = pos;
uint16_t crc = 0;
return write_data(data_pos, value, size, &crc);
}

// Write a single byte of data
// Return 'true' on write error
static inline bool write_data(const int pos, const uint8_t value) { return write_data(pos, &value); }
static bool write_data(const int pos, const uint8_t value) { return write_data(pos, &value); }

// Read one or more bytes of data
// Return 'true' on read error
static inline bool read_data(const int pos, uint8_t *value, const size_t size=1) {
static bool read_data(const int pos, uint8_t *value, const size_t size=1) {
int data_pos = pos;
uint16_t crc = 0;
return read_data(data_pos, value, size, &crc);
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
#define LCD_STR_E STR_E

// Extra Axis and Endstop Names
#if LINEAR_AXES >= 4
#if HAS_I_AXIS
#if AXIS4_NAME == 'A'
#define AXIS4_STR "A"
#define STR_I_MIN "a_min"
Expand Down Expand Up @@ -402,7 +402,7 @@
#define AXIS4_STR ""
#endif

#if LINEAR_AXES >= 5
#if HAS_J_AXIS
#if AXIS5_NAME == 'A'
#define AXIS5_STR "A"
#define STR_J_MIN "a_min"
Expand Down Expand Up @@ -436,7 +436,7 @@
#define AXIS5_STR ""
#endif

#if LINEAR_AXES >= 6
#if HAS_K_AXIS
#if AXIS6_NAME == 'A'
#define AXIS6_STR "A"
#define STR_K_MIN "a_min"
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@
#ifdef __cplusplus

// C++11 solution that is standards compliant.
template <class V, class N> static inline constexpr void NOLESS(V& v, const N n) {
template <class V, class N> static constexpr void NOLESS(V& v, const N n) {
if (n > v) v = n;
}
template <class V, class N> static inline constexpr void NOMORE(V& v, const N n) {
template <class V, class N> static constexpr void NOMORE(V& v, const N n) {
if (n < v) v = n;
}
template <class V, class N1, class N2> static inline constexpr void LIMIT(V& v, const N1 n1, const N2 n2) {
template <class V, class N1, class N2> static constexpr void LIMIT(V& v, const N1 n1, const N2 n2) {
if (n1 > v) v = n1;
else if (n2 < v) v = n2;
}
Expand Down Expand Up @@ -366,7 +366,7 @@

#undef ABS
#ifdef __cplusplus
template <class T> static inline constexpr const T ABS(const T v) { return v >= 0 ? v : -v; }
template <class T> static constexpr const T ABS(const T v) { return v >= 0 ? v : -v; }
#else
#define ABS(a) ({__typeof__(a) _a = (a); _a >= 0 ? _a : -_a;})
#endif
Expand Down Expand Up @@ -409,14 +409,14 @@
extern "C++" {

// C++11 solution that is standards compliant. Return type is deduced automatically
template <class L, class R> static inline constexpr auto _MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
template <class L, class R> static constexpr auto _MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
return lhs < rhs ? lhs : rhs;
}
template <class L, class R> static inline constexpr auto _MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
template <class L, class R> static constexpr auto _MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
return lhs > rhs ? lhs : rhs;
}
template<class T, class ... Ts> static inline constexpr const T _MIN(T V, Ts... Vs) { return _MIN(V, _MIN(Vs...)); }
template<class T, class ... Ts> static inline constexpr const T _MAX(T V, Ts... Vs) { return _MAX(V, _MAX(Vs...)); }
template<class T, class ... Ts> static constexpr const T _MIN(T V, Ts... Vs) { return _MIN(V, _MIN(Vs...)); }
template<class T, class ... Ts> static constexpr const T _MAX(T V, Ts... Vs) { return _MAX(V, _MAX(Vs...)); }

}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/core/serial_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SerialMask {
inline constexpr bool enabled(const SerialMask PortMask) const { return mask & PortMask.mask; }
inline constexpr SerialMask combine(const SerialMask other) const { return SerialMask(mask | other.mask); }
inline constexpr SerialMask operator<< (const int offset) const { return SerialMask(mask << offset); }
static inline SerialMask from(const serial_index_t index) {
static SerialMask from(const serial_index_t index) {
if (index.valid()) return SerialMask(_BV(index.index));
return SerialMask(0); // A invalid index mean no output
}
Expand Down
Loading

0 comments on commit 96c1807

Please sign in to comment.