Compare commits
No commits in common. "main" and "v1.0.1" have entirely different histories.
2 changed files with 2 additions and 1 deletions
3
main.go
3
main.go
|
@ -15,6 +15,7 @@ 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() {
|
||||||
|
@ -51,7 +52,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
raw := binary.LittleEndian.Uint16(buf[4:6])
|
raw := binary.LittleEndian.Uint16(buf[4:6])
|
||||||
oz := float64(raw) / 10.0
|
oz := float64(raw) / 10.0 * calibration
|
||||||
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