Update fan daemon to re-evaluate the config values if there aren't valid values for temps (ie all 0's) which causes the program to not function correct, see code comments for further details
This commit is contained in:
parent
6634e7d8ef
commit
588145b163
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
argonFan "git.sungo.io/sungo/argon/fan"
|
argonFan "git.sungo.io/sungo/argon/fan"
|
||||||
|
|
||||||
"git.kemonine.info/PiFrame/utils"
|
|
||||||
"git.kemonine.info/PiFrame/config"
|
"git.kemonine.info/PiFrame/config"
|
||||||
|
"git.kemonine.info/PiFrame/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -22,6 +22,12 @@ func main() {
|
||||||
// Load the config file
|
// Load the config file
|
||||||
pfConfig, _ := config.LoadConfig()
|
pfConfig, _ := config.LoadConfig()
|
||||||
|
|
||||||
|
// For some reason the map isn't populated 'right away' and/or doesn't always come in via koanf
|
||||||
|
// Work around by re-loading the config as necessary to get valid values
|
||||||
|
for pfConfig.Float64Map(config.CONFIG_KEY_FAN_SPEEDS)[config.CONFIG_MAP_KEY_FAN_SPEED_100] == 0 {
|
||||||
|
pfConfig, _ = config.LoadConfig()
|
||||||
|
}
|
||||||
|
|
||||||
// Get the various fan related config options as local variables
|
// Get the various fan related config options as local variables
|
||||||
speedMap := pfConfig.Float64Map(config.CONFIG_KEY_FAN_SPEEDS)
|
speedMap := pfConfig.Float64Map(config.CONFIG_KEY_FAN_SPEEDS)
|
||||||
POLL_INTERVAL := pfConfig.String(config.CONFIG_KEY_FAN_POLL_INTERVAL)
|
POLL_INTERVAL := pfConfig.String(config.CONFIG_KEY_FAN_POLL_INTERVAL)
|
||||||
|
|
Loading…
Reference in a new issue