mirror of https://github.com/cjbassi/gotop.git
Don't sensor with a temp of 0
This commit is contained in:
parent
7da570d782
commit
ce5342cfc9
|
@ -52,6 +52,8 @@ func SensorsTemperatures() ([]TemperatureStat, error) {
|
||||||
func (self *Temp) update() {
|
func (self *Temp) update() {
|
||||||
sensors, _ := SensorsTemperatures()
|
sensors, _ := SensorsTemperatures()
|
||||||
for _, sensor := range sensors {
|
for _, sensor := range sensors {
|
||||||
self.Data[sensor.SensorKey] = int(sensor.Temperature)
|
if sensor.Temperature != 0 {
|
||||||
|
self.Data[sensor.SensorKey] = int(sensor.Temperature)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ func (self *Temp) update() {
|
||||||
sensors, _ := psHost.SensorsTemperatures()
|
sensors, _ := psHost.SensorsTemperatures()
|
||||||
for _, sensor := range sensors {
|
for _, sensor := range sensors {
|
||||||
// only sensors with input in their name are giving us live temp info
|
// only sensors with input in their name are giving us live temp info
|
||||||
if strings.Contains(sensor.SensorKey, "input") {
|
if strings.Contains(sensor.SensorKey, "input") && sensor.Temperature != 0 {
|
||||||
// removes '_input' from the end of the sensor name
|
// removes '_input' from the end of the sensor name
|
||||||
label := sensor.SensorKey[:strings.Index(sensor.SensorKey, "_input")]
|
label := sensor.SensorKey[:strings.Index(sensor.SensorKey, "_input")]
|
||||||
self.Data[label] = int(sensor.Temperature)
|
self.Data[label] = int(sensor.Temperature)
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
func (self *Temp) update() {
|
func (self *Temp) update() {
|
||||||
sensors, _ := psHost.SensorsTemperatures()
|
sensors, _ := psHost.SensorsTemperatures()
|
||||||
for _, sensor := range sensors {
|
for _, sensor := range sensors {
|
||||||
self.Data[sensor.SensorKey] = int(sensor.Temperature)
|
if sensor.Temperature != 0 {
|
||||||
|
self.Data[sensor.SensorKey] = int(sensor.Temperature)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue