Skip to content

Commit

Permalink
Merge remote-tracking branch 'MarlinFirmware/bugfix-2.1.x' into pr/fi…
Browse files Browse the repository at this point in the history
…x_mks_gen_l_mosfet_pins
  • Loading branch information
thisiskeithb committed Jun 2, 2024
2 parents fb6ebdf + 95f81d2 commit bf75bab
Show file tree
Hide file tree
Showing 64 changed files with 515 additions and 344 deletions.
10 changes: 2 additions & 8 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1185,20 +1185,14 @@
* Zero Vibration (ZV) Input Shaping for X and/or Y movements.
*
* This option uses a lot of SRAM for the step buffer. The buffer size is
* calculated automatically from SHAPING_FREQ_[XY], DEFAULT_AXIS_STEPS_PER_UNIT,
* calculated automatically from SHAPING_FREQ_[XYZ], DEFAULT_AXIS_STEPS_PER_UNIT,
* DEFAULT_MAX_FEEDRATE and ADAPTIVE_STEP_SMOOTHING. The default calculation can
* be overridden by setting SHAPING_MIN_FREQ and/or SHAPING_MAX_FEEDRATE.
* The higher the frequency and the lower the feedrate, the smaller the buffer.
* If the buffer is too small at runtime, input shaping will have reduced
* effectiveness during high speed movements.
*
* Tune with M593 D<factor> F<frequency>:
*
* D<factor> Set the zeta/damping factor. If axes (X, Y, etc.) are not specified, set for all axes.
* F<frequency> Set the frequency. If axes (X, Y, etc.) are not specified, set for all axes.
* T[map] Input Shaping type, 0:ZV, 1:EI, 2:2H EI (not implemented yet)
* X<1> Set the given parameters only for the X axis.
* Y<1> Set the given parameters only for the Y axis.
* Tune with M593 D<factor> F<frequency>
*/
//#define INPUT_SHAPING_X
//#define INPUT_SHAPING_Y
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 "2024-05-21"
//#define STRING_DISTRIBUTION_DATE "2024-05-29"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
30 changes: 14 additions & 16 deletions Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@ extern "C" {
void sd_mmc_spi_mem_init() {
}

inline bool media_ready() {
return IS_SD_INSERTED() && !IS_SD_PRINTING() && !IS_SD_FILE_OPEN() && card.isMounted();
}

bool sd_mmc_spi_unload(bool) { return true; }

bool sd_mmc_spi_wr_protect() { return false; }

bool sd_mmc_spi_removal() { return !media_ready(); }

Ctrl_status sd_mmc_spi_test_unit_ready() {
#ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT;
#endif
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
if (!media_ready()) return CTRL_NO_PRESENT;
return CTRL_GOOD;
}

// NOTE: This function is defined as returning the address of the last block
// in the card, which is cardSize() - 1
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
if (!media_ready()) return CTRL_NO_PRESENT;
*nb_sector = card.diskIODriver()->cardSize() - 1;
return CTRL_GOOD;
}

bool sd_mmc_spi_unload(bool) { return true; }

bool sd_mmc_spi_wr_protect() { return false; }

bool sd_mmc_spi_removal() {
return (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted());
}

#if ACCESS_USB == true
/**
* \name MEM <-> USB Interface
Expand All @@ -61,8 +61,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT;
#endif
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
if (!media_ready()) return CTRL_NO_PRESENT;

#ifdef DEBUG_MMC
{
Expand Down Expand Up @@ -101,8 +100,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
#ifdef DISABLE_DUE_SD_MMC
return CTRL_NO_PRESENT;
#endif
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT;
if (!media_ready()) return CTRL_NO_PRESENT;

#ifdef DEBUG_MMC
{
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/HAL/DUE/usb/sd_mmc_spi_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
//!
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
//!/
extern void sd_mmc_spi_mem_init(void);
void sd_mmc_spi_mem_init();

//!
//! @brief This function tests the state of the SD_MMC memory and sends it to the Host.
Expand All @@ -87,7 +87,7 @@ extern void sd_mmc_spi_mem_init(void);
//! Media not present -> CTRL_NO_PRESENT
//! Media has changed -> CTRL_BUSY
//!/
extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
Ctrl_status sd_mmc_spi_test_unit_ready();

//!
//! @brief This function gives the address of the last valid sector.
Expand All @@ -98,7 +98,7 @@ extern Ctrl_status sd_mmc_spi_test_unit_ready(void);
//! Media ready -> CTRL_GOOD
//! Media not present -> CTRL_NO_PRESENT
//!/
extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);

/*! \brief Unload/Load the SD/MMC card selected
*
Expand All @@ -109,7 +109,7 @@ extern Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector);
*
* \return \c true if unload/load done success.
*/
extern bool sd_mmc_spi_unload(bool unload);
bool sd_mmc_spi_unload(bool unload);

//!
//! @brief This function returns the write protected status of the memory.
Expand All @@ -120,14 +120,14 @@ extern bool sd_mmc_spi_unload(bool unload);
//!
//! @return false -> the memory is not write-protected (always)
//!/
extern bool sd_mmc_spi_wr_protect(void);
bool sd_mmc_spi_wr_protect();

//!
//! @brief This function tells if the memory has been removed or not.
//!
//! @return false -> The memory isn't removed
//!
extern bool sd_mmc_spi_removal(void);
bool sd_mmc_spi_removal();

//---- ACCESS DATA FUNCTIONS ----

Expand All @@ -147,7 +147,7 @@ extern bool sd_mmc_spi_removal(void);
//! It is ready -> CTRL_GOOD
//! A error occur -> CTRL_FAIL
//!
extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);

//! This function initializes the SD/MMC memory for a write operation
//!
Expand All @@ -161,7 +161,7 @@ extern Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector);
//! It is ready -> CTRL_GOOD
//! An error occurs -> CTRL_FAIL
//!
extern Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector);
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector);

#endif // #if ACCESS_USB == true

Expand Down
1 change: 1 addition & 0 deletions Marlin/src/HAL/STM32/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }

void _rx_complete_irq(serial_t *obj);
FORCE_INLINE static uint8_t buffer_overruns() { return 0; } // Not implemented. Void to avoid platform-dependent code.

protected:
usart_rx_callback_t _rx_callback;
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@
#define BOARD_FYSETC_CHEETAH_V30 5250 // FYSETC Cheetah V3.0 (STM32F446RC)
#define BOARD_BLACKBEEZMINI_V1 5251 // BlackBeezMini V1 (STM32F401CCU6)

//
// Other ARM Cortex-M4
//
#define BOARD_CREALITY_CR4NS 5300 // Creality CR4NS200320C13 (GD32F303RET6) as found in the Ender-3 V3 SE

//
// ARM Cortex-M7
//
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@
#define ENABLED(V...) DO(ENA,&&,V)
#define DISABLED(V...) DO(DIS,&&,V)
#define ANY(V...) !DISABLED(V)
#define ALL ENABLED
#define NONE DISABLED
#define ALL(V...) ENABLED(V)
#define NONE(V...) DISABLED(V)
#define COUNT_ENABLED(V...) DO(ENA,+,V)
#define MANY(V...) (COUNT_ENABLED(V) > 1)

Expand Down Expand Up @@ -630,7 +630,7 @@
#define DEFER4(M) M EMPTY EMPTY EMPTY EMPTY()()()()

// Force define expansion
#define EVAL EVAL16
#define EVAL(V...) EVAL16(V)
#define EVAL4096(V...) EVAL2048(EVAL2048(V))
#define EVAL2048(V...) EVAL1024(EVAL1024(V))
#define EVAL1024(V...) EVAL512(EVAL512(V))
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 1002: M1002(); break; // M1002: [INTERNAL] Tool-change and Relative E Move
#endif

#if ENABLED(ONE_CLICK_PRINT)
case 1003: M1003(); break; // M1003: [INTERNAL] Set the current dir to /
#endif

#if ENABLED(UBL_MESH_WIZARD)
case 1004: M1004(); break; // M1004: UBL Mesh Wizard
#endif
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,10 @@ class GcodeSuite {
static void M1002();
#endif

#if ENABLED(ONE_CLICK_PRINT)
static void M1003();
#endif

#if ENABLED(UBL_MESH_WIZARD)
static void M1004();
#endif
Expand Down
36 changes: 36 additions & 0 deletions Marlin/src/gcode/sd/M1003.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 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/>.
*
*/

#include "../../inc/MarlinConfig.h"

#if ENABLED(ONE_CLICK_PRINT)

#include "../gcode.h"
#include "../../sd/cardreader.h"

/**
* M1003: Set the current dir to /. Should come after 'M24'.
* Prevents the SD menu getting stuck in the newest file's workDir.
*/
void GcodeSuite::M1003() { card.cdroot(); }

#endif // ONE_CLICK_PRINT
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2024-05-21"
#define STRING_DISTRIBUTION_DATE "2024-05-29"
#endif

/**
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3316,7 +3316,7 @@ void drawFilSetMenu() {
if (SET_MENU(filSetMenu, MSG_FILAMENT_SET, 9)) {
BACK_ITEM(drawAdvancedSettingsMenu);
#if HAS_FILAMENT_SENSOR
EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, setRunoutEnable, &runout.enabled);
EDIT_ITEM(ICON_Runout, MSG_RUNOUT_SENSOR, onDrawChkbMenu, setRunoutEnable, &runout.enabled);
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, setRunoutDistance, &runout.runout_distance());
Expand Down Expand Up @@ -3407,7 +3407,7 @@ void drawTuneMenu() {
MENU_ITEM(ICON_FilMan, MSG_FILAMENTCHANGE, onDrawMenuItem, changeFilament);
#endif
#if HAS_FILAMENT_SENSOR
EDIT_ITEM(ICON_Runout, MSG_RUNOUT_ENABLE, onDrawChkbMenu, setRunoutEnable, &runout.enabled);
EDIT_ITEM(ICON_Runout, MSG_RUNOUT_SENSOR, onDrawChkbMenu, setRunoutEnable, &runout.enabled);
#endif
#if ENABLED(PROUI_ITEM_PLR)
EDIT_ITEM(ICON_Pwrlossr, MSG_OUTAGE_RECOVERY, onDrawChkbMenu, setPwrLossr, &recovery.enabled);
Expand Down Expand Up @@ -3487,7 +3487,7 @@ void drawTuneMenu() {

void drawInputShaping_menu() {
checkkey = ID_Menu;
if (SET_MENU(inputShapingMenu, MSG_INPUT_SHAPING, 5)) {
if (SET_MENU(inputShapingMenu, MSG_INPUT_SHAPING, 1 PLUS_TERN0(INPUT_SHAPING_X, 2) PLUS_TERN0(INPUT_SHAPING_Y, 2) PLUS_TERN0(INPUT_SHAPING_Z, 2))) {
BACK_ITEM(drawMotionMenu);
#if ENABLED(INPUT_SHAPING_X)
MENU_ITEM(ICON_ShapingX, MSG_SHAPING_A_FREQ, onDrawShapingXFreq, setShapingXFreq);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/proui/proui_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ namespace ExtUI {
void onIdle() {}
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {}

void onMediaInserted() {}
void onMediaError() {}
void onMediaMounted() {}
void onMediaError() {}
void onMediaRemoved() {}

void onHeatingError(const heater_id_t heater_id) {
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ namespace ExtUI {
chiron.printerKilled(error, component);
}

void onMediaInserted() { chiron.mediaEvent(AC_media_inserted); }
void onMediaError() { chiron.mediaEvent(AC_media_error); }
void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); }
void onMediaMounted() { chiron.mediaEvent(AC_media_inserted); }
void onMediaError() { chiron.mediaEvent(AC_media_error); }
void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); }

void onHeatingError(const heater_id_t header_id) {}
void onMinTempError(const heater_id_t header_id) {}
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ void ChironTFT::panelInfo(uint8_t req) {
} break;

case 8: // A8 Get SD Card list A8 S0
if (!isMediaInserted()) safe_delay(500);
if (!isMediaInserted()) // Make sure the card is removed
if (!isMediaMounted()) safe_delay(500);
if (!isMediaMounted()) // Make sure the card is removed
tftSendLn(AC_msg_no_sd_card);
else if (panel_command[3] == 'S')
sendFileList( atoi( &panel_command[4] ) );
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace ExtUI {
void onIdle() { anycubicTFT.onCommandScan(); }
void onPrinterKilled(FSTR_P const error, FSTR_P const component) { anycubicTFT.onKillTFT(); }

void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); }
void onMediaMounted() { anycubicTFT.onSDCardStateChange(true); }
void onMediaError() { anycubicTFT.onSDCardError(); }
void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); }

Expand Down
Loading

0 comments on commit bf75bab

Please sign in to comment.