diff --git a/cmd/fan/fan.go b/cmd/fan/fan.go index 38d332b..6240ec4 100644 --- a/cmd/fan/fan.go +++ b/cmd/fan/fan.go @@ -33,12 +33,6 @@ func main() { log.Fatalf("Config file changed! Exiting!") }) - log.Print("========================================") - pfConfig.Print() - log.Print("========================================") - log.Print(pfConfig.Keys()) - log.Print("========================================") - // 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) @@ -48,14 +42,6 @@ func main() { SPEED_TWENTY_FIVE_PERCENT_TEMP := pfConfig.Float64(config.CONFIG_KEY_FAN_SPEEDS + "." + config.CONFIG_MAP_KEY_FAN_SPEED_25) SPEED_MINIMUM := pfConfig.Int(config.CONFIG_KEY_FAN_MIN_SPEED) - log.Print(speedMap) - log.Print(POLL_INTERVAL) - log.Print(SPEED_FULL_TEMP) - log.Print(SPEED_SEVENTY_FIVE_PERCENT_TEMP) - log.Print(SPEED_FIFTY_PERCENT_TEMP) - log.Print(SPEED_TWENTY_FIVE_PERCENT_TEMP) - log.Print(SPEED_MINIMUM) - // Setup fan and bail if we can't see it fan, err := argonFan.New(ADDRESS, BUS) if err != nil { @@ -90,52 +76,43 @@ func main() { if cpuTemp >= SPEED_FULL_TEMP || gpuTemp >= SPEED_FULL_TEMP { if SPEED_MINIMUM > 100 { - log.Print("MIN speed in 100") fan.SetSpeed(SPEED_MINIMUM) } else { - log.Print("Speed 100%") fan.SetSpeed(100) } continue } if cpuTemp >= SPEED_SEVENTY_FIVE_PERCENT_TEMP || gpuTemp >= SPEED_SEVENTY_FIVE_PERCENT_TEMP { if SPEED_MINIMUM > 75 { - log.Print("MIN speed in 75") fan.SetSpeed(SPEED_MINIMUM) } else { - log.Print("Speed 75%") fan.SetSpeed(75) } continue } if cpuTemp >= SPEED_FIFTY_PERCENT_TEMP || gpuTemp >= SPEED_FIFTY_PERCENT_TEMP { if SPEED_MINIMUM > 50 { - log.Print("MIN speed in 50") fan.SetSpeed(SPEED_MINIMUM) } else { - log.Print("Speed 50%") fan.SetSpeed(50) } continue } if cpuTemp >= SPEED_TWENTY_FIVE_PERCENT_TEMP || gpuTemp >= SPEED_TWENTY_FIVE_PERCENT_TEMP { if SPEED_MINIMUM > 25 { - log.Print("MIN speed in 25") fan.SetSpeed(SPEED_MINIMUM) } else { - log.Print("Speed 25%") fan.SetSpeed(25) } continue } if cpuTemp < SPEED_TWENTY_FIVE_PERCENT_TEMP || gpuTemp < SPEED_TWENTY_FIVE_PERCENT_TEMP { - log.Print("MIN SPEED") fan.SetSpeed(SPEED_MINIMUM) continue } // We should never get here but... // Maxing fan to be on the safe side - log.Print("This should never happen") + log.Print("pf-fan : This should never happen") fan.SetSpeed(100) } } diff --git a/cmd/gui/gui.go b/cmd/gui/gui.go index e084b59..58222da 100644 --- a/cmd/gui/gui.go +++ b/cmd/gui/gui.go @@ -15,7 +15,6 @@ import ( ) func main() { - log.Print("Starting up") // Command line flag handler f := flag.NewFlagSet("piframe", flag.ContinueOnError) f.Usage = func() { @@ -23,7 +22,6 @@ func main() { os.Exit(0) } // Command line flags - log.Print("Setting up CLI flags") f.Bool(config.CLI_FLAG_CONFIG_ONLY, false, "Only show the config UI, NOT the slideshow") cliFlag := f.Lookup(config.CLI_FLAG_CONFIG_ONLY) if cliFlag != nil { @@ -32,11 +30,8 @@ func main() { // Process command line flags into handler f.Parse(os.Args[1:]) - log.Print("Loading config") // Load the config file pfConfig, configFileProvider := config.LoadConfig(false) - log.Printf("%v", pfConfig) - pfConfig.Print() // Watch for config changes and re-load config if needed configFileProvider.Watch(func(event interface{}, err error) { diff --git a/cmd/hdmi/hdmi.go b/cmd/hdmi/hdmi.go index e379577..936bcfb 100644 --- a/cmd/hdmi/hdmi.go +++ b/cmd/hdmi/hdmi.go @@ -18,7 +18,6 @@ const ( func main() { // Load the config file pfConfig, _ := config.LoadConfig(false) - pfConfig.Print() // Read config values hdmiOn := pfConfig.String(config.CONFIG_KEY_HDMI_ON) @@ -32,9 +31,6 @@ func main() { hdmiOff = strings.TrimLeft(hdmiOff, "*-*-* ") hdmiOffSplit := strings.Split(hdmiOff, ":") - log.Print(hdmiOnSplit) - log.Print(hdmiOffSplit) - // Parse hdmi on hours/minutes/seconds into ints so they can be used to create real date/time hdmiOnHour, err := strconv.Atoi(hdmiOnSplit[0]) if err != nil { @@ -68,18 +64,12 @@ func main() { hdmiOnTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), hdmiOnHour, hdmiOnMinute, hdmiOnSecond, 0, currentTime.Location()) hdmiOffTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), hdmiOffHour, hdmiOffMinute, hdmiOffSecond, 0, currentTime.Location()) - log.Print(currentTime) - log.Print(hdmiOnTime) - log.Print(hdmiOffTime) - // Turn on/off screen depending on current time vcgencmdOnOffFlag := "-1" if currentTime.After(hdmiOnTime) && currentTime.Before(hdmiOffTime) { - log.Print("Turning ON screen") vcgencmdOnOffFlag = "1" } if currentTime.After(hdmiOffTime) && currentTime.Before(hdmiOnTime) { - log.Print("Turning OFF screen") vcgencmdOnOffFlag = "0" } diff --git a/cmd/inotify/inotify.go b/cmd/inotify/inotify.go index e42605b..42a670b 100644 --- a/cmd/inotify/inotify.go +++ b/cmd/inotify/inotify.go @@ -60,8 +60,6 @@ func main() { if !ok { return } - // Print out event (this is where logic will go eventually)) - log.Printf("event: %#v\n", event) // [Re]Start timer to restart slideshow after the fs events die down watchdog.Kick() case err, ok := <-watcher.Errors: diff --git a/cmd/wifi/wifi.go b/cmd/wifi/wifi.go index 4d6ac5a..86c94de 100644 --- a/cmd/wifi/wifi.go +++ b/cmd/wifi/wifi.go @@ -90,7 +90,6 @@ func main() { // Doing stuff with the file contents goes here essid := config[0] password := config[1] - log.Printf("Using config: %s / %s for WiFi\n", essid, password) // Cleanup old wifi configs and apply new one nmWifi := wifi.New(essid, password) diff --git a/config/config.go b/config/config.go index 450e776..88ba200 100644 --- a/config/config.go +++ b/config/config.go @@ -28,7 +28,6 @@ func LoadConfig(errFatalOnMissing bool) (*koanf.Koanf, *kfile.File) { // Bring in /etc/defaults/pf.toml if it exists configFileProvider := kfile.Provider(CONFIG_FILE_PATH) - log.Print("========================================") if err := pfConfig.Load(configFileProvider, toml.Parser()); err != nil { if errFatalOnMissing { log.Fatalf("Error loading config : %s", err) @@ -36,12 +35,6 @@ func LoadConfig(errFatalOnMissing bool) (*koanf.Koanf, *kfile.File) { log.Printf("Error loading config : %s", err) } } - log.Print("========================================") - - log.Print("========================================") - log.Print("Loaded Config") - pfConfig.Print() - log.Print("========================================") return pfConfig, configFileProvider } diff --git a/ui/config.go b/ui/config.go index 4cf4d91..707a3a5 100644 --- a/ui/config.go +++ b/ui/config.go @@ -331,7 +331,6 @@ func ConfigGui(pfconfig *koanf.Koanf) { for _, i := range ifaces { addrs, err := i.Addrs() if err != nil { - log.Printf("Error getting interface addresses : %s", err) continue } for _, a := range addrs { diff --git a/ui/slideshow.go b/ui/slideshow.go index 6fb5f27..d58974e 100644 --- a/ui/slideshow.go +++ b/ui/slideshow.go @@ -25,7 +25,6 @@ var fim *exec.Cmd = nil var stdin io.WriteCloser = nil func setupFim(PATH_TEMP_FOR_SLIDESHOW string) { - log.Print("Setting up new fim process") // Prep slideshow command and arguments // NOTE: The random flag is seeded with time() ; this is bad as we will be restarting the slideshow at about the same time per the configurd schedule // We use the non-seeded form to ensure that it's a little more random (or at least hope it's a little more random) @@ -57,7 +56,6 @@ func Slideshow(pfconfig *koanf.Koanf) { // /run is a tmpfs so this won't wear on the sd card storage // Create temp folder - log.Print("Creating temp folder for album selections") _, err := os.Stat(PATH_TEMP_FOR_SLIDESHOW) if os.IsNotExist(err) { errDir := os.MkdirAll(PATH_TEMP_FOR_SLIDESHOW, 0755) @@ -67,7 +65,6 @@ func Slideshow(pfconfig *koanf.Koanf) { } // Cleanup temp folder if it already existed - log.Print("Cleaning up temp folder if it exists") dirRead, err := os.Open(PATH_TEMP_FOR_SLIDESHOW) if err != nil { log.Fatalf("Error setting up slideshow : %s", err) @@ -93,7 +90,6 @@ func Slideshow(pfconfig *koanf.Koanf) { // Setup symlinks to selected albums to be used with slideshow // Add albums full paths to command line args for fim - log.Print("Setting up symlinks to selected albums") albumRootPath := pfconfig.String(config.CONFIG_KEY_ALBUMS_ROOT) for _, album := range pfconfig.Strings(config.CONFIG_KEY_ALBUMS_SELECTED) { source := albumRootPath + album @@ -131,7 +127,6 @@ func Slideshow(pfconfig *koanf.Koanf) { setupFim(PATH_TEMP_FOR_SLIDESHOW) // Advance slideshow every interval as defined in const() - log.Print("Setting up slideshow advance slide ticker") slideshowAdvanceDurationString := pfconfig.String(config.CONFIG_KEY_SLIDESHOW_INTERVAL) slideshowAdvanceDuration, err := time.ParseDuration(slideshowAdvanceDurationString) if err != nil { @@ -172,7 +167,6 @@ func Slideshow(pfconfig *koanf.Koanf) { STOP_SLIDESHOW := false // Goroutine for tracking which keys are pressed and controlling fim if appropriate - log.Print("Setting up keyboard listener") keyboardCtx, keyboardCancel := context.WithCancel(context.Background()) go func(keyboardCtx context.Context) { for { @@ -210,7 +204,6 @@ func Slideshow(pfconfig *koanf.Koanf) { // Control fim if we received a valid key for next/previous slide if fimKey != "" { - log.Printf("Sending key to fim : %s", fimKey) _, err = io.WriteString(stdin, fimKey) if err != nil { log.Fatalf("Error controlling fim : %s", err) @@ -222,7 +215,6 @@ func Slideshow(pfconfig *koanf.Koanf) { }(keyboardCtx) // Restart fim after configured timeout ; This is setup as a ticker due to KemoNine not getting CommandWithContext stuff to work properly (lots of pointer related crashes and the like) - log.Print("Setting up fim restart ticker") fimRestartDurationString := pfconfig.String(config.CONFIG_KEY_SLIDESHOW_RESTART_INTERVAL) fimRestartDuration, err := time.ParseDuration(fimRestartDurationString) if err != nil { @@ -251,7 +243,6 @@ func Slideshow(pfconfig *koanf.Koanf) { // Run fim for !STOP_SLIDESHOW { - log.Print("Top of fim slideshow loop") if err := fim.Run(); err != nil { // Unwrap the error a bit so we can find out if a signal killed fim or something else // An exit code of -1 means the program didn't exit in time or was terminated by a signal (per the docs) diff --git a/wifi/wifi.go b/wifi/wifi.go index 99d5014..4858584 100644 --- a/wifi/wifi.go +++ b/wifi/wifi.go @@ -35,14 +35,12 @@ func (w *wifi) ApplyConfig() { if details[2] != "802-11-wireless" { continue } - log.Printf("Cleaning up WiFi connection %s", details[0]) err := exec.Command(CMD_NMCLI, "connection", "del", details[1]).Run() if err != nil { log.Fatalf("Error running %s : %s", CMD_NMCLI, err) } } // Create new WiFi connection with network manager - log.Printf("Connecting to %s with password %s\n", w.essid, w.password) err = exec.Command(CMD_NMCLI, "d", "wifi", "connect", w.essid, "password", w.password).Run() if err != nil { log.Fatalf("Error running %s : %s", CMD_NMCLI, err)