mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
fix celsius symbol
This commit is contained in:
committed by
Ron Evans
parent
2034f92d11
commit
0519540d0c
+1
-1
@@ -57,7 +57,7 @@ func (dev *Device) Configure() (err error) {
|
||||
|
||||
}
|
||||
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (ºC/1000)
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (°C/1000)
|
||||
func (d *Device) ReadTemperature() (temperature int32, err error) {
|
||||
return (int32(d.readUint16(RegTempValueMSB)) * 1000) / 128, nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ func (d *Device) Reset() {
|
||||
d.bus.WriteRegister(uint8(d.Address), CMD_RESET, []byte{0xB6})
|
||||
}
|
||||
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (ºC/1000)
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (°C/1000)
|
||||
func (d *Device) ReadTemperature() (int32, error) {
|
||||
data, err := d.readData()
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ func (d *Device) Configure() {
|
||||
d.calibrationCoefficients.md = readInt(data[20], data[21])
|
||||
}
|
||||
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (ºC/1000).
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (°C/1000).
|
||||
func (d *Device) ReadTemperature() (temperature int32, err error) {
|
||||
rawTemp, err := d.rawTemp()
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
//
|
||||
// for {
|
||||
// temp, _ := sensor.ReadTemperature()
|
||||
// println("Temperature:", float32(temp)/1000, "ºC")
|
||||
// println("Temperature:", float32(temp)/1000, "°C")
|
||||
//
|
||||
// pressure, _ := sensor.ReadPressure()
|
||||
// println("Pressure", float32(pressure)/100000, "hPa")
|
||||
|
||||
@@ -22,7 +22,7 @@ func main() {
|
||||
|
||||
for {
|
||||
temp, _ := sensor.ReadTemperature()
|
||||
println("Temperature:", strconv.FormatFloat(float64(temp)/1000, 'f', 2, 64), "ºC")
|
||||
println("Temperature:", strconv.FormatFloat(float64(temp)/1000, 'f', 2, 64), "°C")
|
||||
press, _ := sensor.ReadPressure()
|
||||
println("Pressure:", strconv.FormatFloat(float64(press)/100000, 'f', 2, 64), "hPa")
|
||||
hum, _ := sensor.ReadHumidity()
|
||||
|
||||
@@ -22,7 +22,7 @@ func main() {
|
||||
|
||||
for {
|
||||
temp, _ := sensor.ReadTemperature()
|
||||
println("Temperature:", float32(temp)/1000, "ºC")
|
||||
println("Temperature:", float32(temp)/1000, "°C")
|
||||
|
||||
pressure, _ := sensor.ReadPressure()
|
||||
println("Pressure", float32(pressure)/100000, "hPa")
|
||||
|
||||
@@ -38,7 +38,7 @@ func main() {
|
||||
fmt.Printf("Date: %d/%s/%02d %02d:%02d:%02d \r\n", dt.Year(), dt.Month(), dt.Day(), dt.Hour(), dt.Minute(), dt.Second())
|
||||
}
|
||||
temp, _ := rtc.ReadTemperature()
|
||||
fmt.Printf("Temperature: %.2f ºC \r\n", float32(temp)/1000)
|
||||
fmt.Printf("Temperature: %.2f °C \r\n", float32(temp)/1000)
|
||||
|
||||
time.Sleep(time.Second * 1)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ func main() {
|
||||
println("Magnetic readings:", x, y, z)
|
||||
|
||||
c, _ := mag.ReadTemperature()
|
||||
println("Temperature:", float32(c)/1000, "ºC")
|
||||
println("Temperature:", float32(c)/1000, "°C")
|
||||
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ func main() {
|
||||
temp, humidity, _ := sensor.ReadTemperatureHumidity()
|
||||
t := fmt.Sprintf("%.2f", float32(temp)/1000)
|
||||
h := fmt.Sprintf("%.2f", float32(humidity)/100)
|
||||
println("Temperature:", t, "ºC")
|
||||
println("Temperature:", t, "°C")
|
||||
println("Humidity", h, "%")
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ func main() {
|
||||
|
||||
for {
|
||||
temp, _ := sensor.ReadTemperature()
|
||||
println("Temperature:", temp/1000, "ºC")
|
||||
println("Temperature:", temp/1000, "°C")
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ func (d *Device) ReadRotation() (x int32, y int32, z int32) {
|
||||
return
|
||||
}
|
||||
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (ºC/1000)
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (°C/1000)
|
||||
func (d *Device) ReadTemperature() (int32, error) {
|
||||
d.bus.ReadRegister(uint8(d.Address), OUT_TEMP_L, d.dataBufferTwo)
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ func (d Device) ReadMagnetic() (x int16, y int16, z int16) {
|
||||
}
|
||||
|
||||
// ReadTemperature reads and returns the current die temperature in
|
||||
// celsius milli degrees (ºC/1000).
|
||||
// celsius milli degrees (°C/1000).
|
||||
func (d Device) ReadTemperature() (int32, error) {
|
||||
data := make([]byte, 1)
|
||||
d.bus.ReadRegister(uint8(d.Address), DIE_TEMP, data)
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ func New(bus machine.I2C) Device {
|
||||
}
|
||||
}
|
||||
|
||||
// Read returns the temperature in celsius milli degrees (ºC/1000).
|
||||
// Read returns the temperature in celsius milli degrees (°C/1000).
|
||||
func (d *Device) ReadTemperature() (tempMilliCelsius int32, err error) {
|
||||
tempMilliCelsius, _, err = d.ReadTemperatureHumidity()
|
||||
return tempMilliCelsius, err
|
||||
|
||||
@@ -60,7 +60,7 @@ func (d *Device) Configure() {
|
||||
d.adc.Configure()
|
||||
}
|
||||
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (ºC/1000)
|
||||
// ReadTemperature returns the temperature in celsius milli degrees (°C/1000)
|
||||
func (d *Device) ReadTemperature() (temperature int32, err error) {
|
||||
var reading uint32
|
||||
if d.HighSide {
|
||||
|
||||
Reference in New Issue
Block a user