todbot / blink1

Official software for blink(1) USB RGB LED by ThingM
https://blink1.thingm.com/
Other
958 stars 237 forks source link

confusing ledn definition for read current color cmd #676

Open Pro2Factory opened 1 year ago

Pro2Factory commented 1 year ago

In the HID doc (https://github.com/todbot/blink1/blob/4df2d06215b5c1c9221f3cfd91ef8e550a681e7f/docs/blink1-hid-commands.md?plain=1#L148C1-L161C48):

### Read current color - `format:  {0x01, 'r', 0,0,0,       0,0, n }` 

return values:

    hid_send_buf[0] = 0x01 (report_id)
    hid_send_buf[1] = 'r'
    hid_send_buf[2] = leds[ledn].r;
    hid_send_buf[3] = leds[ledn].g;
    hid_send_buf[4] = leds[ledn].b;
    hid_send_buf[5] = 0;
    hid_send_buf[6] = 0;
    hid_send_buf[7] = ledn;

where ledn is 0 (one led) or 1 (the other led).

But testing with mk2 via cli tool (https://github.com/todbot/blink1-tool), the definition is different:

1) Set color

blink1-tool --rgb="FF0000" --led 1 -m 0
blink1-tool --rgb="00FF00" --led 2 -m 0

2) Get color with ledn:

blink1-tool --rgbread -l 0
blink1-tool --rgbread -l 1
blink1-tool --rgbread -l 2

here's the Result:

reading led 0 rgb: 0xff,0x00,0x00
reading led 1 rgb: 0xff,0x00,0x00
reading led 2 rgb: 0x00,0xff,0x00

thus --- in the result, led0 and led1 is the same, and led 2 is the other, which is different from the hid doc saying.