summaryrefslogtreecommitdiffstats
path: root/devices/temp_darwin.go
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-04-23 10:41:20 -0500
committerSean E. Russell <ser@ser1.net>2020-04-23 10:41:20 -0500
commit5ada5315d940038fcd83777b1e73797bbbada108 (patch)
tree14af5297197ecc43e50ff7cafa8154fda55dd72f /devices/temp_darwin.go
parent3fcab5a42054c84895c4f6da5097360d35414fde (diff)
Fixes #92, configurable temps; help text & docs clean-up; versions are now built into binaries at compile time; clean up old extensions params; adds --list command; adds --write-config command; fixes bug in colorscheme loading; fixes bug in Colorschemes -- all had empty Name attrs; adds ability to list devices.
Diffstat (limited to 'devices/temp_darwin.go')
-rw-r--r--devices/temp_darwin.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/devices/temp_darwin.go b/devices/temp_darwin.go
index 4e068a4..fe98fc2 100644
--- a/devices/temp_darwin.go
+++ b/devices/temp_darwin.go
@@ -6,6 +6,7 @@ import smc "github.com/xxxserxxx/iSMC"
func init() {
RegisterTemp(update)
+ RegisterDeviceList(Temperatures, devs)
ts = make(map[string]float32)
}
@@ -17,7 +18,19 @@ func update(temps map[string]int) map[string]error {
return map[string]error{"temps": err}
}
for k, v := range ts {
- temps[k] = int(v + 0.5)
+ if _, ok := temps[k]; ok {
+ temps[k] = int(v + 0.5)
+ }
}
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 {
+ rv[i] = v.Desc
+ }
+ return rv
+}