-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
[BUG] Inconsistent/suboptimal types in ExtUI #27529
Comments
just a helpful hint, it would read better by using
result: float getActualFan_percent(const fan_t fan) {
UNUSED(fan);
return TERN0(HAS_FAN, thermalManager.scaledFanSpeedPercent(fan - FAN0));
}
also, why not make a Pull Request with your changes? |
are these the changes you mean? - celsius_float_t getActualTemp_celsius(const heater_t);
- celsius_float_t getActualTemp_celsius(const extruder_t);
- celsius_float_t getTargetTemp_celsius(const heater_t);
- celsius_float_t getTargetTemp_celsius(const extruder_t);
- float getActualFan_percent(const fan_t);
- float getTargetFan_percent(const fan_t);
+ celsius_t getActualTemp_celsius(const heater_t);
+ celsius_t getActualTemp_celsius(const extruder_t);
+ celsius_t getTargetTemp_celsius(const heater_t);
+ celsius_t getTargetTemp_celsius(const extruder_t);
+ uint8_t getActualFan_percent(const fan_t);
+ uint8_t getTargetFan_percent(const fan_t); |
@classicrocker883 Thanks, great tip, I didn't know about the "y", nice! @classicrocker883 Something like you mention, but getActualTemp_celsius should use floats.
|
Did you test the latest
bugfix-2.1.x
code?Yes, and the problem still exists.
Bug Description
Not really a bug, but just something I found in the ExtUI code that could possibly be improved.
Some functions in ExtUI are inconsistent with the internal function calls used:
Target temps are of type celsius_t(int16_t), not celsius_float_t.
So the function returns a float, but internally it just gets a uint8_t.
So the function returns a float, but internally it just gets a uint8_t.
I tested the code with the suggested changes, nothing breaks, everything works as expected.
Bug Timeline
Not a bug
Expected behavior
More efficient code
Actual behavior
Odd code
Steps to Reproduce
Just have a look at the code given above
Version of Marlin Firmware
Lastest
Printer model
Custom
Electronics
MKS Monster8 V1.0
LCD/Controller
BTT TFT35 V3.0,
Other add-ons
MKS EBB42 CAN Toolhead, BLTouch 3.1
Bed Leveling
ABL Bilinear mesh
Your Slicer
Cura
Host Software
None
Don't forget to include
Configuration.h
andConfiguration_adv.h
.Additional information & file uploads
Just a standard config file, nothing changed in here.
Dummy Config.zip
The text was updated successfully, but these errors were encountered: