revised calibration
This commit is contained in:
parent
d9c7305cf8
commit
e2c27cab13
2 changed files with 1 additions and 2 deletions
3
main.go
3
main.go
|
@ -15,7 +15,6 @@ const (
|
||||||
vendorID = 0x1446
|
vendorID = 0x1446
|
||||||
productID = 0x6A73
|
productID = 0x6A73
|
||||||
refreshRate = 500 * time.Millisecond
|
refreshRate = 500 * time.Millisecond
|
||||||
calibration = 0.952 // scale correction factor: 2.1 reported = 2.0 actual
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -52,7 +51,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
raw := binary.LittleEndian.Uint16(buf[4:6])
|
raw := binary.LittleEndian.Uint16(buf[4:6])
|
||||||
oz := float64(raw) / 10.0 * calibration
|
oz := float64(raw) / 10.0
|
||||||
rounded := math.Round(oz*10) / 10
|
rounded := math.Round(oz*10) / 10
|
||||||
|
|
||||||
fmt.Printf("\r📦 Weight: %.1f oz ", rounded)
|
fmt.Printf("\r📦 Weight: %.1f oz ", rounded)
|
||||||
|
|
BIN
scale-code
BIN
scale-code
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue