Skip to content
Snippets Groups Projects
Commit cb6a4150 authored by Kevin Lyda's avatar Kevin Lyda :speech_balloon:
Browse files

Implement gettemp.

parent 2b20f5cc
Branches
No related tags found
No related merge requests found
Pipeline #
......@@ -10,6 +10,7 @@ package geiger
import (
"errors"
"fmt"
"strconv"
"time"
"github.com/tarm/serial"
......@@ -334,6 +335,26 @@ func (gc *GQGMCCounter) GetTime() (time.Time, error) {
return t, nil
}
// GetTemp gets the time
func (gc *GQGMCCounter) GetTemp() (float64, error) {
t, err := gc.communicate(cmdGetTemp, 4)
if err != nil {
return 0, err
}
var temp float64
temp, err = strconv.ParseFloat(fmt.Sprintf("%d.%d", uint8(t[0]), uint8(t[1])), 64)
if err != nil {
return 0, err
}
if t[2] != 0 {
temp = -temp
}
return temp, nil
}
// cmdGetGyro = "<GETGYRO>>" // GMC-320 Re.3.01
// FactoryReset does a factory reset
func (gc *GQGMCCounter) FactoryReset() {
gc.sendCmd(cmdFactoryReset)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment