mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-22 02:32:23 +00:00
Add Adaptive Polling Intervals to WebServer (#7864)
* feat: add adaptive polling intervals to WebServer Replace fixed 5ms polling with adaptive intervals based on HTTP activity: - 50ms during active periods (first 5 seconds after request) - 200ms during medium activity (5-30 seconds) - 1000ms during idle periods (30+ seconds) Reduces CPU usage significantly during idle periods while maintaining responsiveness when handling HTTP requests. * Fix integer overflow and magic numbers in WebServer - Handle millis() overflow in getAdaptiveInterval() - Replace magic numbers with named constants - Improve code readability and maintainability
This commit is contained in:
@@ -10,13 +10,17 @@ void createSSLCert();
|
||||
|
||||
class WebServerThread : private concurrency::OSThread
|
||||
{
|
||||
private:
|
||||
uint32_t lastActivityTime = 0;
|
||||
|
||||
public:
|
||||
WebServerThread();
|
||||
uint32_t requestRestart = 0;
|
||||
void markActivity();
|
||||
|
||||
protected:
|
||||
virtual int32_t runOnce() override;
|
||||
int32_t getAdaptiveInterval();
|
||||
};
|
||||
|
||||
extern WebServerThread *webServerThread;
|
||||
|
||||
Reference in New Issue
Block a user