Skywriter Sensitivity

Hi Buccaneers,

I am touching my Skywriter but it registers about 3 or sometimes 4 touches in one touch, very sensitive or I have pudding fingers!

Is there a way to delay the recognition of the next touch?

This is what I have so far

Many thanks

import skywriter
import signal
import time

global lasttouch
lasttouch = 0

if int(round(time.time()*1000))-lasttouch>100:
global lasttouch

 @skywriter.touch() 
 def touch(position1):
 #time.sleep(1)
      print('Touch!', position1)
      if position1 == 'west':
           print "WESTSIDE"
      elif position1 == 'east':
           print "EASTSIDE"
 lasttouch = int(round(time.time()*1000))  

signal.pause()

@gadgetoid any ideas?

This is something I need to update the library with- it’s effectively a debounce that’s required. Perhaps catch the first touch and ignore any subsequent ones for a certain period of time.

I’ve added a new “repeat_rate” parameter to Skywriter’s “touch” decorator. Also for tap/doubletap although it has less utility there.

Example usage:

@skywriter.touch(repeat_rate=2) # Max 2 touches per second
def handle_touch(location)
    print(location)

I find a repeat_rate of about 3 to 4 is comfortable.

Thank you for this, it works really well.
However, now the Skywriter registers a ‘double tap’ as a ‘double tap’ and a ‘tap’ and a ‘touch’. When I use ‘tap’ it registers a ‘tap’ and a ‘touch’.
So for example if I double tap ‘north’ it prints, 'double_tap north, tap north and touch north’
Any ideas?
Thanks again
Dan

I might have to look over the code for this- I’ve gone and confused myself!

In theory, @skywriter.tap() should only catch tap events and not touches or double-taps.

The trouble is that an event can be a touch before it becomes a tap. Now it’s possible to wait and see if a tap comes in and ignore the touch, but that might make touches really unresponsive, so I didn’t initially do it in the library.

The same applies for a double tap, it’s detected as a touch, then a tap then finally confirmed as a double-tap, all three events come form the Skywriter and hanging around waiting for a double-tap before firing a tap event might slow taps down.

There must be a sensible solution, I’ll have to tinker!

Hi there,
Any luck with the tweeks?
Thanks
Dan

Honestly, I haven’t had time to even look at it! Prod me next week ;)

Hi, hope you are well, can I give you a prod about the Skywriter?

:-) Many thanks

Haven’t forgotten about you ;) Will have to put it off until all the Pi 2 chaos is dealt with, though… the world of software has been just a little bit hectic lately!