EDIT: Doh, sorry, wrong subforum (was supposed to go into development general) :-\ ... maybe you could let users delete their own posts/threads? Anyway:
For the ml auto iso module, I'd like to use this...
.children = (struct menu_entry[]) {
{
.name = "Min. Av Shutter",
.priv = &m42_aiso_shutter,
[color=red].max = FASTEST_SHUTTER_SPEED_RAW/8-11,[/color]
.icon_type = IT_PERCENT,
.choices = CHOICES("OFF", "1/15", "1/30", "1/60", "1/125", "1/250", "1/500", "1/1000", "1/2000", "1/4000"),
.help = "Preferred shutter for Av mode (+/- 0.5 EV result).",
.help2 = "Selectable values starting from 1/15 in 1 EV steps.",
},
... problem is that FASTEST_SHUTTER_SPEED_RAW is a model-specific constant and I have to grab it with a getter function from the core code. But the menu struct stuff doesn't seem to accept any non-static values, any idea how to get around this?
I'm afraid it's not possible to do it exactly like that.
But you can try something like this: in a MENU_UPDATE_FUNC (which gets the menu entry as parameter):
entry->max = get_max_blahblah();
so you start with whatever default value you like, and it will be refreshed at first (well, at every) display update.
Quote from: a1ex on July 04, 2013, 05:24:27 PM
But you can try something like this: in a MENU_UPDATE_FUNC (which gets the menu entry as parameter): entry->max = get_max_blahblah();
Thanks a lot again for the quick answer, will do, if you ever do a "how to write modules" faq this should be probably in it.