diff options
author | Sean E. Russell <ser@ser1.net> | 2020-04-23 13:01:13 -0500 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-04-23 13:01:13 -0500 |
commit | 6cee395f0636e17174881fa88e4a34f1f1e6a3dc (patch) | |
tree | e6b80632530cc635dd258346704bc81f67d0d0ce /devices/temp_darwin.go | |
parent | 5ada5315d940038fcd83777b1e73797bbbada108 (diff) |
Add sensible defaults for temps. Improve config writing.
Diffstat (limited to 'devices/temp_darwin.go')
-rw-r--r-- | devices/temp_darwin.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/devices/temp_darwin.go b/devices/temp_darwin.go index fe98fc2..37559d1 100644 --- a/devices/temp_darwin.go +++ b/devices/temp_darwin.go @@ -6,7 +6,7 @@ import smc "github.com/xxxserxxx/iSMC" func init() { RegisterTemp(update) - RegisterDeviceList(Temperatures, devs) + RegisterDeviceList(Temperatures, devs, defs) ts = make(map[string]float32) } @@ -25,8 +25,6 @@ func update(temps map[string]int) map[string]error { return nil } -// TODO: Set reasonable default devices -// CPU (TC[01]P), GPU (TG0P), Memory (Ts0S) and Disk (TH0P) func devs() []string { rv := make([]string, len(smc.AppleTemp)) for i, v := range smc.AppleTemp { @@ -34,3 +32,15 @@ func devs() []string { } return rv } + +func defs() []string { + // CPU 0 CPU 1 GPU Memory Disk + ids := map[string]bool{"TC0P": true, "TC1P": true, "TG0P": true, "Ts0S": true, "TH0P": true} + rv := make([]string, 0, len(ids)) + for _, v := range smc.AppleTemp { + if ids[v.Key] { + rv = append(rv, v.Desc) + } + } + return rv +} |