Skip to content

octoprint: Fix serial output from chamber power to expected chamber temp format#4671

Open
bkerler wants to merge 1 commit intoprusa3d:masterfrom
bkerler:fix_chamber_temp
Open

octoprint: Fix serial output from chamber power to expected chamber temp format#4671
bkerler wants to merge 1 commit intoprusa3d:masterfrom
bkerler:fix_chamber_temp

Conversation

@bkerler
Copy link

@bkerler bkerler commented May 28, 2025

This changes the C@: output which shall be used for chamber power only to C:x.x/m.m where x is current chamber temp and m is target chamber temp in order to match the expected behaviour, see reference. Also separated from chamber power define to allow chamber temp being used if chamber api and chamber temp is supported, even if chamber power isn't defined.

As HAS_HEATER_CHAMBER and HAS_TEMP_CHAMBER are old Merlin defines and HAS_CHAMBER_API() is used in favor, we prioritize HAS_CHAMBER_API for now until the old Merlin code has been removed.

@ulab
Copy link

ulab commented May 28, 2025

I am not an expert on these values, but does software expect it to be in the form C:1.0/0.0 where 1.0 is the current chamber temp and 0.0 the target temp?

All other temperatures seem to be in that format.

Recv: T:230.00/230.00 B:60.02/60.00 X:37.45/36.00 A:48.65/0.00 @:137 B@:73 C@:31.61 HBR@:255

https://reprap.org/wiki/G-code#M105:_Get_Extruder_Temperature seems to be a little vague on this:

A temperature report will usually include actual and target temperature for all available heaters, with the format being "actual/target" or - for some firmware variants - "actual /target". During a blocking heatup some firmware variants only report the temperature tuple for the heater that is currently in blocking heatup state.

The ambient temperature is being reported as A:48.65/0.00 too and it hopefully doesn't have a target temp set by the printer ;-).

@bkerler bkerler force-pushed the fix_chamber_temp branch from 9e0b45c to a389b6b Compare May 28, 2025 07:15
@bkerler
Copy link
Author

bkerler commented May 28, 2025

@ulab Good point, thanks ! I've changed the PR to reflect the expected format.

@bkerler
Copy link
Author

bkerler commented May 28, 2025

The format seems to accept both C:49.3 and C:49.3/39.3 .... but as we already have a function to get the target chamber temperature, it does sound right to also add it to be parsed :)

@bkerler bkerler changed the title octoprint: Fix serial output from chamber power to chamber temp parameter octoprint: Fix serial output from chamber power to expected chamber temp format May 28, 2025
auto current_chamber_temperature = buddy::chamber().current_temperature();
if (current_chamber_temperature.has_value()) SERIAL_ECHOPAIR(" C@:", current_chamber_temperature.value());
auto target_chamber_temperature = buddy::chamber().target_temperature();
if (current_chamber_temperature.has_value()) SERIAL_ECHOPAIR(" C:", current_chamber_temperature.value(), "/", target_chamber_temperature.value());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think ECHOPAIR will work with four parameters?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, at least there are several codelines using multiple arguments (see binary_protocol.h, line 170).
But for readability, I've now split it up to two SERIAL_ECHOPAIR :)

auto current_chamber_temperature = buddy::chamber().current_temperature();
if (current_chamber_temperature.has_value()) SERIAL_ECHOPAIR(" C@:", current_chamber_temperature.value());
auto target_chamber_temperature = buddy::chamber().target_temperature();
if (current_chamber_temperature.has_value()) SERIAL_ECHOPAIR(" C:", current_chamber_temperature.value(), "/", target_chamber_temperature.value());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not checking whether target_chamber_temperature has value

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely right. Fixed that.

@bkerler bkerler force-pushed the fix_chamber_temp branch from a389b6b to 4209499 Compare May 28, 2025 10:57
@bkerler bkerler requested a review from CZDanol May 28, 2025 11:00
auto target_chamber_temperature = buddy::chamber().target_temperature();
if (current_chamber_temperature.has_value()){
SERIAL_ECHOPAIR(" C:", current_chamber_temperature.value());
SERIAL_ECHOPAIR("/", target_chamber_temperature.has_value() ? target_chamber_temperature.value() : 0.0f);
Copy link
Contributor

@CZDanol CZDanol May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is std::optional::value_or. In that case, you don't even need to store target_chamber_temperature into a separate variable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool :) Thanks for the tip !

auto current_chamber_temperature = buddy::chamber().current_temperature();
if (current_chamber_temperature.has_value()) SERIAL_ECHOPAIR(" C@:", current_chamber_temperature.value());
auto target_chamber_temperature = buddy::chamber().target_temperature();
if (current_chamber_temperature.has_value()){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick/tip: You can do if(auto temp = buddy::chamber().current_temperature())

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do :)

@bkerler bkerler force-pushed the fix_chamber_temp branch from 4209499 to af7cf95 Compare May 28, 2025 15:06
@bkerler bkerler requested a review from CZDanol May 28, 2025 15:08
@bkerler bkerler force-pushed the fix_chamber_temp branch 3 times, most recently from af2baa1 to fbb6a03 Compare May 29, 2025 10:05
@TLMcNulty
Copy link

Would love to see this merged and released! In discussion with some octo contributors it looks good.

@graelo
Copy link

graelo commented Aug 16, 2025

Hi, thanks for this work!
I'm curious about why this PR isn't making progress anymore, can you share? Oh, by the way, unfortunately we currently can't access the Jenkins logs.

@graelo
Copy link

graelo commented Aug 19, 2025

Thank you @bkerler ❤️

@3d-gussner
Copy link
Collaborator

Oh, by the way, unfortunately we currently can't access the Jenkins logs.

FYI: Jenkins has been disabled on public PRs.

@3d-gussner
Copy link
Collaborator

@bkerler Can you please check if that hasn't been implemented in 6.4.0-alpha or 6.4.0-rc?

@bkerler
Copy link
Author

bkerler commented Sep 30, 2025

Sure ! Will have a look

@BlueFyre
Copy link

The RC seems to still have the old one:

if (current_chamber_temperature.has_value()) SERIAL_ECHOPAIR(" C@:", current_chamber_temperature.value());

@bkerler
Copy link
Author

bkerler commented Oct 3, 2025

@3d-gussner as @BlueFyre correctly already stated, the RC still does have the old behaviour and thus isn't fixed.

@3d-gussner
Copy link
Collaborator

@bkerler @BlueFyre Thanks for reviewing, forwarded the information to the developers.

@ruebarb
Copy link

ruebarb commented Dec 5, 2025

Same issue for C1L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants