Skip to content

Commit 0985dd8

Browse files
committed
floatField
added field decimal places format.
1 parent 027a298 commit 0985dd8

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

examples/handlers/handlers/handlers.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ char name[]=" ";
137137
MENU(mainMenu,"Main menu",showEvent,anyEvent,wrapStyle
138138
,OP("Op1",showEvent,anyEvent)
139139
,OP("Op2",showEvent,anyEvent)
140-
,FIELD(test,"Test","%",0,100,10,1,showEvent,anyEvent,wrapStyle)
140+
,altFIELD(decPlaces<3>::menuField,test,"Test","%",0,100,1,0.001,showEvent,anyEvent,wrapStyle)
141141
,SUBMENU(subMenu)
142142
,SUBMENU(setLed)
143143
,OP("LED On",myLedOn,enterEvent)

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ArduinoMenu library
2-
version=4.18.3
2+
version=4.19.0
33
author=Rui Azevedo, [email protected]
44
maintainer=neu-rah, [email protected]
55
sentence=Generic menu/interactivity system

src/items.h

+9
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@
215215
#endif
216216
};
217217

218+
template<uint8_t dps>
219+
struct decPlaces {
220+
template<typename T>
221+
struct menuField:Menu::menuField<T> {
222+
using Menu::menuField<T>::menuField;
223+
idx_t printReflex(menuOut& o) const override;
224+
};
225+
};
226+
218227
//--------------------------------------------------------------------------
219228
template<typename T>
220229
class menuValue:public prompt {

src/itemsTemplates.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ namespace Menu {
102102
}
103103
}
104104

105+
template<uint8_t dps>
106+
template<typename T>
107+
idx_t decPlaces<dps>::menuField<T>::printReflex(menuOut& o) const {return o.print(Menu::menuField<T>::reflex,dps);}
108+
105109
template<typename T>
106110
Used choose<T>::printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,idx_t panelNr) {
107111
bool ed=this==root.navFocus;

0 commit comments

Comments
 (0)