Procházet zdrojové kódy

Avoid + 0.0f in menu items (#21642)

Ramiro Polla před 3 roky
rodič
revize
7a8e3cc258
No account linked to committer's email address
1 změnil soubory, kde provedl 5 přidání a 5 odebrání
  1. 5
    5
      Marlin/src/lcd/menu/menu_item.h

+ 5
- 5
Marlin/src/lcd/menu/menu_item.h Zobrazit soubor

@@ -111,17 +111,17 @@ class TMenuEditItem : MenuEditItemBase {
111 111
 // These items call the Edit Item draw method passing the prepared string.
112 112
 #define __DOFIXfloat PROBE()
113 113
 #define _DOFIX(TYPE,V) TYPE(TERN(IS_PROBE(__DOFIX##TYPE),FIXFLOAT(V),(V)))
114
-#define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, V...) \
114
+#define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, ETC...) \
115 115
   struct MenuEditItemInfo_##NAME { \
116 116
     typedef TYPE type_t; \
117
-    static inline float scale(const_float_t value)   { return value * (SCALE) + (V+0); } \
118
-    static inline float unscale(const_float_t value) { return value / (SCALE) + (V+0); } \
117
+    static inline float scale(const_float_t value)   { return value * (SCALE) ETC; } \
118
+    static inline float unscale(const_float_t value) { return value / (SCALE) ETC; } \
119 119
     static inline const char* strfunc(const_float_t value) { return STRFUNC(_DOFIX(TYPE,value)); } \
120 120
   }; \
121 121
   typedef TMenuEditItem<MenuEditItemInfo_##NAME> MenuItem_##NAME
122 122
 
123
-//                         NAME         TYPE      STRFUNC          SCALE         +ROUND
124
-DEFINE_MENU_EDIT_ITEM_TYPE(percent     ,uint8_t  ,ui8tostr4pctrj  , 100.f/255.f, 0.5f);  // 100%   right-justified
123
+//                         NAME         TYPE      STRFUNC          SCALE         ROUND
124
+DEFINE_MENU_EDIT_ITEM_TYPE(percent     ,uint8_t  ,ui8tostr4pctrj  , 100.f/255.f, +0.5f);  // 100%   right-justified
125 125
 DEFINE_MENU_EDIT_ITEM_TYPE(percent_3   ,uint8_t  ,pcttostrpctrj   ,   1     );   // 100%   right-justified
126 126
 DEFINE_MENU_EDIT_ITEM_TYPE(int3        ,int16_t  ,i16tostr3rj     ,   1     );   // 123, -12   right-justified
127 127
 DEFINE_MENU_EDIT_ITEM_TYPE(int4        ,int16_t  ,i16tostr4signrj ,   1     );   // 1234, -123 right-justified

Loading…
Zrušit
Uložit