summaryrefslogtreecommitdiff
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/src/command.c b/src/command.c
index 53d9d9c..e60a75a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -45,7 +45,7 @@ struct token
{
enum token_type type;
int fixture_index;
- enum attr_class attribute;
+ int attribute;
int val;
};
@@ -54,17 +54,13 @@ struct token
const char *attr_class_names[] = {
"int",
- "pan",
- "tilt"
};
-enum attr_class attr_classes[] = {
- ATT_INTENSITY,
- ATT_PAN,
- ATT_TILT
+int attr_classes[] = {
+ INTENSITY,
};
-int n_attr_classes = 3;
+int n_attr_classes = 1;
/* (end of attribute tables) */
@@ -156,21 +152,10 @@ static int find_tokens(const char *cmd, struct token *tokens, struct nanolight *
}
-static const char *str_attr(enum attr_class att)
+static const char *str_attr(int att)
{
switch ( att ) {
- case ATT_INTENSITY : return "intensity";
- case ATT_PAN : return "pan";
- case ATT_TILT : return "tilt";
- case ATT_STROBE : return "strobe";
- case ATT_CYAN : return "cyan";
- case ATT_MAGENTA : return "magenta";
- case ATT_YELLOW : return "yellow";
- case ATT_RGOBO : return "rgobo";
- case ATT_GOBO : return "gobo";
- case ATT_PRISM : return "prism";
- case ATT_FOCUS : return "focus";
- case ATT_ZOOM : return "zoom";
+ case INTENSITY : return "intensity";
}
return "???";
}
@@ -214,24 +199,13 @@ static void show_tokens(struct token *tokens, int n, struct nanolight *nl)
}
-static void set_level(struct nanolight *nl, int val, enum attr_class cls)
+static void set_level(struct nanolight *nl, int val)
{
int i;
- if ( cls == ATT_INTENSITY ) {
- val *= 255;
- val /= 100;
- }
-
for ( i=0; i<nl->n_sel; i++ ) {
- int j;
struct fixture *fix = &nl->fixtures[nl->selection[i]];
- for ( j=0; j<fix->cls->n_attrs; j++ ) {
- if ( fix->cls->attrs[j].cls == cls ) {
- fix->attr_vals[j] = val;
- break;
- }
- }
+ fix->intensity = (float)val/100.0;
}
}
@@ -260,7 +234,7 @@ int command_run(const char *cmd, struct nanolight *nl)
if ( tokens[i].type == TK_AT ) {
if ( tokens[i+1].type == TK_LEVEL ) {
- set_level(nl, tokens[i+1].val, ATT_INTENSITY);
+ set_level(nl, tokens[i+1].val);
}
}