Skip to content

Commit

Permalink
floatField
Browse files Browse the repository at this point in the history
added field decimal places format.
  • Loading branch information
neu-rah committed Feb 20, 2020
1 parent 027a298 commit 0985dd8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/handlers/handlers/handlers.ino
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ char name[]=" ";
MENU(mainMenu,"Main menu",showEvent,anyEvent,wrapStyle
,OP("Op1",showEvent,anyEvent)
,OP("Op2",showEvent,anyEvent)
,FIELD(test,"Test","%",0,100,10,1,showEvent,anyEvent,wrapStyle)
,altFIELD(decPlaces<3>::menuField,test,"Test","%",0,100,1,0.001,showEvent,anyEvent,wrapStyle)
,SUBMENU(subMenu)
,SUBMENU(setLed)
,OP("LED On",myLedOn,enterEvent)
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ArduinoMenu library
version=4.18.3
version=4.19.0
author=Rui Azevedo, ruihfazevedo@gmail.com
maintainer=neu-rah, ruihfazevedo@gmail.com
sentence=Generic menu/interactivity system
Expand Down
9 changes: 9 additions & 0 deletions src/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@
#endif
};

template<uint8_t dps>
struct decPlaces {
template<typename T>
struct menuField:Menu::menuField<T> {
using Menu::menuField<T>::menuField;
idx_t printReflex(menuOut& o) const override;
};
};

//--------------------------------------------------------------------------
template<typename T>
class menuValue:public prompt {
Expand Down
4 changes: 4 additions & 0 deletions src/itemsTemplates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ namespace Menu {
}
}

template<uint8_t dps>
template<typename T>
idx_t decPlaces<dps>::menuField<T>::printReflex(menuOut& o) const {return o.print(Menu::menuField<T>::reflex,dps);}

template<typename T>
Used choose<T>::printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,idx_t panelNr) {
bool ed=this==root.navFocus;
Expand Down

0 comments on commit 0985dd8

Please sign in to comment.