diff options
author | Thomas White <taw@physics.org> | 2022-11-12 11:13:53 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2022-11-12 11:37:03 +0100 |
commit | 5a02170f9e1952cd335b6b097e8ce33de7bb35b1 (patch) | |
tree | ca21feda4181e444e10e11ce863cc017c69461e7 /docs/new-fixture.rst | |
parent | f99311300912814ccaf4fdd6b3c753d1206e024c (diff) |
Introduce new type for attribute names
There's a serious problem with the design so far, where symbols are used
for attribute names (intensity, strobe, colour etc), and also for
attribute values (on, off, random etc). There's no way for 'at' to
tell the difference between the two. For example, this form is
ambiguous: (at myfixture 'strobe 'on)
This commit introduces a new class, <starlet-attribute>, to replace the
use of symbols here. The attributes are enumerated in (starlet attributes),
and new ones can be added later. The attribute objects remember their
'canonical' names, to allow states to be printed.
Apart from solving the ambiguity problem, this has two further
advantages. First, attribute names no longer need to be quoted
everywhere. Second, multiple names can be used to refer to the same
attribute. For example: (define color colour).
Diffstat (limited to 'docs/new-fixture.rst')
-rw-r--r-- | docs/new-fixture.rst | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/docs/new-fixture.rst b/docs/new-fixture.rst index 408f2ab..7a5b999 100644 --- a/docs/new-fixture.rst +++ b/docs/new-fixture.rst @@ -16,14 +16,14 @@ for example ``<robe-dl7s-mode3>`` for a Robe DL7S profile in mode 3. Each attribute follows one of the following forms:: - (attr-continuous 'intensity '(0 100) 0) - (attr-colour 'colour white) - (attr-list 'prism '(#f 3 5) #f) + (attr-continuous intensity '(0 100) 0) + (attr-colour colour white) + (attr-list prism '(#f 3 5) #f) -In all cases, you need to provide a symbol for the name of the attribute. -Using the standard names (below) where possible will make things work more -smoothly. The last argument in each ``attr-`` form is always the default -value for the attribute. +In all cases, you need to provide the name of the attribute. The available +attribute names are enumerated in module (starlet attributes) - please add new +names if you need, but use the available names if possible. The last argument +in each ``attr-`` form is always the default value for the attribute. For ``attr-continuous``, you need to give the range of possible values. For ``attr-list``, you need to give a list of the possible discrete values. For @@ -32,7 +32,7 @@ For ``attr-continuous``, you need to give the range of possible values. For The list of attributes is followed by the `scanout code`. This code will be called to convert the attribute values into DMX values. -Retrieve the current values with calls of the form ``(get-attr 'intensity)``, +Retrieve the current values with calls of the form ``(get-attr intensity)``, and set DMX values using ``(set-chan8 nn val)``, where ``val`` is the DMX value (0 to 255) and ``nn`` is the channel number. The channel numbers are indexed from 1, i.e. ``(set-chan8 1 255)`` will set the fixture's base DMX address to @@ -81,20 +81,6 @@ as a 1:1 translation from the attributes to DMX channels. Even the cheap 5-channel LED cold/warm fixture in the example below includes some maths. -Standard attribute names -======================== - -* ``intensity`` The overall light intensity, in percent of the maximum value. -* ``pan`` in degrees, zero being straight forwards. -* ``tilt`` in degrees, zero being straight downwards. -* ``colour`` (note UK spelling). The colour of the light. -* ``prism`` -* ``gobo`` -* ``strobe`` boolean for strobe on/off. -* ``strobe-frequency`` in Hz -* ``colour-temperature`` (note UK spelling) - - Worked example ============== |