rjrahul25 / m2tklib

Automatically exported from code.google.com/p/m2tklib
0 stars 0 forks source link

COMBO box doesn't support M2_KEY_DATA_DOWN correctly #146

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I use a slightly modified version of the Combo example.
When opening the COMBOFN Menu one can scroll through a Color list with the 
colors:
1. orange
2. yellow
3. cyan

Expected output would be on clicking M2_KEY_DATA_DOWN:
orange -> yellow -> cyan -> orange and so on.
This works.

When using M2_KEY_DATA_UP it is expected to get:
orange -> cyan -> yellow -> orange

What I get is:
orange -> cyan X-> yellow X-> orange, X means doesn't work.

The same happens for elements in Priority list.
When using M2_KEY_DATA_UP, I can only go from lowest-> highest, all other 
transitions won't work.

The example is compiled using Arduino 1.0.5-r2 and put onto a Teensy 3.1

I have another project with similar problem, that is compiled using Eclipse 
with Arduino Plugin and put on Teensy 3.1 as well.
Operation system is Win7.

Thank you for helping

Original issue reported on code.google.com by Clemens....@physik.uni-halle.de on 16 Dec 2014 at 7:51

Attachments:

GoogleCodeExporter commented 8 years ago
I was impatient, so I took a deeper look myself and found the problem.

There is a bug in m2elcombofn.c. To be more exact in 
static void m2_el_combofn_dec(m2_el_fnarg_p fn_arg)

If value of combo element != 0 nothing happens there.

Change the code to the following:
static void m2_el_combofn_dec(m2_el_fnarg_p fn_arg)
{
  uint8_t val = m2_el_combofn_get_val(fn_arg);

  if ( val == 0 )
  val = m2_el_combofn_get_len(fn_arg);
  if ( val > 0 )
      val--;

 m2_el_combofn_set_val(fn_arg, val);  
}

This seems to work. Please let me know if I did anything wrong there.
I hope I was able to make at least a small contribution to enhance this nice 
piece of library.

Original comment by Clemens....@physik.uni-halle.de on 16 Dec 2014 at 9:46

GoogleCodeExporter commented 8 years ago
hmmm guess nobody else ever used COMBO with DATA_UP. Yes, i also think it is a 
bug.
Thanks for pointing out this issue.

Original comment by olikr...@gmail.com on 16 Dec 2014 at 11:57