mirror of
https://github.com/erjiang/usbscale.git
synced 2025-06-28 00:50:59 -06:00
ADD: lbs/oz, grams
This commit is contained in:
parent
21081b7ee8
commit
40d71e81e7
11
usbscale.c
11
usbscale.c
@ -77,6 +77,9 @@ static int print_scale_data(unsigned char*);
|
|||||||
//
|
//
|
||||||
uint8_t get_first_endpoint_address(libusb_device* dev);
|
uint8_t get_first_endpoint_address(libusb_device* dev);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// **UNITS** is an array of all the unit abbreviations as set forth by *HID
|
// **UNITS** is an array of all the unit abbreviations as set forth by *HID
|
||||||
// Point of Sale Usage Tables*, version 1.02, by the USB Implementers' Forum.
|
// Point of Sale Usage Tables*, version 1.02, by the USB Implementers' Forum.
|
||||||
@ -350,7 +353,13 @@ static int print_scale_data(unsigned char* dat) {
|
|||||||
// the `UNITS` lookup table for unit names.
|
// the `UNITS` lookup table for unit names.
|
||||||
//
|
//
|
||||||
case 0x04:
|
case 0x04:
|
||||||
printf("%g %s\n", weight, UNITS[unit]);
|
if(unit == 11) {
|
||||||
|
// stamps.com scale, defult "oz" unit
|
||||||
|
int lbs = weight / 16;
|
||||||
|
double remain = weight - lbs * 16;
|
||||||
|
printf("%g oz (%d lbs %g oz), %g grams\n", weight, lbs, remain, weight * 28.3495);
|
||||||
|
} else
|
||||||
|
printf("%g %s\n", weight, UNITS[unit]);
|
||||||
return 0;
|
return 0;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
if(status != lastStatus)
|
if(status != lastStatus)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user