diff --git a/src/mesh/PhoneAPI.h b/src/mesh/PhoneAPI.h index cd475535e..628896dc5 100644 --- a/src/mesh/PhoneAPI.h +++ b/src/mesh/PhoneAPI.h @@ -20,6 +20,7 @@ #define SPECIAL_NONCE_ONLY_CONFIG 69420 #define SPECIAL_NONCE_ONLY_NODES 69421 // ( ͡° ͜ʖ ͡°) +#define WAKE_SESSION_TIMEOUT_MS 10000 /** * Provides our protobuf based API which phone/PC clients can use to talk to our device @@ -173,8 +174,8 @@ class PhoneAPI /// If the mesh service tells us fromNum has changed, tell the phone virtual int onNotify(uint32_t newValue) override; - int preflightSleepCb(void *unused = NULL) { return available(); } + int preflightSleepCb(void *unused = NULL) { return available() && (millis() - lastContactMsec) < WAKE_SESSION_TIMEOUT_MS; } CallbackObserver preflightSleepObserver = CallbackObserver(this, &PhoneAPI::preflightSleepCb); -}; \ No newline at end of file +}; diff --git a/src/mesh/http/ContentHandler.h b/src/mesh/http/ContentHandler.h index 1c62ffd29..2066a6d57 100644 --- a/src/mesh/http/ContentHandler.h +++ b/src/mesh/http/ContentHandler.h @@ -1,7 +1,4 @@ #pragma once - -#define HTTP_API_SESSION_TIMEOUT_MS 5000 - void registerHandlers(HTTPServer *insecureServer, HTTPSServer *secureServer); // Declare some handler functions for the various URLs on the server @@ -36,5 +33,5 @@ class HttpAPI : public PhoneAPI protected: /// Check the current underlying physical link to see if the client is currently connected - virtual bool checkIsConnected() override { return millis() - lastContactMsec < HTTP_API_SESSION_TIMEOUT_MS; } -}; + virtual bool checkIsConnected() override { return true; } // FIXME, be smarter about this +}; \ No newline at end of file