Fix machine envelope G-code emitting wrong limits due to broken extruder_id indexing (#12414)
print_machine_envelope() used get_extruder_id(extruder_id)*2 to index machine limit arrays that only hold [Normal, Stealth] (2 entries). For multi-extruder setups this went out-of-bounds, causing wrong M201/M203 values in the G-code which then override the estimator's correct limits. Same class of bug as c6d1c11ebb but on the G-code writer side. Changes: - Remove unused extruder_id param from print_machine_envelope() - Use .values.front() for M201/M203, matching M204/M205 in same function - Change get_option_value() fallback from .back() to .front() so any future out-of-bounds index returns Normal mode instead of Stealth
This commit is contained in:
@@ -124,7 +124,7 @@ static void set_option_value(ConfigOptionFloats& option, size_t id, float value)
|
||||
static float get_option_value(const ConfigOptionFloats& option, size_t id)
|
||||
{
|
||||
return option.values.empty() ? 0.0f :
|
||||
((id < option.values.size()) ? static_cast<float>(option.values[id]) : static_cast<float>(option.values.back()));
|
||||
((id < option.values.size()) ? static_cast<float>(option.values[id]) : static_cast<float>(option.values.front()));
|
||||
}
|
||||
|
||||
static float estimated_acceleration_distance(float initial_rate, float target_rate, float acceleration)
|
||||
|
||||
Reference in New Issue
Block a user