Fix machine envelope G-code emitting wrong limits due to broken extruder_id indexing #655

Closed
opened 2026-04-05 16:25:12 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @SoftFever on 2/22/2026

Description

Follow-up to #12411. print_machine_envelope() had the same extruder_id * 2 indexing bug on the G-code writer side:

  • get_extruder_id(extruder_id) * 2 was used to index machine limit arrays that only hold 2 entries [Normal, Stealth]. For multi-extruder setups this went out-of-bounds, causing wrong M201/M203 values to be emitted into the G-code, which the time estimator then reads and uses to override its initially-correct limits.
  • Removed the unused extruder_id parameter and switched to .values.front() (Normal mode), consistent with M204/M205 in the same function.
  • Changed get_option_value() fallback from .back() (Stealth) to .front() (Normal) so any future out-of-bounds index defaults to Normal mode instead of silently using Stealth values.

Screenshots/Recordings/Graphs

N/A — no UI changes.

Tests

*Originally created by @SoftFever on 2/22/2026* # Description Follow-up to #12411. `print_machine_envelope()` had the same `extruder_id * 2` indexing bug on the G-code **writer** side: - `get_extruder_id(extruder_id) * 2` was used to index machine limit arrays that only hold 2 entries `[Normal, Stealth]`. For multi-extruder setups this went out-of-bounds, causing wrong M201/M203 values to be emitted into the G-code, which the time estimator then reads and uses to override its initially-correct limits. - Removed the unused `extruder_id` parameter and switched to `.values.front()` (Normal mode), consistent with M204/M205 in the same function. - Changed `get_option_value()` fallback from `.back()` (Stealth) to `.front()` (Normal) so any future out-of-bounds index defaults to Normal mode instead of silently using Stealth values. # Screenshots/Recordings/Graphs N/A — no UI changes. ## Tests
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#655