kopia lustrzana https://github.com/cyoung/stratux
Added setting "NoSleep" to disable sleeping
rodzic
37911bc692
commit
1738345af5
|
@ -1126,6 +1126,7 @@ type settings struct {
|
||||||
WiFiSecurityEnabled bool
|
WiFiSecurityEnabled bool
|
||||||
WiFiPassphrase string
|
WiFiPassphrase string
|
||||||
WiFiSmartEnabled bool // "Smart WiFi" - disables the default gateway for iOS.
|
WiFiSmartEnabled bool // "Smart WiFi" - disables the default gateway for iOS.
|
||||||
|
NoSleep bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type status struct {
|
type status struct {
|
||||||
|
@ -1200,6 +1201,7 @@ func defaultSettings() {
|
||||||
globalSettings.OwnshipModeS = "F00000"
|
globalSettings.OwnshipModeS = "F00000"
|
||||||
globalSettings.DeveloperMode = false
|
globalSettings.DeveloperMode = false
|
||||||
globalSettings.StaticIps = make([]string, 0)
|
globalSettings.StaticIps = make([]string, 0)
|
||||||
|
globalSettings.NoSleep = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func readSettings() {
|
func readSettings() {
|
||||||
|
|
|
@ -145,6 +145,9 @@ func getDHCPLeases() (map[string]string, error) {
|
||||||
***WARNING***: netMutex must be locked before calling this function.
|
***WARNING***: netMutex must be locked before calling this function.
|
||||||
*/
|
*/
|
||||||
func isSleeping(k string) bool {
|
func isSleeping(k string) bool {
|
||||||
|
if globalSettings.NoSleep == true {
|
||||||
|
return false
|
||||||
|
}
|
||||||
ipAndPort := strings.Split(k, ":")
|
ipAndPort := strings.Split(k, ":")
|
||||||
// No ping response. Assume disconnected/sleeping device.
|
// No ping response. Assume disconnected/sleeping device.
|
||||||
if lastPing, ok := pingResponse[ipAndPort[0]]; !ok || stratuxClock.Since(lastPing) > (10*time.Second) {
|
if lastPing, ok := pingResponse[ipAndPort[0]]; !ok || stratuxClock.Since(lastPing) > (10*time.Second) {
|
||||||
|
|
Ładowanie…
Reference in New Issue