busylight icon indicating copy to clipboard operation
busylight copied to clipboard

[NEW LIGHT] fit-statUSB

Open mchaker opened this issue 1 year ago • 8 comments

If you would like BusyLight to support a new device, please provide as much of the following as possible.

  • Product Name: fit-statUSB
  • Vendor URL: https://fit-iot.com/web/product/fit-statusb/
  • Purchase URL: https://www.amazon.com/gp/product/B07CKFLQ5V
  • Public documentation URLs: http://www.fit-pc.com/wiki/index.php/Fit-statUSB

mchaker avatar Aug 06 '22 22:08 mchaker

Cool! A new light and thank you for all the useful links. I've ordered an example and should have it shortly. Reviewing the docs, it appears to be a serial device rather than a HID device. I've been working on a re-write to incorporate serial devices side by side with HID lights, but it's still a work in progress with no real ETA. I'm having to re-write the class hierarchy AND learn how serial devices work with Python.

JnyJny avatar Aug 07 '22 15:08 JnyJny

Thanks for responding so quickly! If there's any way I can help with the serial device support or testing, let me know. :)

mchaker avatar Aug 07 '22 17:08 mchaker

The serial communication part is pretty straight forward, it takes me back to the bad old day of talking to devices on parallel and non-USB serial ports. The light hierarchy is changing from

USBLight -> vendor_specific_light

to

         +--> HIDLight -> vendor_specific_lights
Light ---+
         +--> SerialLight -> vendor_specific_lights

So I'm having to find the common ground between HID and serial and move that into Light and then implement the protocol specific stuff. My goal is to have a similar interface that USBLight provides so that users don't have to know the implementation specific details of the light they just plugged in:

from busylight.lights import Light

light = Light.first_light()

light.on((255,0,0))

JnyJny avatar Aug 07 '22 18:08 JnyJny

I'm working in branch feature/Light if you want to follow along, haven't committed anything yet but should have some basic stuff committed in the next 12 hours.

JnyJny avatar Aug 07 '22 18:08 JnyJny

I like your approach! I'll follow that branch.

mchaker avatar Aug 07 '22 18:08 mchaker

I have a fit-statUSB light (and a MuteSync light/button which is also a serial device) and figured out how to drive it using the PySerial package. I'm replacing busylight.lights.USBLight and it's hierarchy with busylight.lights.Light which has subclasses HIDLight and SerialLight.

JnyJny avatar Aug 13 '22 20:08 JnyJny

Awesome! Thank you so much.

mchaker avatar Aug 13 '22 20:08 mchaker

The fit-statUSB is working with the latest commit to the feature/Light branch. It's kind of a limited; it performs fade ins and fade outs for color transitions that are "builtin" and uncommanded. This isn't a big deal for turning the light on and off, but changing between colors quickly looks a little weird. ¯\_(ツ)_/¯ But it's working :) Same goes for the MuteSync serial device.

I'm going to get tests working again before merging this branch into the master branch.

JnyJny avatar Aug 26 '22 02:08 JnyJny

Check this out for inspiration: https://pypi.org/project/pystatusb

henryruhs avatar Sep 08 '22 09:09 henryruhs

I wasn't aware I needed inspiration, thanks Henry.

JnyJny avatar Sep 08 '22 15:09 JnyJny

Commit 44053a846a62f0cfff9ee384c7319cedcb58dfb7 adds support for the fit-statUSB and two other lights in addition to a complete restructuring of the Light subclass hierarchy.

JnyJny avatar Sep 12 '22 03:09 JnyJny

Excellent!! I'll give it a try this week(end?)

Thank you so much

mchaker avatar Sep 12 '22 12:09 mchaker

I ordered my version of this device aswell and will give feedback once it arrived. Thanks Erik

henryruhs avatar Sep 12 '22 12:09 henryruhs