Skip to content

Commit

Permalink
⛙ Merge w/Marlin
Browse files Browse the repository at this point in the history
  • Loading branch information
classicrocker883 committed May 30, 2024
2 parents 5aff27b + 95f81d2 commit 459f5b5
Show file tree
Hide file tree
Showing 78 changed files with 526 additions and 455 deletions.
10 changes: 2 additions & 8 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1191,20 +1191,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
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
26 changes: 13 additions & 13 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@
#define SECOND(a,b,...) b
#define THIRD( a,b,c,...) c

// Concatenate symbol names, without or with pre-expansion
#define _CAT(a,V...) a##V
#define CAT( a,V...) _CAT(a,V)

// Defer expansion
#define EMPTY()
#define DEFER( M) M EMPTY()
Expand All @@ -154,7 +150,6 @@
#define DEFER4(M) M EMPTY EMPTY EMPTY EMPTY()()()()

// Force define expansion
#define EVAL EVAL16
#define EVAL1(V...) V
#define EVAL2(V...) EVAL1(EVAL1(V))
#define EVAL4(V...) EVAL2(EVAL2(V))
Expand All @@ -168,30 +163,35 @@
#define EVAL1024(V...) EVAL512(EVAL512(V))
#define EVAL2048(V...) EVAL1024(EVAL1024(V))
#define EVAL4096(V...) EVAL2048(EVAL2048(V))
#define EVAL(V...) EVAL16(V)

// Concatenate symbol names, without or with pre-expansion
#define _CAT(a,V...) a##V
#define CAT( a,V...) _CAT(a,V)

#define IS_PROBE(V...) SECOND(V, 0) // Get the second item passed, or 0
#define PROBE() ~, 1 // Second item will be 1 if this is passed
#define _NOT_0 PROBE()
#define NOT(x) IS_PROBE(_CAT(_NOT_, x)) // NOT('0') gets '1'. Anything else gets '0'.
#define _BOOL(x) NOT(NOT(x)) // _BOOL('0') gets '0'. Anything else gets '1'.

#define _END_OF_ARGUMENTS_() 0
#define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)())

#define _IF_ELSE(TF) _CAT(_IF_, TF)
#define IF_ELSE(TF) _IF_ELSE(_BOOL(TF))

#define _IF_1(V...) V _IF_1_ELSE
#define _IF_0(...) _IF_0_ELSE

#define _IF_1_ELSE(...)
#define _IF_0_ELSE(V...) V

#define _IF_1(V...) V _IF_1_ELSE
#define _IF_0(...) _IF_0_ELSE

// Simple Inline IF Macros, friendly to use in other macro definitions
#define IF(O, A, B) ((O) ? (A) : (B))
#define IF_0(O, A) IF(O, A, 0)
#define IF_1(O, A) IF(O, A, 1)

#define _END_OF_ARGUMENTS_() 0
#define HAS_ARGS(V...) _BOOL(FIRST(_END_OF_ARGUMENTS_ V)())

// Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
#define _NUM_ARGS(_,n,m,l,k,j,i,h,g,f,e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
#define NUM_ARGS(V...) _NUM_ARGS(0,V,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
Expand Down Expand Up @@ -258,8 +258,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
4 changes: 4 additions & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,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 @@ -1280,6 +1280,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
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
22 changes: 11 additions & 11 deletions Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ void AnycubicTFT::onKillTFT() {
SENDLINE_DBG_PGM("J11", "TFT Serial Debug: Kill command... J11");
}

void AnycubicTFT::onSDCardStateChange(bool isInserted) {
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isInserted);
void AnycubicTFT::onSDCardStateChange(bool isMounted) {
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isMounted);
doSDCardStateCheck();
}

Expand Down Expand Up @@ -363,7 +363,7 @@ void AnycubicTFT::renderCurrentFileList() {

SENDLINE_PGM("FN "); // Filelist start

if (!isMediaInserted() && !specialMenu) {
if (!isMediaMounted() && !specialMenu) {
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02");

SENDLINE_PGM("<SPECI~1.GCO");
Expand Down Expand Up @@ -579,7 +579,7 @@ void AnycubicTFT::getCommandFromTFT() {
#if HAS_MEDIA
if (isPrintingFromMedia()) {
SEND_PGM("A6V ");
if (isMediaInserted())
if (isMediaMounted())
SENDLINE(ui8tostr3rj(getProgress_percent()));
else
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02");
Expand Down Expand Up @@ -632,7 +632,7 @@ void AnycubicTFT::getCommandFromTFT() {

case 13: // A13 SELECTION FILE
#if HAS_MEDIA
if (isMediaInserted()) {
if (isMediaMounted()) {
starpos = (strchr(tftStrchrPtr + 4, '*'));
if (tftStrchrPtr[4] == '/') {
strcpy(selectedDirectory, tftStrchrPtr + 5);
Expand Down Expand Up @@ -831,7 +831,7 @@ void AnycubicTFT::getCommandFromTFT() {

case 26: // A26 refresh SD
#if HAS_MEDIA
if (isMediaInserted()) {
if (isMediaMounted()) {
if (strlen(selectedDirectory) > 0) {
FileList currentFileList;
if ((selectedDirectory[0] == '.') && (selectedDirectory[1] == '.')) {
Expand Down Expand Up @@ -883,12 +883,12 @@ void AnycubicTFT::getCommandFromTFT() {
}

void AnycubicTFT::doSDCardStateCheck() {
#if ALL(HAS_MEDIA, HAS_SD_DETECT)
bool isInserted = isMediaInserted();
if (isInserted)
SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted");
#if HAS_MEDIA
const bool isMounted = isMediaMounted();
if (isMounted)
SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isMounted");
else
SENDLINE_DBG_PGM("J01", "TFT Serial Debug: SD card state changed... !isInserted");
SENDLINE_DBG_PGM("J01", "TFT Serial Debug: SD card state changed... !isMounted");

#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ namespace Anycubic {
break;

case 4: // page refresh
if (!isMediaInserted()) safe_delay(500);
if (!isMediaMounted()) safe_delay(500);

filenavigator.reset();

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ namespace ExtUI {
dgus.printerKilled(error, component);
}

void onMediaInserted() { dgus.mediaEvent(AC_media_inserted); }
void onMediaError() { dgus.mediaEvent(AC_media_error); }
void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); }
void onMediaMounted() { dgus.mediaEvent(AC_media_inserted); }
void onMediaError() { dgus.mediaEvent(AC_media_error); }
void onMediaRemoved() { dgus.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/dgus/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) {

void DGUSScreenHandler::screenChangeHookIfSD(DGUS_VP_Variable &var, void *val_ptr) {
// default action executed when there is a SD card, but not printing
if (ExtUI::isMediaInserted() && !ExtUI::isPrintingFromMedia()) {
if (ExtUI::isMediaMounted() && !ExtUI::isPrintingFromMedia()) {
screenChangeHook(var, val_ptr);
dgus.requestScreen(current_screenID);
return;
Expand All @@ -281,7 +281,7 @@ void DGUSScreenHandler::sendHeaterStatusToDisplay(DGUS_VP_Variable &var) {
}

// Don't let the user in the dark why there is no reaction.
if (!ExtUI::isMediaInserted()) {
if (!ExtUI::isMediaMounted()) {
setStatusMessage(GET_TEXT_F(MSG_NO_MEDIA));
return;
}
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/dgus/dgus_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ namespace ExtUI {
while (!screen.loop()); // Wait while anything is left to be sent
}

void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }

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/dgus_e3s1pro/DGUSDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ void DGUSDisplay::processRx() {

size_t DGUSDisplay::getFreeTxBuffer() {
return (
#ifdef LCD_SERIAL_GET_TX_BUFFER_FREE
LCD_SERIAL_GET_TX_BUFFER_FREE()
#ifdef LCD_SERIAL_TX_BUFFER_FREE
LCD_SERIAL_TX_BUFFER_FREE()
#else
SIZE_MAX
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void DGUSReturnKeyCodeHandler::Command_MenuSelect(DGUS_VP &vp, void *data) {
break;

case DGUS_Data::MenuSelectCommand::Print:
if (ExtUI::isMediaInserted()) {
if (ExtUI::isMediaMounted()) {
dgus_sdcard_handler.Reset();
screen.triggerScreenChange(DGUS_ScreenID::FILE1);
}
Expand Down Expand Up @@ -241,7 +241,7 @@ void DGUSReturnKeyCodeHandler::Command_CheckOK(DGUS_VP &vp, void *data) {
#endif // HAS_FILAMENT_SENSOR

case DGUS_Data::CheckOKCommand::SDCardCheck_Yes:
if (ExtUI::isMediaInserted()) {
if (ExtUI::isMediaMounted()) {
dgus_sdcard_handler.Reset();
screen.triggerScreenChange(DGUS_ScreenID::FILE1);
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_e3s1pro/DGUSTxHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void DGUSTxHandler::levelingProgressIcon(DGUS_VP &vp) {
#endif

void DGUSTxHandler::sdCardInsertionStatus(DGUS_VP &vp) {
const uint16_t data = ExtUI::isMediaInserted() ? 1 : 0;
const uint16_t data = ExtUI::isMediaMounted() ? 1 : 0;
dgus.write((uint16_t)vp.addr, Endianness::toBE(data));
}

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ namespace ExtUI {
screen.printerKilled(error, component);
}

void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
void onMediaMounted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }

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/dgus_reloaded/DGUSDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ void DGUSDisplay::processRx() {

size_t DGUSDisplay::getFreeTxBuffer() {
return (
#ifdef LCD_SERIAL_GET_TX_BUFFER_FREE
LCD_SERIAL_GET_TX_BUFFER_FREE()
#ifdef LCD_SERIAL_TX_BUFFER_FREE
LCD_SERIAL_TX_BUFFER_FREE()
#else
SIZE_MAX
#endif
Expand Down
Loading

0 comments on commit 459f5b5

Please sign in to comment.