Skip to content

Commit 14eb071

Browse files
⛙ Merge w/Marlin
2 parents 4cb9c5e + 84b22fc commit 14eb071

File tree

177 files changed

+3057
-1850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+3057
-1850
lines changed

Marlin/Configuration_adv.h

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,67 +1149,81 @@
11491149

11501150
/**
11511151
* Fixed-time-based Motion Control -- BETA FEATURE
1152-
* Enable/disable and set parameters with G-code M493.
1152+
* Enable/disable and set parameters with G-code M493 and M494.
11531153
* See ft_types.h for named values used by FTM options.
11541154
*/
11551155
//#define FT_MOTION
11561156
#if ENABLED(FT_MOTION)
1157-
//#define FTM_IS_DEFAULT_MOTION // Use FT Motion as the factory default?
1157+
//#define FTM_IS_DEFAULT_MOTION // Use FT Motion as the factory default?
1158+
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 and M494 parameters
1159+
11581160
#define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (DISABLED, Z_BASED, MASS_BASED)
11591161

1160-
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false)
1161-
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. (Acceleration-based scaling factor.)
1162+
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false)
1163+
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. (Acceleration-based scaling factor.)
11621164

11631165
#define FTM_DEFAULT_SHAPER_X ftMotionShaper_NONE // Default shaper mode on X axis (NONE, ZV, ZVD, ZVDD, ZVDDD, EI, 2HEI, 3HEI, MZV)
1164-
#define FTM_SHAPING_DEFAULT_FREQ_X 37.0f // (Hz) Default peak frequency used by input shapers
1165-
#define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
1166-
#define FTM_SHAPING_V_TOL_X 0.05f // Vibration tolerance used by EI input shapers for X axis
1166+
#define FTM_SHAPING_DEFAULT_FREQ_X 37.0f // (Hz) Default peak frequency used by input shapers
1167+
#define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
1168+
#define FTM_SHAPING_V_TOL_X 0.05f // Vibration tolerance used by EI input shapers for X axis
11671169

11681170
#define FTM_DEFAULT_SHAPER_Y ftMotionShaper_NONE // Default shaper mode on Y axis
1169-
#define FTM_SHAPING_DEFAULT_FREQ_Y 37.0f // (Hz) Default peak frequency used by input shapers
1170-
#define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis
1171-
#define FTM_SHAPING_V_TOL_Y 0.05f // Vibration tolerance used by EI input shapers for Y axis
1172-
1173-
//#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters
1171+
#define FTM_SHAPING_DEFAULT_FREQ_Y 37.0f // (Hz) Default peak frequency used by input shapers
1172+
#define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis
1173+
#define FTM_SHAPING_V_TOL_Y 0.05f // Vibration tolerance used by EI input shapers for Y axis
1174+
1175+
//#define FTM_SHAPER_Z // Include Z shaping support
1176+
#define FTM_DEFAULT_SHAPER_Z ftMotionShaper_NONE // Default shaper mode on Z axis
1177+
#define FTM_SHAPING_DEFAULT_FREQ_Z 21.0f // (Hz) Default peak frequency used by input shapers
1178+
#define FTM_SHAPING_ZETA_Z 0.03f // Zeta used by input shapers for Z axis
1179+
#define FTM_SHAPING_V_TOL_Z 0.05f // Vibration tolerance used by EI input shapers for Z axis
1180+
1181+
//#define FTM_SHAPER_E // Include E shaping support
1182+
// Required to synchronise extruder with XYZ (better quality)
1183+
#define FTM_DEFAULT_SHAPER_E ftMotionShaper_NONE // Default shaper mode on Extruder axis
1184+
#define FTM_SHAPING_DEFAULT_FREQ_E 21.0f // (Hz) Default peak frequency used by input shapers
1185+
#define FTM_SHAPING_ZETA_E 0.03f // Zeta used by input shapers for E axis
1186+
#define FTM_SHAPING_V_TOL_E 0.05f // Vibration tolerance used by EI input shapers for E axis
1187+
1188+
//#define FTM_SMOOTHING // Smoothing can reduce artifacts and make steppers quieter
1189+
// on sharp corners, but too much will round corners.
1190+
#if ENABLED(FTM_SMOOTHING)
1191+
#define FTM_MAX_SMOOTHING_TIME 0.10f // Maximum smoothing time (seconds), higher consumes more RAM.
1192+
// Increase smoothing time to reduce jerky motion, ghosting and noises.
1193+
#define FTM_SMOOTHING_TIME_X 0.00f // (s) Smoothing time for X axis. Zero means disabled.
1194+
#define FTM_SMOOTHING_TIME_Y 0.00f // (s) Smoothing time for Y axis
1195+
#define FTM_SMOOTHING_TIME_Z 0.00f // (s) Smoothing time for Z axis
1196+
#define FTM_SMOOTHING_TIME_E 0.02f // (s) Smoothing time for E axis. Prevents noise/skipping from LA by
1197+
// smoothing acceleration peaks, which may also smooth curved surfaces.
1198+
#endif
11741199

11751200
/**
11761201
* Advanced configuration
11771202
*/
1178-
#define FTM_UNIFIED_BWS // DON'T DISABLE unless you use Ulendo FBS (not implemented)
1203+
#define FTM_UNIFIED_BWS // DON'T DISABLE unless you use Ulendo FBS (not implemented)
11791204
#if ENABLED(FTM_UNIFIED_BWS)
1180-
#define FTM_BW_SIZE 100 // Unified Window and Batch size with a ratio of 2
1205+
#define FTM_BW_SIZE 100 // Unified Window and Batch size with a ratio of 2
11811206
#else
1182-
#define FTM_WINDOW_SIZE 200 // Custom Window size for trajectory generation needed by Ulendo FBS
1183-
#define FTM_BATCH_SIZE 100 // Custom Batch size for trajectory generation needed by Ulendo FBS
1207+
#define FTM_WINDOW_SIZE 200 // Custom Window size for trajectory generation needed by Ulendo FBS
1208+
#define FTM_BATCH_SIZE 100 // Custom Batch size for trajectory generation needed by Ulendo FBS
11841209
#endif
11851210

1186-
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS)
1187-
#define FTM_TS 0.001f // (s) Time step for trajectory generation. (Reciprocal of FTM_FS)
1211+
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS)
11881212

11891213
#if DISABLED(COREXY)
1190-
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update
1214+
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update
11911215

11921216
// Use this to adjust the time required to consume the command buffer.
11931217
// Try increasing this value if stepper motion is choppy.
1194-
#define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers
1218+
#define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers
11951219

11961220
#else
11971221
// CoreXY motion needs a larger buffer size. These values are based on our testing.
11981222
#define FTM_STEPPER_FS 30000
11991223
#define FTM_STEPPERCMD_BUFF_SIZE 6000
12001224
#endif
12011225

1202-
#define FTM_STEPS_PER_UNIT_TIME (FTM_STEPPER_FS / FTM_FS) // Interpolated stepper commands per unit time
1203-
#define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps
1204-
1205-
#define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency
1206-
#define FTM_RATIO (FTM_FS / FTM_MIN_SHAPE_FREQ) // Factor for use in FTM_ZMAX. DON'T CHANGE.
1207-
#define FTM_ZMAX (FTM_RATIO * 2) // Maximum delays for shaping functions (even numbers only!)
1208-
// Calculate as:
1209-
// ZV : FTM_RATIO / 2
1210-
// ZVD, MZV : FTM_RATIO
1211-
// 2HEI : FTM_RATIO * 3 / 2
1212-
// 3HEI : FTM_RATIO * 2
1226+
#define FTM_MIN_SHAPE_FREQ 10 // (Hz) Minimum shaping frequency, lower consumes more RAM
12131227
#endif // FT_MOTION
12141228

12151229
/**

Marlin/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* here we define this default string as the date where the latest release
4242
* version was tagged.
4343
*/
44-
//#define STRING_DISTRIBUTION_DATE "2025-09-29"
44+
//#define STRING_DISTRIBUTION_DATE "2025-09-30"
4545

4646
#define STRING_DISTRIBUTION_DATE __DATE__
4747
#define STRING_DISTRIBUTION_TIME __TIME__

Marlin/src/HAL/STM32/inc/Conditionals_post.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
#endif
3030

3131
// Some STM32F4 boards may lose steps when saving to EEPROM during print (PR #17946)
32-
#if defined(STM32F4xx) && ENABLED(FLASH_EEPROM_EMULATION) && PRINTCOUNTER_SAVE_INTERVAL > 0
32+
#if ALL(STM32F4xx, FLASH_EEPROM_EMULATION) && PRINTCOUNTER_SAVE_INTERVAL > 0
3333
#define PRINTCOUNTER_SYNC
3434
#endif

Marlin/src/HAL/STM32/u8g/LCD_defines.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ uint8_t u8g_com_HAL_STM32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, vo
3030

3131
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
3232
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
33+
34+
uint8_t u8g_com_stm32duino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // u8g_com_stm32duino_ssd_i2c.cpp
35+
#define U8G_COM_SSD_I2C_HAL u8g_com_stm32duino_ssd_i2c_fn
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
/**
2+
* Marlin 3D Printer Firmware
3+
* Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4+
*
5+
* Based on Sprinter and grbl.
6+
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
/**
24+
* 2-Wire I2C COM Driver
25+
*
26+
* Handles both Hardware and Software I2C so any pins can be used as SDA and SLC.
27+
* Wire library is used for Hardware I2C.
28+
* SlowSoftWire is used for Software I2C.
29+
*
30+
* Wire / SoftWire library selection can be done automatically at runtime.
31+
*
32+
* SDA and SLC pins must be named DOGLCD_SDA_PIN, DOGLCD_SCL_PIN to distinguish
33+
* from other I2C devices (e.g., EEPROM) that use I2C_SDA_PIN, I2C_SLC_PIN.
34+
*/
35+
#ifdef ARDUINO_ARCH_STM32
36+
37+
#include "../../../inc/MarlinConfig.h"
38+
39+
#if HAS_U8GLIB_I2C_OLED
40+
41+
#include <U8glib-HAL.h>
42+
43+
#if ENABLED(U8G_USES_HW_I2C)
44+
#include <Wire.h>
45+
#ifndef MASTER_ADDRESS
46+
#define MASTER_ADDRESS 0x01
47+
#endif
48+
#endif
49+
50+
#if ENABLED(U8G_USES_SW_I2C)
51+
#include <SlowSoftI2CMaster.h>
52+
#include <SlowSoftWire.h>
53+
#endif
54+
55+
/**
56+
* BUFFER_LENGTH is defined in libraries\Wire\utility\WireBase.h
57+
* Default value is 32
58+
* Increase this value to 144 to send U8G_COM_MSG_WRITE_SEQ in single block
59+
*/
60+
#ifndef BUFFER_LENGTH
61+
#define BUFFER_LENGTH 32
62+
#endif
63+
#if BUFFER_LENGTH > 144
64+
#error "BUFFER_LENGTH should not be greater than 144."
65+
#endif
66+
#define I2C_MAX_LENGTH (BUFFER_LENGTH - 1)
67+
68+
uint8_t u8g_com_stm32duino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
69+
// Hardware I2C flag
70+
#ifdef COMPILE_TIME_I2C_IS_HARDWARE
71+
constexpr bool isHardI2C = ENABLED(COMPILE_TIME_I2C_IS_HARDWARE);
72+
#else
73+
static bool isHardI2C = false;
74+
static bool i2c_initialized = false; // Flag to only run init/linking code once
75+
if (!i2c_initialized) { // Init runtime linkages
76+
i2c_initialized = true; // Only do this once
77+
I2C_TypeDef *i2cInstance1 = (I2C_TypeDef *)pinmap_peripheral(digitalPinToPinName(DOGLCD_SDA_PIN), PinMap_I2C_SDA);
78+
I2C_TypeDef *i2cInstance2 = (I2C_TypeDef *)pinmap_peripheral(digitalPinToPinName(DOGLCD_SCL_PIN), PinMap_I2C_SCL);
79+
isHardI2C = (i2cInstance1 && (i2cInstance1 == i2cInstance2)); // Found hardware I2C controller
80+
}
81+
#endif
82+
83+
static uint8_t msgInitCount = 0; // Ignore all messages until 2nd U8G_COM_MSG_INIT
84+
if (msgInitCount) {
85+
if (msg == U8G_COM_MSG_INIT) msgInitCount--;
86+
if (msgInitCount) return -1;
87+
}
88+
89+
static uint8_t control;
90+
if (isHardI2C) { // Found hardware I2C controller
91+
#if ENABLED(U8G_USES_HW_I2C)
92+
static TwoWire wire2; // A TwoWire object for use below
93+
switch (msg) {
94+
case U8G_COM_MSG_INIT:
95+
wire2.setClock(400000);
96+
wire2.setSCL(DOGLCD_SCL_PIN);
97+
wire2.setSDA(DOGLCD_SDA_PIN);
98+
wire2.begin(MASTER_ADDRESS, 0); // Start as master
99+
break;
100+
101+
case U8G_COM_MSG_ADDRESS: // Define cmd (arg_val = 0) or data mode (arg_val = 1)
102+
control = arg_val ? 0x40 : 0x00;
103+
break;
104+
105+
case U8G_COM_MSG_WRITE_BYTE:
106+
wire2.beginTransmission(0x3C);
107+
wire2.write(control);
108+
wire2.write(arg_val);
109+
wire2.endTransmission();
110+
break;
111+
112+
case U8G_COM_MSG_WRITE_SEQ: {
113+
uint8_t* dataptr = (uint8_t*)arg_ptr;
114+
#ifdef I2C_MAX_LENGTH
115+
while (arg_val > 0) {
116+
wire2.beginTransmission(0x3C);
117+
wire2.write(control);
118+
if (arg_val <= I2C_MAX_LENGTH) {
119+
wire2.write(dataptr, arg_val);
120+
arg_val = 0;
121+
}
122+
else {
123+
wire2.write(dataptr, I2C_MAX_LENGTH);
124+
arg_val -= I2C_MAX_LENGTH;
125+
dataptr += I2C_MAX_LENGTH;
126+
}
127+
wire2.endTransmission();
128+
}
129+
#else
130+
wire2.beginTransmission(0x3C);
131+
wire2.write(control);
132+
wire2.write(dataptr, arg_val);
133+
wire2.endTransmission();
134+
#endif // I2C_MAX_LENGTH
135+
break;
136+
}
137+
}
138+
#endif // U8G_USES_HW_I2C
139+
}
140+
else { // Software I2C
141+
#if ENABLED(U8G_USES_SW_I2C)
142+
static SlowSoftWire sWire = SlowSoftWire(DOGLCD_SDA_PIN, DOGLCD_SCL_PIN);
143+
144+
switch (msg) {
145+
case U8G_COM_MSG_INIT:
146+
sWire.setClock(400000);
147+
sWire.begin(); // Start as master
148+
break;
149+
150+
case U8G_COM_MSG_ADDRESS: // Define cmd (arg_val = 0) or data mode (arg_val = 1)
151+
control = arg_val ? 0x40 : 0x00;
152+
break;
153+
154+
case U8G_COM_MSG_WRITE_BYTE:
155+
sWire.beginTransmission((uint8_t)0x3C);
156+
sWire.write((uint8_t)control);
157+
sWire.write((uint8_t)arg_val);
158+
sWire.endTransmission();
159+
break;
160+
161+
case U8G_COM_MSG_WRITE_SEQ: {
162+
uint8_t* dataptr = (uint8_t*)arg_ptr;
163+
#ifdef I2C_MAX_LENGTH
164+
while (arg_val > 0) {
165+
sWire.beginTransmission((uint8_t)0x3C);
166+
sWire.write((uint8_t)control);
167+
if (arg_val <= I2C_MAX_LENGTH) {
168+
sWire.write((const uint8_t *)dataptr, (size_t)arg_val);
169+
arg_val = 0;
170+
}
171+
else {
172+
sWire.write((const uint8_t *)dataptr, I2C_MAX_LENGTH);
173+
arg_val -= I2C_MAX_LENGTH;
174+
dataptr += I2C_MAX_LENGTH;
175+
}
176+
sWire.endTransmission();
177+
}
178+
#else
179+
sWire.beginTransmission((uint8_t)0x3C);
180+
sWire.write((uint8_t)control);
181+
sWire.write((const uint8_t *)dataptr, (size_t)arg_val);
182+
sWire.endTransmission();
183+
#endif // I2C_MAX_LENGTH
184+
break;
185+
}
186+
}
187+
#endif // U8G_USES_SW_I2C
188+
}
189+
190+
return 1;
191+
}
192+
193+
#endif // HAS_U8GLIB_I2C_OLED
194+
#endif // ARDUINO_ARCH_STM32

Marlin/src/HAL/STM32F1/MinSerial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void install_min_serial() {
9292
HAL_min_serial_out = &TX;
9393
}
9494

95-
#if DISABLED(DYNAMIC_VECTORTABLE) && DISABLED(STM32F0xx) // Cortex M0 can't branch to a symbol that's too far, so we have a specific hack for them
95+
#if NONE(DYNAMIC_VECTORTABLE, STM32F0xx) // Cortex M0 can't branch to a symbol that's too far, so we have a specific hack for them
9696
extern "C" {
9797
__attribute__((naked)) void JumpHandler_ASM() {
9898
__asm__ __volatile__ (

Marlin/src/core/language.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,21 @@
370370
#define STR_Z2 STR_C "2"
371371
#define STR_Z3 STR_C "3"
372372
#define STR_Z4 STR_C "4"
373+
#if CORE_IS_XY || CORE_IS_XZ
374+
#define STEPPER_A_NAME 'A'
375+
#else
376+
#define STEPPER_A_NAME 'X'
377+
#endif
378+
#if CORE_IS_XY || CORE_IS_YZ
379+
#define STEPPER_B_NAME 'B'
380+
#else
381+
#define STEPPER_B_NAME 'Y'
382+
#endif
383+
#if CORE_IS_XZ || CORE_IS_YZ
384+
#define STEPPER_C_NAME 'C'
385+
#else
386+
#define STEPPER_C_NAME 'Z'
387+
#endif
373388

374389
//
375390
// Endstop Names used by Endstops::report_states

Marlin/src/core/macros.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@
5555
#define CYCLES_PER_MICROSECOND (F_CPU / 1000000UL) // 16 or 20 on AVR
5656
#endif
5757

58+
// Macros to make a string from a macro
59+
#define STRINGIFY_(M) #M
60+
#define STRINGIFY(M) STRINGIFY_(M)
61+
#define CHARIFY(M) STRINGIFY(M)[0]
62+
63+
#define A(CODE) " " CODE "\n\t"
64+
#define L(CODE) CODE ":\n\t"
65+
5866
// Macros for bit masks
5967
#undef _BV
6068
#define _BV(b) (1 << (b))
@@ -794,13 +802,6 @@
794802
#define _DGUS_UI_IS(N) || (CAT(_UI_, DGUS_LCD_UI) == CAT(_UI_, N))
795803
#define DGUS_UI_IS(V...) (0 MAP(_DGUS_UI_IS, V))
796804

797-
// Macros to make a string from a macro
798-
#define STRINGIFY_(M) #M
799-
#define STRINGIFY( M) STRINGIFY_(M)
800-
801-
#define A(CODE) " " CODE "\n\t"
802-
#define L(CODE) CODE ":\n\t"
803-
804805
// Array shorthand
805806
#define COUNT(a) (sizeof(a)/sizeof(*a))
806807
#define ZERO(a) memset((void*)a,0,sizeof(a))

0 commit comments

Comments
 (0)