Draft: captouch driver: proper data log & petal mode config
data log: users can opt-in to get the actual captouch driver backend frames that have occured since the last think(). this means no skipped/duplicate data points and full flexibility in filtering. in essence, you can now do this:
petal mode: a petal can merge multiple pads into a single data acquisition step, or can be deactivated entirely. this means the captouch driver spins faster, allowing for higher resolution data for the petals that you want to run more complex processing on.
also the .position
attribute has been replaced by .pos
and normalized to [-1..1]. it's a bad name, but we can't think of anything better. pressure has been renamed to coverage and is equally normalized so that 1 represents the upper pressed
hysteresis threshold.
in practice:
class App(st3m.application.Application):
def __init__(self, app_ctx):
# create an empty configuration, i.e. all petals are turned off
self.captouch_config = captouch.Config.empty()
# activate only petal 0 in 3-channel (2d position) mode, enable logging
self.captouch_config.petals[0].mode = 3
self.captouch_config.petals[0].logging = True
def on_enter(self, vm):
self.captouch_config.apply()
self.petal_0_log = []
def think(self, ins, delta_ms):
# this log is the last 100 raw data frames at a time resolution of ~2.3ms
self.petal_0_log += ins.captouch.petals[0].log
self.petal_0_log = self.petal_0_log[:-100]
it's not fully integrated in the OS yet, calibration is duct tape, will fix both before merge, but it's ready for API review.
docs are distributed over python_payload/mypystubs/captouch.pyi
and docs/api/captouch.rst
, sorry about that, ideally make html
them in the docs
directory for convenient reading.
there's also a higher level captouch.widgets
module in here for now, but we think we're gonna move that to a second PR as it will need more polishing time.