olikraus / m2tklib

Automatically exported from code.google.com/p/m2tklib
Other
49 stars 11 forks source link

Is M2_COMBO callback message missing? #122

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
M2_COMBO function callback is called too often and there is no way to check 
message against value being changed, like this:

if (msg == M2_U8_MSG_SET_VALUE)
{ 
     //do something ONLY when a new value is set
}

Thanks in advance.

Original issue reported on code.google.com by will...@curitiba.org on 22 Oct 2013 at 2:24

GoogleCodeExporter commented 9 years ago
That means you want M2_COMBO behave more like M2_U8NUMFN?

ToDo:
Implement M2_COMBOFN with similar msg handling as M2_U8NUMFN

Original comment by olikr...@gmail.com on 22 Oct 2013 at 6:10

GoogleCodeExporter commented 9 years ago
Example:
M2_U8NUMFN can check when there is a change and when it occurs some action 
based on that can be made.
M2_COMBO doesn't seens to be in the same way, as it is being constantly pooled, 
even without any value change. The simple fact of pressing navigating through 
the options causes M2_COMBO to be called a couple of times. Isn't it weird? 

Original comment by will...@curitiba.org on 22 Oct 2013 at 6:51

GoogleCodeExporter commented 9 years ago
> Isn't it weird? 
Depends... M2tklib has been designed to use as little RAM as possbile. No 
cacheing of the result is done, so the callback-procedure is asked for the 
value more often.
Additionally together with u8glib, there might be a lot of calls to the 
procedure.

Original comment by olikr...@gmail.com on 22 Oct 2013 at 7:04

GoogleCodeExporter commented 9 years ago
I see. It can be quick handled outside M2tklib without problem. I really don't 
know how useful is this kind of feedback. It's the first time I get envolved on 
this. Please let me know if I'm being pesky!

Thanks.

Original comment by will...@curitiba.org on 22 Oct 2013 at 7:41

GoogleCodeExporter commented 9 years ago
No problem. Any feedback is wellcome. M2_COMBO was one of the first elements, 
that had been implemented. I agree, that it does not really fit to the other 
elements.

Original comment by olikr...@gmail.com on 22 Oct 2013 at 7:47

GoogleCodeExporter commented 9 years ago

Original comment by olikr...@gmail.com on 22 Oct 2013 at 9:38

GoogleCodeExporter commented 9 years ago
  Element:
    M2_COMBOFN(el,fmt,cnt,fnptr)

  fnptr:
    const char *m2_combofn_fnptr(m2_rom_void_p element, uint8_t msg, uint8_t *valptr)

  msg:
    M2_COMBOFN_MSG_GET_VALUE
    M2_COMBOFN_MSG_SET_VALUE
    M2_COMBOFN_MSG_GET_STRING

--> implemented & tested with sdl variant

todo:
- create example
- documentation

Original comment by olikr...@gmail.com on 2 Nov 2013 at 6:16

GoogleCodeExporter commented 9 years ago

Original comment by olikr...@gmail.com on 2 Nov 2013 at 6:16

GoogleCodeExporter commented 9 years ago
documentation added
example for arduino u8glib added

todo
copy example to other variants

Original comment by olikr...@gmail.com on 3 Nov 2013 at 4:01

GoogleCodeExporter commented 9 years ago
GLCD Combo.pde updated

todo:
- udpate lc
- update nlc

Original comment by olikr...@gmail.com on 3 Nov 2013 at 6:59

GoogleCodeExporter commented 9 years ago
Worked fine :) Thank you, Oliver.

Original comment by will...@curitiba.org on 4 Nov 2013 at 3:36

GoogleCodeExporter commented 9 years ago
Thanks for testing. :-)

Original comment by olikr...@gmail.com on 4 Nov 2013 at 8:06

GoogleCodeExporter commented 9 years ago
nlc and lc combo example tested

Original comment by olikr...@gmail.com on 7 Nov 2013 at 8:50