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

Implement gettemp.

parent 2b20f5cc
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -10,6 +10,7 @@ package geiger ...@@ -10,6 +10,7 @@ package geiger
import ( import (
"errors" "errors"
"fmt" "fmt"
"strconv"
"time" "time"
"github.com/tarm/serial" "github.com/tarm/serial"
...@@ -334,6 +335,26 @@ func (gc *GQGMCCounter) GetTime() (time.Time, error) { ...@@ -334,6 +335,26 @@ func (gc *GQGMCCounter) GetTime() (time.Time, error) {
return t, nil 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 // FactoryReset does a factory reset
func (gc *GQGMCCounter) FactoryReset() { func (gc *GQGMCCounter) FactoryReset() {
gc.sendCmd(cmdFactoryReset) gc.sendCmd(cmdFactoryReset)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment