Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping v1 #87

Open
wants to merge 125 commits into
base: master
from
Open

Mapping v1 #87

wants to merge 125 commits into from

Conversation

@harryhaaren
Copy link
Member

@harryhaaren harryhaaren commented Jun 17, 2018

A staging PR, to discuss the mapping strategy between Ctlra and any host. The "mappa" infrastructure is used to provide complex multi-layered mappings between the generic Ctlra events and the software-application.

A "target" is a value in the application that can be updated/changed by Ctlra.
A "source" is a value in the application that can be read by Ctlra for feedback to hardware devices.

The APIs are currently prototype and POC only, these will change, please don't expect API stability at this point.

harryhaaren added 30 commits Jun 11, 2018
This commit adds a sample application that implements an
initial draft of the mappa API. In particular the abstraction
between the application and the mappa software is being kept
as simple as possible - even still it will probably change
a few times - so do not start using this API just yet!

This commit closes #80 initial mapping design.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Testing with valgrind to fix leaks + access issues, #81

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
See details in #81

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This enables the app to add and remove multiple targets.
Internally they're stored for book-keeping, but not
event-lookup is implemented yet. See #81

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit is a significant step towards POC of using Ctlra
look-up-table for event mapping. The software target events
are stored in a linear array sorted by type, so the lookup of
the target is just an array access. The function pointer is
called if one is set.

This almost completes #81.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Error check to avoid segfault on NULL m or lut,
refactor to make it easier to store a list of lut's

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
this allows multiple lut layers to be present in a single
device. It also gives a good abstraction for using the
userdata pointer for the ctlra dev callbacks, and a place
to store state like current-layer for a device.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Segfaulting due to incorrect linked-lists / target setup

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Enable other types of ctlra inputs than slider, exposing it to
the external API. Need to think about if this is the right solution
to the interface for mapping

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This allows the lut switch to target a specific
integer lut for each device.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit enables layer switching by using an internal
mappa callback function that takes a dev_t *. This allows
the mappa instance to changes its active_lut, which causes
different actions to be triggered by each input event.

This closes #81.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This tests the cross-fader being bound to something else
on layer 2 - to ensure that the functionality gets transposed
correctly.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit checks the ids of controls being bound,
failing with -EINVAL if the target is out of bounds
for the hardware device being mapped.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit strenghtens the error checking on events as compared
to the events that are advertised by the device's metadata. If
the event id is beyond the advertised range, it is ignored and
a print issued to notify - this is due to invalid event/metadata
pairing in the device code.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit is the first version of the feedback prototype.
It uses the token concept, along with a unique name per source
of feedback.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Mostly working - need to dig into last few pointer issues

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit fixes the array issues mentioned in the previous
commit, and adds a new source callback function in the app.
The value returned by the two functions is now different, and
a simple "musher" allows mapping a float value to 0-6 lights.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
General cleanup of prints and noisy code, added error check
for dev if there's no device available.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit refactors main to have a seperate function for
binding - this needs to be abstracted out of the app and into
the mappa library at some point.

Some valgrind mem leaks on close fixed by cleaning up sources.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds the tailq infrastructure to support multiple
devices. This allows more than one ctlra instance to be mapped.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
The missing return was causing invalid reads in valgrind.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds a bunch of destroy() functions, which
free the linked-lists of targets, lut, devices etc.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This approach uses a "token" that the application can
give to each callback - think function parameters. This
is in addition to the function pointer itself.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This enables the token style variable size method.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
harryhaaren added 29 commits Jul 19, 2018
This commit notifies users who *are* using the serial
option for thier scripts that the script applies only
to a specific device. Previously all users were notified
if thier script did not contain a serial code.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
If a layer *says* it has a 0 mapping_count, don't print an
error if it also doesn't have any mappings.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit removes the add_config_file API, as the
software should not directly control the location of
mappa files - they should be centralized so it is easy
to find and copy-paste bits from others.

Might re-add this in future to allow applications to
add thier own specific directory - but for now it doesn't
seem smart to *require* that apps use this.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Print it out for now. leading towards mappa_create() API
refactor to demand each app registers with a prefix.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit requires applications to register a name,
and to provide a "unique" string handle which can be used
to identify different instances of the same application.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds a check for the [software]name tag
against the mappa_create() provided application name.
This allows scripts to be identified that are valid for
the hardware / software combination, and ignore scripts
that are not valid.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit fixes 3 mem leaks that could occur, failure
to release resources when returning early from a file-not-match
vs controller, freeing the name of the app, and not duplicating
the string for conf_file_path multiple times.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This should enable hotplug of devices at runtime, transparently
to any application.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
The mappings now work as the device itself is found.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit enables scripts to use a button to reload the
script itself. This vastly improves iteration time to testing
changes, and abstracts the reloading process away from the
application.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This paves the way to build AVTKA based UIs in future, and
have the mappa library draw them.
Increase the waiting time, and timeout iterations before
giving up on closing the device. This reduces the issues
of screen artifacts remaining when software disconnects.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Needs some overhaul to make it a single linear space, and
not per-event-type?

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This approach requires a "sources" array for each LUT/device
to contain the maximum size for any light_id of the device.
A source_t represents the source of that particular value to
display, and callbacks are triggered when we need to update.

This approach requires that Ctlra drivers expose the max
number of endpoints that can be valid-ly called on the device.
Aka, a device with 1000 leds will return 1000. This info is
not yet available in Ctlra for each device, but will be required
to properly support this feature.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This adds 64 targets and 64 sources, and a more complex
but messy testing method. Cleanup of this example app
is needed.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit switches off lights if no source is mapped.
Although this makes layer "switch" etc easier, and reduces
the chance of "stale" lights remaining on the device as
the source has been unmapped.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds AVTKA functionality to the existing Mappa
screen callbacks, allowing a UI to be easily built-up from
individual UI components. The particular components can then
be mapped to mappa_source_t instances, providing the required
mapping of values->screens, without any programming.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit implements the very crude basics of mapping from
application source_t to an AVTKA provided UI. The names are
hard-coded, and the LUTs are not in use to remap based on
multiplexed settings, however the dev has a source_t * that
it can retrieve a value from directly - POC working.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This change allows the screen UIs to be set by each LUT,
giving the user the flexibility to have a button activate
a layer, and hence also change the display.

The combination of one LUT having the input/lights/screen
is a good one, to allow easier UX of developing/testing mappings.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
@harryhaaren harryhaaren force-pushed the mapping_v1 branch from 444d5a0 to e2ab18e Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants