Compare commits
2 commits
f8b4031aa3
...
588145b163
Author | SHA1 | Date | |
---|---|---|---|
KemoNine | 588145b163 | ||
KemoNine | 6634e7d8ef |
|
@ -9,8 +9,8 @@ import (
|
|||
|
||||
argonFan "git.sungo.io/sungo/argon/fan"
|
||||
|
||||
"git.kemonine.info/PiFrame/utils"
|
||||
"git.kemonine.info/PiFrame/config"
|
||||
"git.kemonine.info/PiFrame/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -22,6 +22,12 @@ func main() {
|
|||
// Load the config file
|
||||
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
|
||||
speedMap := pfConfig.Float64Map(config.CONFIG_KEY_FAN_SPEEDS)
|
||||
POLL_INTERVAL := pfConfig.String(config.CONFIG_KEY_FAN_POLL_INTERVAL)
|
||||
|
|
|
@ -31,7 +31,7 @@ func LoadConfig() (*koanf.Koanf, *kfile.File) {
|
|||
configFileProvider := kfile.Provider(CONFIG_FILE_PATH)
|
||||
_, err := os.Stat(CONFIG_FILE_PATH)
|
||||
if os.IsNotExist(err) {
|
||||
//log.Printf("%s does not exist, USING DEFAULTS", ui.CONFIG_FILE_PATH)
|
||||
//log.Printf("%s does not exist, USING DEFAULTS", CONFIG_FILE_PATH)
|
||||
} else {
|
||||
if errConfigFile := pfConfig.Load(configFileProvider, toml.Parser()); errConfigFile != nil {
|
||||
log.Fatalf("Error loading config : %s", err)
|
||||
|
|
Loading…
Reference in a new issue