@tehn just to follow on that
re: multiple responses to query, this is indeed stated clearly enough, i had just forgotten (sorry!):
0x00 system / query response
bytes: 3
structure: [0x00, a, b]
a = section (grids, encs)
1-15 (0 is system)
b = number (how many connected)
0-255
description: response to request for component availability. multiple responses will be sent, one for each section. for example, if two grids are connected and 8 encoders, the response would be [0,1,2] [0,2,8]
OSC: /sys/query a b
where a is a text translation, b is number available. a = [null, "led-grid", "key-grid", "digital-out", etc]
(“multiple responses will be sent”)
so - again the libavr32 code is rather messy. it is making several undocumented assumptions:
- any FTDI device is a monome grid or arc
- any
mext device is going to respond to query with two packets describing keys+leds, or ringts+leds. (though mext protocol is designed to be extensible to more arbitrary controller layouts
what is less clear from that document is the expectation that LED state should packed as nybbles in payload to 0x1a command. it really looks like it expects 64 bytes and i can’t find anything about nybbles for grids.
whereas of course it is 64 bytes only on the OSC side. (but the document is not called osc.txt
)
pattern: /prefix/led/level/map x y d[64]
desc: set 8x8 block of leds levels, with offset
args: x = x offset, will be floored to multiple of 8 by firmware
y = y offset, will be floored to multiple of 8 by firmware
d[64] = intensities
serial: [0x1A, x, y, d[64]]
incidentally, the listing for the arc equivalent is (what i would call) correct:
pattern: /prefix/ring/map n d[32]
desc: set leds of ring n to array d
args: n = ring number
d[32] = 64 states, 4 bit values, in 32 consecutive bytes
d[0] (0:3) value 0
d[0] (4:7) value 1
d[1] (0:3) value 2
....
d[31] (0:3) value 62
d[31] (4:7) value 63
serial: [0x92, n d[32]]
there is also some general semantic confusion between the “old” (pre-varibright, 1 bit per led) led_map and the “new” (since 2006 or something! 4b per led) led_level_map, which is sometimes just called LED_MAP or grid_led_map or whatever in code. (apparently this even confused me when i was working on aleph!)
it would be cool to at least prune dead code and fix comments in libavr32 sources.