스텟들 바뀌지 않더라도 노티하게 함
This commit is contained in:
parent
8aff2658e2
commit
1d55617d68
|
@ -58,7 +58,9 @@ func (c *fanControl) StartControl() {
|
|||
case <-ticker:
|
||||
break checker
|
||||
case changedSpeed := <-c.fanSpeedConsumer:
|
||||
newFanSpeedList[changedSpeed.Id] = changedSpeed.FanSpeed
|
||||
if changedSpeed.Changed {
|
||||
newFanSpeedList[changedSpeed.Id] = changedSpeed.FanSpeed
|
||||
}
|
||||
case <-c.handler.Done():
|
||||
return
|
||||
}
|
||||
|
|
|
@ -33,11 +33,13 @@ type processor struct {
|
|||
type TempetureInfo struct {
|
||||
Id int
|
||||
Tempeture float64
|
||||
Changed bool
|
||||
}
|
||||
|
||||
type FanspeedInfo struct {
|
||||
Id int
|
||||
FanSpeed int
|
||||
Changed bool
|
||||
}
|
||||
|
||||
type Processor interface {
|
||||
|
@ -136,35 +138,39 @@ func (p *processor) StartMonitoring() {
|
|||
fanspeed int
|
||||
)
|
||||
|
||||
/*
|
||||
CREATE CONTINUOUS QUERY "processor_tempeture_5s" ON "core" BEGIN SELECT mean("tempeture") AS "mean_tempeture" INTO "12 weeks"."processor_tempeture_5s" FROM "processor_tempeture" GROUP BY processor, time(5s) fill(previous) END
|
||||
*/
|
||||
highestTemp = p.getMaxTempetureOnProcessor(tempeturePathGlob)
|
||||
if highestTemp != p.tempeture {
|
||||
if p.tempetureChanged != nil {
|
||||
select {
|
||||
case p.tempetureChanged <- TempetureInfo{
|
||||
Id: p.id,
|
||||
Tempeture: highestTemp,
|
||||
}:
|
||||
default:
|
||||
}
|
||||
if p.tempetureChanged != nil {
|
||||
select {
|
||||
case p.tempetureChanged <- TempetureInfo{
|
||||
Id: p.id,
|
||||
Tempeture: highestTemp,
|
||||
Changed: highestTemp != p.tempeture,
|
||||
}:
|
||||
default:
|
||||
}
|
||||
p.tempeture = highestTemp
|
||||
log.Debugf("processor %d : tempeture changed %f", p.id, highestTemp)
|
||||
}
|
||||
p.tempeture = highestTemp
|
||||
log.Debugf("processor %d : tempeture changed %f", p.id, highestTemp)
|
||||
|
||||
/*
|
||||
CREATE CONTINUOUS QUERY "processor_cooling_fanspeed_5s" ON "core" BEGIN SELECT mean("noob") AS "mean_noob" INTO "12 weeks"."processor_cooling_fanspeed_5s" FROM "processor_cooling_fanspeed" GROUP BY processor, time(5s) fill(previous) END
|
||||
*/
|
||||
fanspeed = p.normalizeFanspeed(p.fanController.Update(highestTemp))
|
||||
if fanspeed != p.fanSpeed {
|
||||
if p.fanSpeedChanged != nil {
|
||||
select {
|
||||
case p.fanSpeedChanged <- FanspeedInfo{
|
||||
Id: p.id,
|
||||
FanSpeed: fanspeed,
|
||||
}:
|
||||
default:
|
||||
}
|
||||
if p.fanSpeedChanged != nil {
|
||||
select {
|
||||
case p.fanSpeedChanged <- FanspeedInfo{
|
||||
Id: p.id,
|
||||
FanSpeed: fanspeed,
|
||||
Changed: fanspeed != p.fanSpeed,
|
||||
}:
|
||||
default:
|
||||
}
|
||||
p.fanSpeed = fanspeed
|
||||
log.Debugf("processor %d : fan changed 0x%x", p.id, fanspeed)
|
||||
}
|
||||
p.fanSpeed = fanspeed
|
||||
log.Debugf("processor %d : fan changed 0x%x", p.id, fanspeed)
|
||||
case <-p.handler.Done():
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue