From b6e5f569f3d29dddc595c71bb00eba35983b0d03 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 11 Jun 2019 22:47:55 +0200 Subject: Home button for pan/tilt --- src/nanolight.c | 29 +++++++++++++++++++++++++++++ src/nanolight.h | 1 + 2 files changed, 30 insertions(+) diff --git a/src/nanolight.c b/src/nanolight.c index cffa48c..a9b3eab 100644 --- a/src/nanolight.c +++ b/src/nanolight.c @@ -344,6 +344,27 @@ static void update_mouse_orientation(struct nanolight *nl) } +static void home_value(struct nanolight *nl) +{ + int i; + for ( i=0; in_sel; i++ ) { + + struct fixture *fix = &nl->fixtures[nl->selection[i]]; + int n; + + if ( nl->mouse_orientation ) { + if ( find_attribute(fix, ATT_PAN, &n) ) { + fix->attr_vals[n] = fix->cls->attrs[n].home; + } + if ( find_attribute(fix, ATT_TILT, &n) ) { + fix->attr_vals[n] = fix->cls->attrs[n].home; + } + } + + } +} + + static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct nanolight *nl) { gboolean r; @@ -389,6 +410,11 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct nanoligh claim = 1; break; + case GDK_KEY_Home : + home_value(nl); + claim = 1; + break; + case GDK_KEY_F1 : update_mouse_orientation(nl); claim = 1; @@ -485,14 +511,17 @@ int main(int argc, char *argv[]) cls.attrs[0].cls = ATT_INTENSITY; cls.attrs[0].props = 0; cls.attrs[0].addr_offset = 50; + cls.attrs[0].home = 0; cls.attrs[1].cls = ATT_PAN; cls.attrs[1].props = ATTR_16BIT; cls.attrs[1].addr_offset = 0; + cls.attrs[1].home = 32768; cls.attrs[2].cls = ATT_TILT; cls.attrs[2].props = ATTR_16BIT; cls.attrs[2].addr_offset = 2; + cls.attrs[2].home = 32768; nl.fixture_width = 80.0; nl.fixtures = NULL; diff --git a/src/nanolight.h b/src/nanolight.h index a7f7136..67db396 100644 --- a/src/nanolight.h +++ b/src/nanolight.h @@ -42,6 +42,7 @@ struct attribute enum attr_class cls; int props; int addr_offset; + int home; }; -- cgit v1.2.3