mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-30 02:15:41 +00:00
move sleep wake timeout to PhoneAPI
This commit is contained in:
parent
5745c4ecf2
commit
802c2fa7ae
@ -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<PhoneAPI, void *> preflightSleepObserver =
|
||||
CallbackObserver<PhoneAPI, void *>(this, &PhoneAPI::preflightSleepCb);
|
||||
};
|
||||
};
|
||||
|
@ -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
|
||||
};
|
Loading…
Reference in New Issue
Block a user