summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-06-30 18:40:21 +0200
committerThomas White <taw@physics.org>2019-06-30 18:40:21 +0200
commitf80065c24765ee1fcfc075c77f7ea55984a1d715 (patch)
treee5b98a039b38f94761cc1513ebe28639c7610256
parent8116354c05b0219e487ed70df45ca6bf917730aa (diff)
Add pan/tilt reverse
-rw-r--r--src/nanolight.c12
-rw-r--r--src/nanolight.h8
-rw-r--r--src/scanout.c2
3 files changed, 16 insertions, 6 deletions
diff --git a/src/nanolight.c b/src/nanolight.c
index 16e3ac3..42bd068 100644
--- a/src/nanolight.c
+++ b/src/nanolight.c
@@ -45,7 +45,8 @@ static void show_help(const char *s)
static struct fixture *create_fixture(struct nanolight *nl, struct fixture_class *cls,
- const char *label, int universe, int base_addr)
+ const char *label, int universe, int base_addr,
+ int flags)
{
struct fixture *fix;
@@ -62,6 +63,7 @@ static struct fixture *create_fixture(struct nanolight *nl, struct fixture_class
fix->universe = universe;
fix->base_addr = base_addr;
fix->cls = cls;
+ fix->flags = flags;
fix->intensity = 0.0;
fix->cyan = 0.0;
@@ -322,10 +324,10 @@ int main(int argc, char *argv[])
nl.go_lock = 0;
nl.sb_lock = 0;
- create_fixture(&nl, &cls, "mh1", 0, 1);
- create_fixture(&nl, &cls, "mh2", 0, 52);
- create_fixture(&nl, &cls, "mh3", 0, 103);
- create_fixture(&nl, &cls, "mh4", 0, 154);
+ create_fixture(&nl, &cls, "mh1", 0, 1, REVERSE_PAN);
+ create_fixture(&nl, &cls, "mh2", 0, 52, REVERSE_PAN);
+ create_fixture(&nl, &cls, "mh3", 0, 103, REVERSE_PAN);
+ create_fixture(&nl, &cls, "mh4", 0, 154, REVERSE_PAN);
/* Set up output */
g_timeout_add(100, scanout_cb, &nl);
diff --git a/src/nanolight.h b/src/nanolight.h
index 648e291..66bde5a 100644
--- a/src/nanolight.h
+++ b/src/nanolight.h
@@ -41,10 +41,14 @@
#define PRISM_ROTATE (1<<12)
#define PRISM_SPIN (1<<13)
-/* Fixture properties */
+/* Fixture class properties */
#define COL_RGB (1<<0)
#define COL_CMY (1<<1)
+/* Fixture properties */
+#define REVERSE_PAN (1<<0)
+#define REVERSE_TILT (1<<1)
+
struct fixture_class
{
char *name;
@@ -100,6 +104,8 @@ struct fixture
int base_addr;
struct fixture_class *cls;
+ int flags;
+
float intensity; /* 0 (off) to 1 (full) */
float cyan; /* 0 (no filter) to 1 (full colour) */
float magenta; /* 0 (no filter) to 1 (full colour) */
diff --git a/src/scanout.c b/src/scanout.c
index 1b0229c..8a8b2d0 100644
--- a/src/scanout.c
+++ b/src/scanout.c
@@ -133,6 +133,8 @@ int scanout_all(struct nanolight *nl)
float pan_val, tilt_val;
pan_val = (fix->pan + 1.0)/2.0;
tilt_val = (fix->tilt + 1.0)/2.0;
+ if ( fix->flags & REVERSE_PAN ) pan_val = 1.0 - pan_val;
+ if ( fix->flags & REVERSE_TILT ) tilt_val = 1.0 - tilt_val;
set_val(dmx, fix->base_addr, cls->pan_offset, pan_val,
cls->attributes16 & PANTILT);
set_val(dmx, fix->base_addr, cls->tilt_offset, tilt_val,