Browse Source

Avoid + 0.0f in menu items (#21642)

Ramiro Polla 3 years ago
parent
commit
7a8e3cc258
No account linked to committer's email address
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      Marlin/src/lcd/menu/menu_item.h

+ 5
- 5
Marlin/src/lcd/menu/menu_item.h View File

111
 // These items call the Edit Item draw method passing the prepared string.
111
 // These items call the Edit Item draw method passing the prepared string.
112
 #define __DOFIXfloat PROBE()
112
 #define __DOFIXfloat PROBE()
113
 #define _DOFIX(TYPE,V) TYPE(TERN(IS_PROBE(__DOFIX##TYPE),FIXFLOAT(V),(V)))
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
   struct MenuEditItemInfo_##NAME { \
115
   struct MenuEditItemInfo_##NAME { \
116
     typedef TYPE type_t; \
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
     static inline const char* strfunc(const_float_t value) { return STRFUNC(_DOFIX(TYPE,value)); } \
119
     static inline const char* strfunc(const_float_t value) { return STRFUNC(_DOFIX(TYPE,value)); } \
120
   }; \
120
   }; \
121
   typedef TMenuEditItem<MenuEditItemInfo_##NAME> MenuItem_##NAME
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
 DEFINE_MENU_EDIT_ITEM_TYPE(percent_3   ,uint8_t  ,pcttostrpctrj   ,   1     );   // 100%   right-justified
125
 DEFINE_MENU_EDIT_ITEM_TYPE(percent_3   ,uint8_t  ,pcttostrpctrj   ,   1     );   // 100%   right-justified
126
 DEFINE_MENU_EDIT_ITEM_TYPE(int3        ,int16_t  ,i16tostr3rj     ,   1     );   // 123, -12   right-justified
126
 DEFINE_MENU_EDIT_ITEM_TYPE(int3        ,int16_t  ,i16tostr3rj     ,   1     );   // 123, -12   right-justified
127
 DEFINE_MENU_EDIT_ITEM_TYPE(int4        ,int16_t  ,i16tostr4signrj ,   1     );   // 1234, -123 right-justified
127
 DEFINE_MENU_EDIT_ITEM_TYPE(int4        ,int16_t  ,i16tostr4signrj ,   1     );   // 1234, -123 right-justified

Loading…
Cancel
Save