Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for HAS_MULTI_HOTEND in Temperature::getHeaterPower #27037

Merged
merged 3 commits into from
May 20, 2024

Conversation

ellensp
Copy link
Contributor

@ellensp ellensp commented May 1, 2024

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.

@thinkyhead
Copy link
Member

Altered this to simply return a dummy power (0) if the index is invalid.

@thinkyhead thinkyhead merged commit 75eee04 into MarlinFirmware:bugfix-2.1.x May 20, 2024
62 checks passed
@ellensp ellensp deleted the getHeaterPower-issue branch May 20, 2024 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants