Added setting "NoSleep" to disable sleeping

pull/802/head
matthewh628 2020-01-03 10:22:25 -06:00
rodzic 37911bc692
commit 1738345af5
2 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -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() {

Wyświetl plik

@ -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) {