-
-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Closed
Description
Bug Description
When editing some parameters on the LCD, the number loaded into the editor is wrong. (Close, bug not close enough.)
My Configurations
Ender-3 configuration from MarlinConfigurations.
Steps to Reproduce
- Select Main --> Temperature --> Fan Speed.
- Set fan speed to (e.g.) 10%.
- Press knob to re-enter editor. Editor shows 9% instead of 10%.
- Repeat ad lib.
Also happens some other places, though not quite as easy to find. For example:
- Select Main --> Configuration --> Advanced --> Temperature --> Fact.
- Set factor to 0.30. (Or 0.60 or 0.90...)
- Press knob; editor shows 0.29.
Suggested Fix
--- a/Marlin/src/lcd/menu/menu.h
+++ b/Marlin/src/lcd/menu/menu.h
@@ -236,5 +236,5 @@ class TMenuEditItem : MenuEditItemBase {
typedef typename NAME::type_t type_t;
static inline float unscale(const float value) { return value * (1.0f / NAME::scale); }
- static inline float scale(const float value) { return value * NAME::scale; }
+ static inline float scale(const float value) { return roundf(value * NAME::scale); }
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
Reactions are currently unavailable