erjiang / usbscale

Reads weight data from USB scales.
GNU General Public License v3.0
90 stars 22 forks source link

Support multiple scales at the same time? #24

Closed TheWaterbug closed 1 year ago

TheWaterbug commented 2 years ago

I have an application that would benefit from being able to read two scales at approximately the same time. Presently usbscale scans the usb and takes a reading from the first supported device. If there are multiple supported devices on the bus, the 2nd (or nth) supported device will never be read.

Putting a 2nd scale on a 2nd Raspberry Pi is an ugly solution, so it would be great if usbscale could be augmented to return either:

  1. Results from all detected/supported scales, line by line, or
  2. The result from the nth supported scale, if n is passed in as an argument

I'm not a programmer, but I can assist by purchasing a scale for someone!

erjiang commented 1 year ago

For anyone interested, there is an experimental branch multi-scale that tries to read from every scale found, not just the first scale.

erjiang commented 1 year ago

Basic support for multiple scales has been added in f8918c7 using a new "--index" argument. To get the result from the 2nd scale, you can use:

$ usbscale --index 2

(Indices start from 1!)

Thanks to the user who provided additional scales for me to test with!