Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into bugfix-2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxies-CSTL committed Dec 26, 2021
2 parents eebf187 + 56ac681 commit 1a6dbcb
Show file tree
Hide file tree
Showing 47 changed files with 1,004 additions and 526 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ bdf2u8g
marlin_config.json
mczip.h
*.gen
*.sublime-workspace

#
# OS
Expand Down Expand Up @@ -156,6 +157,7 @@ spi_flash.bin
CMakeLists.txt
src/CMakeLists.txt
CMakeListsPrivate.txt
build/

# CLion
cmake-build-*
Expand Down
14 changes: 6 additions & 8 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@

// @section machine

// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_RAMPS_14_EFB
#endif

/**
* Select the serial port on the board to use for communication with the host.
* This allows the connection of wireless adapters (for instance) to non-default port pins.
Expand Down Expand Up @@ -137,11 +142,6 @@
// Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH

// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_RAMPS_14_EFB
#endif

// Name displayed in the LCD "Ready" message and Info menu
//#define CUSTOM_MACHINE_NAME "3D Printer"

Expand Down Expand Up @@ -1837,6 +1837,7 @@
#define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load
#if ENABLED(EEPROM_SETTINGS)
//#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
//#define EEPROM_INIT_NOW // Init EEPROM on first boot after a new build.
#endif

//
Expand Down Expand Up @@ -2840,9 +2841,6 @@
// :[1,2,3,4,5,6,7,8]
//#define NUM_M106_FANS 1

// Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino
//#define FAST_PWM_FAN

// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
// which is not as annoying as with the hardware PWM. On the other hand, if this frequency
// is too low, you should also increment SOFT_PWM_SCALE.
Expand Down
54 changes: 43 additions & 11 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,18 +549,21 @@
//#define FAN_MAX_PWM 128

/**
* FAST PWM FAN Settings
* Fan Fast PWM
*
* Use to change the FAST FAN PWM frequency (if enabled in Configuration.h)
* Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a
* frequency as close as possible to the desired frequency.
* Combinations of PWM Modes, prescale values and TOP resolutions are used internally
* to produce a frequency as close as possible to the desired frequency.
*
* FAST_PWM_FAN_FREQUENCY [undefined by default]
* FAST_PWM_FAN_FREQUENCY
* Set this to your desired frequency.
* If left undefined this defaults to F = F_CPU/(2*255*1)
* i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers.
* These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required
* For AVR, if left undefined this defaults to F = F_CPU/(2*255*1)
* i.e., F = 31.4kHz on 16MHz microcontrollers or F = 39.2kHz on 20MHz microcontrollers.
* For non AVR, if left undefined this defaults to F = 1Khz.
* This F value is only to protect the hardware from an absence of configuration
* and not to complete it when users are not aware that the frequency must be specifically set to support the target board.
*
* NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behavior.
* Setting very high frequencies can damage your hardware.
*
* USE_OCR2A_AS_TOP [undefined by default]
* Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2:
Expand All @@ -570,9 +573,17 @@
* PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.)
* USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies.
*/
//#define FAST_PWM_FAN // Increase the fan PWM frequency. Removes the PWM noise but increases heating in the FET/Arduino
#if ENABLED(FAST_PWM_FAN)
//#define FAST_PWM_FAN_FREQUENCY 31400
//#define FAST_PWM_FAN_FREQUENCY 31400 // Define here to override the defaults below
//#define USE_OCR2A_AS_TOP
#ifndef FAST_PWM_FAN_FREQUENCY
#ifdef __AVR__
#define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1))
#else
#define FAST_PWM_FAN_FREQUENCY 1000U
#endif
#endif
#endif

/**
Expand Down Expand Up @@ -897,12 +908,14 @@
//#define BLTOUCH_FORCE_MODE_SET

/**
* Use "HIGH SPEED" mode for probing.
* Enable "HIGH SPEED" option for probing.
* Danger: Disable if your probe sometimes fails. Only suitable for stable well-adjusted systems.
* This feature was designed for Deltabots with very fast Z moves; however, higher speed Cartesians
* might be able to use it. If the machine can't raise Z fast enough the BLTouch may go into ALARM.
*
* Set the default state here, change with 'M401 S' or UI, use M500 to save, M502 to reset.
*/
//#define BLTOUCH_HS_MODE
//#define BLTOUCH_HS_MODE true

// Safety: Enable voltage mode settings in the LCD menu.
//#define BLTOUCH_LCD_VOLTAGE_MENU
Expand Down Expand Up @@ -2677,6 +2690,7 @@
#define X_RSENSE 0.11
#define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
//#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis
//#define X_HOLD_MULTIPLIER 0.5 // Enable to override 'HOLD_MULTIPLIER' for the X axis
#endif

