Skip to content

Commit d780bd4

Browse files
⛙ Merge w/Marlin
2 parents 3f1249a + e2817db commit d780bd4

163 files changed

Lines changed: 3260 additions & 1725 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,15 @@ __pycache__
176176
tags
177177
*.logs
178178
*.bak
179-
.aider*
180-
!.aiderignore
181179
.env
182180
desktop.ini
183181
!MarlinSimulator.exe
184182
schema.json
185183
sqlite*.db
184+
185+
# Tools
186+
.aider*
187+
!.aiderignore
188+
.zed/
189+
*mcp*.db
190+
github-app.yml

Marlin/Configuration.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,11 @@
23022302

23032303
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
23042304

2305+
#if DISABLED(USE_PROBE_FOR_Z_HOMING) && ALL(FIX_MOUNTED_PROBE, Z_SAFE_HOMING)
2306+
// If your Z Home (M206) is well-calibrated enable this to establish Probe Z0 before every G29
2307+
//#define PROBE_Z0_BEFORE_G29
2308+
#endif
2309+
23052310
// Beyond the probed grid, continue the implied tilt?
23062311
// Default is to maintain the height of the nearest edge.
23072312
//#define EXTRAPOLATE_BEYOND_GRID
@@ -2326,7 +2331,7 @@
23262331

23272332
//#define MESH_EDIT_GFX_OVERLAY // Display a graphics overlay while editing the mesh
23282333

2329-
#define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed
2334+
#define MESH_INSET 10 // (mm) Set Mesh bounds as an inset region of the bed
23302335
#define GRID_MAX_POINTS_X 7 // Don't use more than 9 points per axis, implementation limited
23312336
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
23322337

@@ -2338,8 +2343,7 @@
23382343
#define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle
23392344
#define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500
23402345

2341-
//#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used
2342-
// as the Z-Height correction value.
2346+
//#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // (mm) Use for Z-Height correction when the nozzle is off the mesh
23432347

23442348
//#define UBL_MESH_WIZARD // Run several commands in a row to get a complete mesh
23452349

@@ -2348,18 +2352,18 @@
23482352
*/
23492353
//#define AVOID_OBSTACLES
23502354
#if ENABLED(AVOID_OBSTACLES)
2351-
#define CLIP_W 23 // Bed clip width, should be padded a few mm over its physical size
2352-
#define CLIP_H 14 // Bed clip height, should be padded a few mm over its physical size
2355+
#define CLIP_W 23 // (mm) Bed clip width, should be padded a few mm over its physical size
2356+
#define CLIP_H 14 // (mm) Bed clip height, should be padded a few mm over its physical size
23532357

23542358
// Obstacle Rectangles defined as { X1, Y1, X2, Y2 }
2355-
#define OBSTACLE1 { (X_BED_SIZE) / 4 - (CLIP_W) / 2, 0, (X_BED_SIZE) / 4 + (CLIP_W) / 2, CLIP_H }
2356-
#define OBSTACLE2 { (X_BED_SIZE) * 3 / 4 - (CLIP_W) / 2, 0, (X_BED_SIZE) * 3 / 4 + (CLIP_W) / 2, CLIP_H }
2357-
#define OBSTACLE3 { (X_BED_SIZE) / 4 - (CLIP_W) / 2, (Y_BED_SIZE) - (CLIP_H), (X_BED_SIZE) / 4 + (CLIP_W) / 2, Y_BED_SIZE }
2358-
#define OBSTACLE4 { (X_BED_SIZE) * 3 / 4 - (CLIP_W) / 2, (Y_BED_SIZE) - (CLIP_H), (X_BED_SIZE) * 3 / 4 + (CLIP_W) / 2, Y_BED_SIZE }
2359+
#define OBSTACLE1 { (X_BED_SIZE) / 4 - (CLIP_W) / 2, 0, (X_BED_SIZE) / 4 + (CLIP_W) / 2, CLIP_H } // (mm)
2360+
#define OBSTACLE2 { (X_BED_SIZE) * 3 / 4 - (CLIP_W) / 2, 0, (X_BED_SIZE) * 3 / 4 + (CLIP_W) / 2, CLIP_H } // (mm)
2361+
#define OBSTACLE3 { (X_BED_SIZE) / 4 - (CLIP_W) / 2, (Y_BED_SIZE) - (CLIP_H), (X_BED_SIZE) / 4 + (CLIP_W) / 2, Y_BED_SIZE } // (mm)
2362+
#define OBSTACLE4 { (X_BED_SIZE) * 3 / 4 - (CLIP_W) / 2, (Y_BED_SIZE) - (CLIP_H), (X_BED_SIZE) * 3 / 4 + (CLIP_W) / 2, Y_BED_SIZE } // (mm)
23592363

23602364
// The probed grid must be inset for G29 J. This is okay, since it is
23612365
// only used to compute a linear transformation for the mesh itself.
2362-
#define G29J_MESH_TILT_MARGIN ((CLIP_H) + 1)
2366+
#define G29J_MESH_TILT_MARGIN ((CLIP_H) + 1) // (mm)
23632367
#endif
23642368

23652369
#elif ENABLED(MESH_BED_LEVELING)
@@ -2368,7 +2372,7 @@
23682372
//=================================== Mesh ==================================
23692373
//===========================================================================
23702374

2371-
#define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed
2375+
#define MESH_INSET 10 // (mm) Set Mesh bounds as an inset region of the bed
23722376
#define GRID_MAX_POINTS_X 5 // Don't use more than 7 points per axis, implementation limited
23732377
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
23742378

Marlin/Configuration_adv.h

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@
15261526
//#define MICROSTEP32 HIGH,LOW,HIGH
15271527

15281528
// Microstep settings (Requires a board with pins named X_MS1, X_MS2, etc.)
1529-
#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16]
1529+
#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // :[ 1, 2, 4, 8, 16 ]
15301530

15311531
/**
15321532
* @section stepper motor current
@@ -2986,6 +2986,8 @@
29862986
* Extra G-code to run while executing tool-change commands. Can be used to use an additional
29872987
* stepper motor (e.g., I axis in Configuration.h) to drive the tool-changer.
29882988
*/
2989+
//#define EVENT_GCODE_PARK_T0 "G28 A\nG1 A0" // Extra G-code to run before tool-change command (if T0 was active)
2990+
//#define EVENT_GCODE_PARK_T1 "G1 A10" // Extra G-code to run before tool-change command (if T1 was active)
29892991
//#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 A0" // Extra G-code to run while executing tool-change command T0
29902992
//#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1
29912993
//#define EVENT_GCODE_TOOLCHANGE_ALWAYS_RUN // Always execute above G-code sequences. Use with caution!
@@ -3568,7 +3570,7 @@
35683570
//#define MONITOR_DRIVER_STATUS
35693571

35703572
#if ENABLED(MONITOR_DRIVER_STATUS)
3571-
#define CURRENT_STEP_DOWN 50 // [mA]
3573+
#define CURRENT_STEP_DOWN 50 // (mA)
35723574
#define REPORT_CURRENT_CHANGE
35733575
#define STOP_ON_ERROR
35743576
#endif
@@ -3584,7 +3586,7 @@
35843586
*/
35853587
//#define HYBRID_THRESHOLD
35863588

3587-
#define X_HYBRID_THRESHOLD 100 // [mm/s]
3589+
#define X_HYBRID_THRESHOLD 100 // (mm/s)
35883590
#define X2_HYBRID_THRESHOLD 100
35893591
#define Y_HYBRID_THRESHOLD 100
35903592
#define Y2_HYBRID_THRESHOLD 100
@@ -3595,7 +3597,7 @@
35953597
#define I_HYBRID_THRESHOLD 3 // [linear=mm/s, rotational=°/s]
35963598
#define J_HYBRID_THRESHOLD 3 // [linear=mm/s, rotational=°/s]
35973599
#define K_HYBRID_THRESHOLD 3 // [linear=mm/s, rotational=°/s]
3598-
#define U_HYBRID_THRESHOLD 3 // [mm/s]
3600+
#define U_HYBRID_THRESHOLD 3 // (mm/s)
35993601
#define V_HYBRID_THRESHOLD 3
36003602
#define W_HYBRID_THRESHOLD 3
36013603
#define E0_HYBRID_THRESHOLD 30
@@ -4612,28 +4614,43 @@
46124614

46134615
/**
46144616
* Native ESP32 board with WiFi or add-on ESP32 WiFi-101 module
4617+
*
4618+
* Enable one or the other. The two are separate implementations sharing no code,
4619+
* and each has its own extras below.
4620+
*
4621+
* WIFISUPPORT covers both an add-on WiFi module wired to the controller and
4622+
* Marlin's own WiFi on an ESP32 build. ESP3D_WIFISUPPORT is ESP32 only.
46154623
*/
46164624
//#define WIFISUPPORT // Marlin embedded WiFi management. Not needed for simple WiFi serial port.
46174625
//#define ESP3D_WIFISUPPORT // ESP3D Library WiFi management (https://github.com/luc-github/ESP3DLib)
46184626

4619-
/**
4620-
* Extras for an ESP32-based motherboard with WIFISUPPORT
4621-
* These options don't apply to add-on WiFi modules based on ESP32 WiFi101.
4622-
*/
4623-
#if ANY(WIFISUPPORT, ESP3D_WIFISUPPORT)
4627+
#if ENABLED(WIFISUPPORT)
4628+
/**
4629+
* Marlin's own webserver and OTA, implemented in HAL/ESP32/wifi/ and built
4630+
* only for an ESP32 build of Marlin. With an add-on WiFi module the module
4631+
* runs its own firmware, so neither option has any effect there.
4632+
*/
46244633
//#define WEBSUPPORT // Start a webserver (which may include auto-discovery) using SPIFFS
46254634
//#define OTASUPPORT // Support over-the-air firmware updates
4626-
//#define WIFI_CUSTOM_COMMAND // Accept feature config commands (e.g., WiFi ESP3D) from the host
46274635

46284636
/**
4629-
* To set a default WiFi SSID / Password, create a file called Configuration_Secure.h with
4630-
* the following defines, customized for your network. This specific file is excluded via
4631-
* .gitignore to prevent it from accidentally leaking to the public.
4637+
* The network is set at compile time. To set a default WiFi SSID / Password, create a file
4638+
* called Configuration_Secure.h with the following defines, customized for your network.
4639+
* This specific file is excluded via .gitignore to prevent it from accidentally leaking
4640+
* to the public.
46324641
*
46334642
* #define WIFI_SSID "WiFi SSID"
46344643
* #define WIFI_PWD "WiFi Password"
46354644
*/
46364645
//#include "Configuration_Secure.h" // External file with WiFi SSID / Password
4646+
4647+
#elif ENABLED(ESP3D_WIFISUPPORT)
4648+
/**
4649+
* ESP3D brings its own webserver and OTA, so WEBSUPPORT and OTASUPPORT don't apply here.
4650+
* The network is configured at runtime with '[ESP100]' / '[ESP101]' and stored on the ESP,
4651+
* so WIFI_SSID / WIFI_PWD don't apply either.
4652+
*/
4653+
//#define WIFI_CUSTOM_COMMAND // Accept ESP3D '[ESP...]' commands from the host
46374654
#endif
46384655

46394656
// @section multi-material

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 "2026-09-03"
44+
//#define STRING_DISTRIBUTION_DATE "2026-09-08"
4545

4646
#define STRING_DISTRIBUTION_DATE __DATE__
4747
#define STRING_DISTRIBUTION_TIME __TIME__

Marlin/src/HAL/GD32_MFL/inc/Conditionals_adv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
*/
2222
#pragma once
2323

24-
#if ALL(HAS_MEDIA, USBD_USE_CDC_MSC)
25-
#define HAS_SD_HOST_DRIVE 1
24+
#if ALL(HAS_MEDIA, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
25+
#define HAL_SD_HOST_DRIVE 1
2626
#endif

Marlin/src/HAL/RP2040/AGENTS.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ Because the framework is upstream, there is **no mirror-to-installed-package ste
3232

3333
3. **EEPROM backend is per-board, not auto-selected.** The HAL ships two backends: `eeprom/eeprom_flash.cpp` (`FLASH_EEPROM_EMULATION`) and `eeprom/eeprom_wired.cpp` (`USE_WIRED_EEPROM`). Each RP2040 board's pins file must `#define` one of them; Marlin does not pick it automatically. The flash backend writes the **last flash sector** via `FLASH_TARGET_OFFSET = PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE` and **assumes 2 MB flash** — change that if a board has different flash size (`eeprom_flash.cpp`). Writes disable interrupts around `flash_range_erase`/ `flash_range_program`.
3434

35-
4. **USB SD-host drive (MSC) is TinyUSB-based and off by default on RP2040.** `raspberrypi.ini` compiles with `-DNO_SD_HOST_DRIVE`; `HAS_SD_HOST_DRIVE` / `msc_sd.cpp` (TinyUSB `tud_msc_*_cb` callbacks) is only active if you drop that flag (see the commented `#custom_marlin.HAS_SD_HOST_DRIVE = tinyusb` line). The USB connect/disconnect toggle in `HAL.cpp` (`USB_CONNECT_PIN`) exists only when that pin is defined.
35+
4. **`freeMemory()` relies on a linker symbol, not a stack probe.** It computes `(char*)&__StackLimit - (char*)_sbrk(0)` using the Pico linker-provided `__StackLimit` (`HAL.cpp`). Don't "fix" it with a local-variable subtraction as on single-stack chips — that is wrong on this core.
3636

37-
5. **`freeMemory()` relies on a linker symbol, not a stack probe.** It computes `(char*)&__StackLimit - (char*)_sbrk(0)` using the Pico linker-provided `__StackLimit` (`HAL.cpp`). Don't "fix" it with a local-variable subtraction as on single-stack chips — that is wrong on this core.
37+
5. **`flashFirmware()` (M997) reboots into the bootloader via the watchdog.** `flashFirmware()``hal.reboot()``watchdog_reboot(0,0,1)` (`HAL.cpp`). The `raspberrypi.ini` build flags include `-DPLATFORM_M997_SUPPORT` (also forced on in `HAL.h`). A UF2/picotool upload picks up the reset.
3838

