CHDK touch-aware UI - General Discussion and Assistance - CHDK Forum

CHDK touch-aware UI

  • 4 Replies
  • 3079 Views
*

Offline srsa_4c

  • ******
  • 4451
CHDK touch-aware UI
« on: 16 / November / 2014, 13:11:55 »
Advertisements
I have noticed this new experimental branch yesterday and have started playing with it. I have an a3400 that is equipped with a touch screen in addition to a full set of regular buttons. The port doesn't require CHDK soft buttons, but I thought it would be cool to use the touch screen for additional stuff.
I have added a hook to the touch task a while ago. I don't know how it behaves in the other ports, but in this one the CHDK hook function (chdk_process_touch) only gets called when the screen is being touched.

Current status is that the new touch UI sort of works. What 'sort of' in this case means: highlight follows the touched area, but I only get a new keypress event when I touch outside the menu area beforehand. I'm sure my current implementation is faulty (I have to manipulate states of existing physical buttons unlike in the other ports (N, Ixus310)). I'd like to ask for some advice.

I have also found something that may need some thoughts. The camera failed to start when I called gui_touch_process() from the keyboard task. Investigation showed that gui_touch_process() relies on the initialized state of the CHDK GUI, calling the function before gui_init() causes an exception. The keyboard task usually starts before SpyTask calls gui_init(). The diff contains a workaround.

I didn't intend to open this thread myself, but I had no better idea.

Re: CHDK touch-aware UI
« Reply #1 on: 16 / November / 2014, 13:43:36 »
FWIW,  I spent a lot of time on the touch task for the Powershot N trying to implement the same hook that philmoz used,  I think I went down at least three levels of calls (hundreds of patches) looking for the same functionality without success.  Took me a couple of weeks of evening and weekends.

Finally,  I settled on finding a spot were I could cause the Canon touch task not to set one particular bit if CHDK was in <ALT> mode. That was basically enough to make the Canon UI ignore touch inputs while that bit was masked.  Changing kbd.c to work with that was simple and after a little work on the look & feel of the touch buttons,  the rest of the port was pretty standard.

Don't know if that helps with your a3400 but I thought I'd share what worked for me.

« Last Edit: 16 / November / 2014, 13:55:17 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: CHDK touch-aware UI
« Reply #2 on: 16 / November / 2014, 13:54:53 »
I've updated the 'gui_touch_process' function to (hopefully) prevent the crash if it gets called before CHDK is completely initialised.

Not sure about the other behaviour - haven't had a chance to look at you a3400 code yet.

This branch was some ideas I was playing with that actually worked better than I expected. I was going to post some details once I had it more complete :)

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDK touch-aware UI
« Reply #3 on: 16 / November / 2014, 17:21:01 »
Thanks for the comments. Meanwhile it seems I'm progressing: I switched to using the "falling edge" of the touch, now the only(?) thing left is to prevent unintended keypresses (when entering a submenu or dismissing a dialog).
To my knowledge there are several models which have both a keyboard and a touchscreen - this development can be useful on them once implemented.
r3744 is working as intended and reversi is more fun now :)

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: CHDK touch-aware UI
« Reply #4 on: 16 / November / 2014, 17:34:43 »
Thanks for the comments. Meanwhile it seems I'm progressing: I switched to using the "falling edge" of the touch, now the only(?) thing left is to prevent unintended keypresses (when entering a submenu or dismissing a dialog).
To my knowledge there are several models which have both a keyboard and a touchscreen - this development can be useful on them once implemented.
r3744 is working as intended and reversi is more fun now :)

To stop multiple presses in the menus etc, I changed the Ixus 310 to process the touch-screen 'press' only after it was 'released' (user removes their finger). The Ixus 310 firmware has a variable that is set when the touch screen is active and cleared when it is not being touched.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal