MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
15.94k stars 19.08k forks source link

check for HAS_MULTI_HOTEND in Temperature::getHeaterPower #27037

Open ellensp opened 2 weeks ago

ellensp commented 2 weeks ago

Description

While p3p was updating the sim for multiple extruders and hotend he came across a bug in Marlin. for full details. https://discord.com/channels/461605380783472640/491105471076368390/1234651377863753829

The issue is that Temperature::getHeaterPower does not know about single hotend options, so the array temp_hotend[heater_id] goes out of bounds when there is only 1 hotend with multiple extruders.

This fix is just to limit the array to 0 when there is only the 1 hotend

Ie temp_hotend[TERN0(HAS_MULTI_HOTEND, heater_id)]

Requirements

Multiple extruders with a single hotend.

Benefits

Array is not over run.