Compare commits

..

No commits in common. "588145b163d6012318f5c06edde0b318ec68ba24" and "f8b4031aa37de3bd997cc0f0462bbd2ae3d55c0b" have entirely different histories.

2 changed files with 2 additions and 8 deletions

View file

@ -9,8 +9,8 @@ import (
argonFan "git.sungo.io/sungo/argon/fan" argonFan "git.sungo.io/sungo/argon/fan"
"git.kemonine.info/PiFrame/config"
"git.kemonine.info/PiFrame/utils" "git.kemonine.info/PiFrame/utils"
"git.kemonine.info/PiFrame/config"
) )
const ( const (
@ -22,12 +22,6 @@ 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)

View file

@ -31,7 +31,7 @@ func LoadConfig() (*koanf.Koanf, *kfile.File) {
configFileProvider := kfile.Provider(CONFIG_FILE_PATH) configFileProvider := kfile.Provider(CONFIG_FILE_PATH)
_, err := os.Stat(CONFIG_FILE_PATH) _, err := os.Stat(CONFIG_FILE_PATH)
if os.IsNotExist(err) { if os.IsNotExist(err) {
//log.Printf("%s does not exist, USING DEFAULTS", CONFIG_FILE_PATH) //log.Printf("%s does not exist, USING DEFAULTS", ui.CONFIG_FILE_PATH)
} else { } else {
if errConfigFile := pfConfig.Load(configFileProvider, toml.Parser()); errConfigFile != nil { if errConfigFile := pfConfig.Load(configFileProvider, toml.Parser()); errConfigFile != nil {
log.Fatalf("Error loading config : %s", err) log.Fatalf("Error loading config : %s", err)