[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Setters for min/max values? RSS feed
Forum Index » tcMenu Arduinio library
Author Message
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
First of all, this library and the generator has saved me an insane amount of time. Thank you for all of your efforts!

I’ve run into a situation where I’d like to constrain min and max values at runtime. For example, I’ve set 0/255 (respectively) as the default in Designer. In certain circumstances, it may be necessary to change that.

Is there a setter that I’ve missed, or some other workaround?

Thank you again!!

Steve
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Thanks for letting us know it's working for you!

In 1.7 of the library the analog item's core settings are always stored in FLASH / PROGMEM.

However, in 2.0 (due out shortly, honestly this time, we keep saying it, but now it is going through final testing) you have the option of creating these core data structures in RAM instead. The easiest way to use it would be to create your own menu item as explained in this page: https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/menu-item-types/. Towards the bottom of the page, there's a link to documentation for each item type.

In library 2.0 each of the constructors for menu items now has an extra boolean parameter at the end, it tells the menu item if the INFO data structure is in FLASH or RAM:

AnalogMenuItem(const AnalogMenuInfo* info, uint16_t defaultVal, MenuItem* next = nullptr, bool infoInPgm = INFO_LOCATION_PGM)


You would then insert the menu item where you want it using something similar to:

menuMgr.addMenuAfter(&menuExistingItem, &menuMyNewItem, triggerStructureChangedCallbacks);


davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Just to add, the item type pages will be updated with the new constructors once we've got 2.0 out. So in summary, not there yet, but coming really soon.
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
Thank you for the quick reply! Looking forward to v2!

Steve
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.