From 1738345af5210c811eb2e191235ed6fb282f440b Mon Sep 17 00:00:00 2001 From: matthewh628 Date: Fri, 3 Jan 2020 10:22:25 -0600 Subject: [PATCH] Added setting "NoSleep" to disable sleeping --- main/gen_gdl90.go | 2 ++ main/network.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index f7d9f74b..3d2f05a0 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1126,6 +1126,7 @@ type settings struct { WiFiSecurityEnabled bool WiFiPassphrase string WiFiSmartEnabled bool // "Smart WiFi" - disables the default gateway for iOS. + NoSleep bool } type status struct { @@ -1200,6 +1201,7 @@ func defaultSettings() { globalSettings.OwnshipModeS = "F00000" globalSettings.DeveloperMode = false globalSettings.StaticIps = make([]string, 0) + globalSettings.NoSleep = false } func readSettings() { diff --git a/main/network.go b/main/network.go index 93425ae2..6402c363 100644 --- a/main/network.go +++ b/main/network.go @@ -145,6 +145,9 @@ func getDHCPLeases() (map[string]string, error) { ***WARNING***: netMutex must be locked before calling this function. */ func isSleeping(k string) bool { + if globalSettings.NoSleep == true { + return false + } ipAndPort := strings.Split(k, ":") // No ping response. Assume disconnected/sleeping device. if lastPing, ok := pingResponse[ipAndPort[0]]; !ok || stratuxClock.Since(lastPing) > (10*time.Second) {