#include <MenuItems.h>
Public Member Functions | |
AnalogMenuItem (const AnalogMenuInfo *info, uint16_t defaultVal, MenuItem *next=nullptr, bool infoInPgm=INFO_LOCATION_PGM) | |
int | getOffset () const |
int | getStep () const |
void | setStep (int newStep) |
uint16_t | getDivisor () const |
int | unitNameLength () const |
void | copyUnitToBuffer (char *unitBuff, uint8_t size=5) const |
void | copyValue (char *buffer, uint8_t bufferSize) const |
float | getAsFloatingPointValue () const |
void | setFromFloatingPointValue (float value) |
int | getIntValueIncludingOffset () |
WholeAndFraction | getWholeAndFraction () const |
void | setFromWholeAndFraction (WholeAndFraction wf) |
uint8_t | getDecimalPlacesForDivisor () const |
uint16_t | getActualDecimalDivisor () const |
Public Member Functions inherited from ValueMenuItem | |
void | setCurrentValue (uint16_t val, bool silent=false) |
uint16_t | getCurrentValue () const |
Public Member Functions inherited from MenuItem | |
uint8_t | copyNameToBuffer (char *sz, int size) const |
uint8_t | copyNameToBuffer (char *sz, int offset, int size) const |
menuid_t | getId () const |
uint16_t | getMaximumValue () const |
uint16_t | getEepromPosition () const |
MenuType | getMenuType () const |
void | triggerCallback () const |
bool | isInfoProgMem () const |
void | setChanged (bool changed) |
void | setChanged (int num, bool changed) |
bool | isChanged (int num=0) const |
bool | isSendRemoteNeeded (uint8_t remoteNo) const |
void | setSendRemoteNeededAll () |
void | clearSendRemoteNeededAll () |
void | setSendRemoteNeeded (uint8_t remoteNo, bool needed) |
void | setReadOnly (bool active) |
bool | isReadOnly () const |
void | setLocalOnly (bool localOnly) |
bool | isLocalOnly () const |
void | setSecured (bool secured) |
bool | isSecured () const |
void | setVisible (bool visible) |
bool | isVisible () const |
MenuItem * | getNext () const |
void | setNext (MenuItem *pNext) |
void | changeOccurred (bool silent) |
Additional Inherited Members | |
Protected Member Functions inherited from ValueMenuItem | |
ValueMenuItem (MenuType menuType, const AnyMenuInfo *info, uint16_t defaultVal, MenuItem *next, bool infoPgm) | |
Protected Member Functions inherited from MenuItem | |
MenuItem (MenuType menuType, const AnyMenuInfo *menuInfo, MenuItem *next, bool infoProgMem) | |
Protected Attributes inherited from ValueMenuItem | |
uint16_t | currentValue |
Protected Attributes inherited from MenuItem | |
uint16_t | flags |
MenuItem * | next |
const AnyMenuInfo * | info = nullptr |
RuntimeRenderingFn | renderFn = nullptr |
MenuType | menuType |
An item that can represent a numeric value, integer, or decimal. On an 8bit Arduino this value is a 16 bit unsigned integer value. We can make it appear negative by giving a negative offset. We make it appear decimal by giving it a divisor. If the divisor were 2, we'd increment in halves. If the offset point were -100, unit dB and divisor 2, the first value would be -50.0dB and the next would be -49.5dB and so on. For convenience there are methods to convert between both floating point values and also fixed point (WholeAndFraction) values.
|
inline |
Create an instance of the class
info | an AnalogMenuInfo structure |
defaultVal | the default starting value |
next | the next menu in the chain if there is one, or NULL. |
int AnalogMenuItem::getOffset | ( | ) | const |
Returns the offset from the MenuInfo structure
|
inline |
Returns the step from the menu info structure
|
inline |
Change the step for incremental updates, must be an exact multiple of max value
uint16_t AnalogMenuItem::getDivisor | ( | ) | const |
Returns the divisor from the menu info structure
int AnalogMenuItem::unitNameLength | ( | ) | const |
Returns the length of the unit name
void AnalogMenuItem::copyUnitToBuffer | ( | char * | unitBuff, |
uint8_t | size = 5 |
||
) | const |
copies the unit name into the provided buffer
void AnalogMenuItem::copyValue | ( | char * | buffer, |
uint8_t | bufferSize | ||
) | const |
copies the whole value including unit into the buffer provided.
buffer | the buffer to write the value into |
bufferSize | the size of the buffer |
float AnalogMenuItem::getAsFloatingPointValue | ( | ) | const |
returns the closest floating point representation of the value, note that floating point values are not always able to exactly represent a given value and may therefore be slightly out.
void AnalogMenuItem::setFromFloatingPointValue | ( | float | value | ) |
Sets the menu item's current value to be the value provided in the float.
value | the new value. |
WholeAndFraction AnalogMenuItem::getWholeAndFraction | ( | ) | const |
gets the whole and fraction part with the fractional part converted to decimal for ease of use. It based upon the divisor.
void AnalogMenuItem::setFromWholeAndFraction | ( | WholeAndFraction | wf | ) |
sets the menu based on the decimal whole and decimal fraction part. If decimal is true, the fraction is expected to be in decimal form (eg for halves it would be 0 or 5).
wf | the whole fraction part. |
uint8_t AnalogMenuItem::getDecimalPlacesForDivisor | ( | ) | const |
uint16_t AnalogMenuItem::getActualDecimalDivisor | ( | ) | const |