#if AXIS_IS_TMC(X2)
Expand All @@ -2686,6 +2700,7 @@
#define X2_RSENSE 0.11
#define X2_CHAIN_POS -1
//#define X2_INTERPOLATE true
//#define X2_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(Y)
Expand All @@ -2695,6 +2710,7 @@
#define Y_RSENSE 0.11
#define Y_CHAIN_POS -1
//#define Y_INTERPOLATE true
//#define Y_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(Y2)
Expand All @@ -2704,6 +2720,7 @@
#define Y2_RSENSE 0.11
#define Y2_CHAIN_POS -1
//#define Y2_INTERPOLATE true
//#define Y2_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(Z)
Expand All @@ -2713,6 +2730,7 @@
#define Z_RSENSE 0.11
#define Z_CHAIN_POS -1
//#define Z_INTERPOLATE true
//#define Z_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(Z2)
Expand All @@ -2722,6 +2740,7 @@
#define Z2_RSENSE 0.11
#define Z2_CHAIN_POS -1
//#define Z2_INTERPOLATE true
//#define Z2_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(Z3)
Expand All @@ -2731,6 +2750,7 @@
#define Z3_RSENSE 0.11
#define Z3_CHAIN_POS -1
//#define Z3_INTERPOLATE true
//#define Z3_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(Z4)
Expand All @@ -2740,6 +2760,7 @@
#define Z4_RSENSE 0.11
#define Z4_CHAIN_POS -1
//#define Z4_INTERPOLATE true
//#define Z4_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(I)
Expand All @@ -2749,6 +2770,7 @@
#define I_RSENSE 0.11
#define I_CHAIN_POS -1
//#define I_INTERPOLATE true
//#define I_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(J)
Expand All @@ -2758,6 +2780,7 @@
#define J_RSENSE 0.11
#define J_CHAIN_POS -1
//#define J_INTERPOLATE true
//#define J_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(K)
Expand All @@ -2767,6 +2790,7 @@
#define K_RSENSE 0.11
#define K_CHAIN_POS -1
//#define K_INTERPOLATE true
//#define K_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E0)
Expand All @@ -2775,6 +2799,7 @@
#define E0_RSENSE 0.11
#define E0_CHAIN_POS -1
//#define E0_INTERPOLATE true
//#define E0_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E1)
Expand All @@ -2783,6 +2808,7 @@
#define E1_RSENSE 0.11
#define E1_CHAIN_POS -1
//#define E1_INTERPOLATE true
//#define E1_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E2)
Expand All @@ -2791,6 +2817,7 @@
#define E2_RSENSE 0.11
#define E2_CHAIN_POS -1
//#define E2_INTERPOLATE true
//#define E2_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E3)
Expand All @@ -2799,6 +2826,7 @@
#define E3_RSENSE 0.11
#define E3_CHAIN_POS -1
//#define E3_INTERPOLATE true
//#define E3_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E4)
Expand All @@ -2807,6 +2835,7 @@
#define E4_RSENSE 0.11
#define E4_CHAIN_POS -1
//#define E4_INTERPOLATE true
//#define E4_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E5)
Expand All @@ -2815,6 +2844,7 @@
#define E5_RSENSE 0.11
#define E5_CHAIN_POS -1
//#define E5_INTERPOLATE true
//#define E5_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E6)
Expand All @@ -2823,6 +2853,7 @@
#define E6_RSENSE 0.11
#define E6_CHAIN_POS -1
//#define E6_INTERPOLATE true
//#define E6_HOLD_MULTIPLIER 0.5
#endif

#if AXIS_IS_TMC(E7)
Expand All @@ -2831,6 +2862,7 @@
#define E7_RSENSE 0.11
#define E7_CHAIN_POS -1
//#define E7_INTERPOLATE true
//#define E7_HOLD_MULTIPLIER 0.5
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2021-12-20"
//#define STRING_DISTRIBUTION_DATE "2021-12-26"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
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
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@
#define BOARD_FYSETC_E4 6005 // FYSETC E4
#define BOARD_PANDA_ZHU 6006 // Panda_ZHU
#define BOARD_PANDA_M4 6007 // Panda_M4
#define BOARD_MKS_TINYBEE 6008 // MKS TinyBee based on ESP32 (with I2S stepper stream)

//
// SAMD51 ARM Cortex M4
Expand Down
30 changes: 17 additions & 13 deletions Marlin/src/feature/bltouch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@

BLTouch bltouch;

bool BLTouch::last_written_mode; // Initialized by settings.load, 0 = Open Drain; 1 = 5V Drain
bool BLTouch::od_5v_mode; // Initialized by settings.load, 0 = Open Drain; 1 = 5V Drain
#ifdef BLTOUCH_HS_MODE
bool BLTouch::high_speed_mode; // Initialized by settings.load, 0 = Low Speed; 1 = High Speed
#else
constexpr bool BLTouch::high_speed_mode;
#endif

#include "../module/servo.h"
#include "../module/probe.h"
Expand Down Expand Up @@ -63,18 +68,17 @@ void BLTouch::init(const bool set_voltage/*=false*/) {

#else

if (DEBUGGING(LEVELING)) {
DEBUG_ECHOLNPGM("last_written_mode - ", last_written_mode);
DEBUG_ECHOLNPGM("config mode - "
#if ENABLED(BLTOUCH_SET_5V_MODE)
"BLTOUCH_SET_5V_MODE"
#else
"OD"
#endif
);
}
#ifdef DEBUG_OUT
if (DEBUGGING(LEVELING)) {
PGMSTR(mode0, "OD");
PGMSTR(mode1, "5V");
DEBUG_ECHOPGM("BLTouch Mode: ");
DEBUG_ECHOPGM_P(bltouch.od_5v_mode ? mode1 : mode0);
DEBUG_ECHOLNPGM(" (Default " TERN(BLTOUCH_SET_5V_MODE, "5V", "OD") ")");
}
#endif

const bool should_set = last_written_mode != ENABLED(BLTOUCH_SET_5V_MODE);
const bool should_set = od_5v_mode != ENABLED(BLTOUCH_SET_5V_MODE);

#endif

Expand Down Expand Up @@ -193,7 +197,7 @@ void BLTouch::mode_conv_proc(const bool M5V) {
_mode_store();
if (M5V) _set_5V_mode(); else _set_OD_mode();
_stow();
last_written_mode = M5V;
od_5v_mode = M5V;
}

#endif // BLTOUCH
Loading

0 comments on commit 1a6dbcb

Please sign in to comment.