diff options
author | Thomas White <taw@physics.org> | 2023-04-01 23:16:17 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-04-01 23:16:17 +0200 |
commit | cf8b7c80693b94516ef8ab01321f5e791ef47223 (patch) | |
tree | f4c787d1349398fb464a6fd2b7a27630290db7b7 /src/starlet-fixture-display.c | |
parent | 69337c0e3eed3cb1f93ff18d07058ef82a5bd159 (diff) |
Fixture display: Retrieve combined state only once
Note that this use of state-find doesn't look up the home value if
there's no value in the combined state. We assume that no intensity
means zero intensity, i.e. that the home value for intensity is always
zero.
Diffstat (limited to 'src/starlet-fixture-display.c')
-rw-r--r-- | src/starlet-fixture-display.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/starlet-fixture-display.c b/src/starlet-fixture-display.c index 5775741..5ff3356 100644 --- a/src/starlet-fixture-display.c +++ b/src/starlet-fixture-display.c @@ -340,13 +340,14 @@ static void request_intensities(struct fixture_display *fixd) { int i; + repl_send(fixd->repl, "(define all-vals (current-value-state))\n"); for ( i=0; i<fixd->n_fixtures; i++ ) { char tmp[256]; snprintf(tmp, 256, "(list" " 'fixture-parameters" " (list \"%s\" " - " (current-value %s intensity) " - " (let ((col (current-value %s colour)))" + " (state-find %s intensity all-vals) " + " (let ((col (state-find %s colour all-vals)))" " (if (colour? col)" " (colour-as-rgb col)" " #f))))", @@ -585,7 +586,12 @@ static void handle_fixture_parameters(struct fixture_display *fixd, SCM list) fix = find_fixture(fixd, fixture_name); if ( fix != NULL ) { - fix->intensity = scm_to_double(scm_list_ref(list, scm_from_int(1))); + SCM i = scm_list_ref(list, scm_from_int(1)); + if ( symbol_eq(i, "no-value") ) { + fix->intensity = 0.0; + } else { + fix->intensity = scm_to_double(i); + } read_rgb(fix->rgb, scm_list_ref(list, scm_from_int(2))); } else { fprintf(stderr, "Unrecognised fixture '%s' (parameters)\n", |