kopia lustrzana https://github.com/cyoung/stratux
rodzic
3e1ea2dfc6
commit
ecd29a8425
|
@ -4,9 +4,11 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -315,6 +317,17 @@ func updateStatus() {
|
||||||
|
|
||||||
// Update Uptime.
|
// Update Uptime.
|
||||||
globalStatus.Uptime = time.Since(timeStarted).String()
|
globalStatus.Uptime = time.Since(timeStarted).String()
|
||||||
|
|
||||||
|
// Update CPUTemp.
|
||||||
|
temp, err := ioutil.ReadFile("/sys/class/thermal/thermal_zone0/temp")
|
||||||
|
tempStr := strings.Trim(string(temp), "\n")
|
||||||
|
globalStatus.CPUTemp = float32(-99.0)
|
||||||
|
if err == nil {
|
||||||
|
tInt, err := strconv.Atoi(tempStr)
|
||||||
|
if err == nil {
|
||||||
|
globalStatus.CPUTemp = float32(tInt) / float32(1000.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseInput(buf string) ([]byte, uint16) {
|
func parseInput(buf string) ([]byte, uint16) {
|
||||||
|
@ -386,6 +399,7 @@ type status struct {
|
||||||
GPS_connected bool
|
GPS_connected bool
|
||||||
RY835AI_connected bool
|
RY835AI_connected bool
|
||||||
Uptime string
|
Uptime string
|
||||||
|
CPUTemp float32
|
||||||
}
|
}
|
||||||
|
|
||||||
var globalSettings settings
|
var globalSettings settings
|
||||||
|
|
Ładowanie…
Reference in New Issue