39-
6. **`flashFirmware()` (M997) reboots into the bootloader via the watchdog.** `flashFirmware()``hal.reboot()``watchdog_reboot(0,0,1)` (`HAL.cpp`). The `raspberrypi.ini` build flags include `-DPLATFORM_M997_SUPPORT` (also forced on in `HAL.h`). A UF2/picotool upload picks up the reset.
40-
41-
7. **SPI uses the core's `<SPI.h>` directly; SOFTWARE_SPI path also exists.** `HAL_SPI.cpp` includes `<SPI.h>` and calls `spiBegin()`; a software-SPI fallback is compiled when `SOFTWARE_SPI` is enabled. There is no custom `SPI` global shim needed (unlike AT32). `spi_pins.h` pins live in `HAL/RP2040/`.
39+
6. **SPI uses the core's `<SPI.h>` directly; SOFTWARE_SPI path also exists.** `HAL_SPI.cpp` includes `<SPI.h>` and calls `spiBegin()`; a software-SPI fallback is compiled when `SOFTWARE_SPI` is enabled. There is no custom `SPI` global shim needed (unlike AT32). `spi_pins.h` pins live in `HAL/RP2040/`.
4240

4341
## Conventions
4442

Marlin/src/HAL/RP2040/HAL.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern "C" {
3838
#include "pico/time.h"
3939
}
4040

41-
#if HAS_SD_HOST_DRIVE
41+
#if HAL_SD_HOST_DRIVE
4242
#include "msc_sd.h"
4343
#endif
4444

@@ -178,7 +178,7 @@ void MarlinHAL::init() {
178178

179179
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the min serial handler
180180

181-
TERN_(HAS_SD_HOST_DRIVE, MSC_SD_init()); // Enable USB SD card access
181+
TERN_(HAL_SD_HOST_DRIVE, MSC_SD_init()); // Enable USB SD card access
182182

183183
#if PIN_EXISTS(USB_CONNECT)
184184
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
@@ -187,6 +187,8 @@ void MarlinHAL::init() {
187187
#endif
188188
}
189189

190+
void MarlinHAL::idletask() { TERN_(HAL_SD_HOST_DRIVE, tuh_task()); }
191+
190192
uint8_t MarlinHAL::get_reset_source() {
191193
return watchdog_enable_caused_reboot() ? RST_WATCHDOG : 0;
192194
}

Marlin/src/HAL/RP2040/HAL.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636

3737
#include "../../inc/MarlinConfigPre.h"
3838

39-
#if HAS_SD_HOST_DRIVE
40-
#include "msc_sd.h"
41-
#endif
42-
4339
// ADC index 4 is the MCU temperature
4440
#define HAL_ADC_MCU_TEMP_DUMMY_PIN 127
4541
#define TEMP_SOC_PIN HAL_ADC_MCU_TEMP_DUMMY_PIN // ADC4 is internal temp sensor
@@ -167,7 +163,7 @@ class MarlinHAL {
167163
static void delay_ms(const int ms) { delay(ms); }
168164

169165
// Tasks, called from marlin.idle()
170-
static void idletask() { TERN_(HAS_SD_HOST_DRIVE, tuh_task()); }
166+
static void idletask();
171167

172168
// Reset
173169
static uint8_t get_reset_source();

Marlin/src/HAL/RP2040/inc/Conditionals_adv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#pragma once
2323

2424
#if HAS_MEDIA && DISABLED(NO_SD_HOST_DRIVE)
25-
#define HAS_SD_HOST_DRIVE 1
25+
#define HAL_SD_HOST_DRIVE 1
2626
#endif
2727

2828
// Fix F_CPU not being a compile-time constant in RP2040 framework

Marlin/src/HAL/RP2040/msc_sd.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323

2424
#ifdef __PLAT_RP2040__
2525

26-
#include "../../inc/MarlinConfigPre.h"
26+
#include "../../inc/MarlinConfig.h"
2727

28-
#if HAS_SD_HOST_DRIVE
28+
#if HAL_SD_HOST_DRIVE
2929

3030
#include "../../sd/cardreader.h"
3131

@@ -100,5 +100,5 @@ void MSC_SD_init() {
100100
// Add USB reinitialization logic if needed
101101
}
102102

103-
#endif // HAS_SD_HOST_DRIVE
103+
#endif // HAL_SD_HOST_DRIVE
104104
#endif // __PLAT_RP2040__

0 commit comments

Comments
 (0)