From 0c25e20721f123f1a7196e7d658b81359962cafd Mon Sep 17 00:00:00 2001 From: Adam Bright Date: Mon, 26 Sep 2016 05:31:51 +0000 Subject: [PATCH] better negative rounding --- sensor/mcp9808/mcp9808.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sensor/mcp9808/mcp9808.go b/sensor/mcp9808/mcp9808.go index 53b68a2..35dd149 100644 --- a/sensor/mcp9808/mcp9808.go +++ b/sensor/mcp9808/mcp9808.go @@ -322,11 +322,7 @@ func convertWordToTempC(temp uint16) float64 { } func (d *MCP9808) setTemp(reg byte, newTemp float64) error { - rounder := 2.0 - if newTemp < 0 { - rounder = 0.0 - } - return d.Bus.WriteWordToReg(address, reg, uint16(newTemp*16+rounder)&0x1ffc) + return d.Bus.WriteWordToReg(address, reg, uint16(newTemp*16+2)&0x1ffc) } // AmbientTemp reads the current sensor value along with the flags denoting what boundaries the