Prevent device sleep during WiFi file transfer and OTA updates#203
Merged
daveallie merged 1 commit intocrosspoint-reader:masterfrom Jan 2, 2026
Merged
Prevent device sleep during WiFi file transfer and OTA updates#203daveallie merged 1 commit intocrosspoint-reader:masterfrom
daveallie merged 1 commit intocrosspoint-reader:masterfrom
Conversation
Fixes #199 - device would auto-sleep after 10 minutes while webserver was running. Adds preventAutoSleep() method to Activity base class, allowing activities to signal they should keep the device awake.
daveallie
approved these changes
Jan 2, 2026
Member
|
Thanks for this! |
yingirene
pushed a commit
to yingirene/crosspoint-reader
that referenced
this pull request
Jan 16, 2026
…point-reader#203) ## Summary * **What is the goal of this PR?** Fixes crosspoint-reader#199 - Device falls asleep during WiFi file transfer after 10 minutes of inactivity, disconnecting the web server. * **What changes are included?** - Add `preventAutoSleep()` virtual method to `Activity` base class - Modify main loop to reset inactivity timer when `preventAutoSleep()` returns true - Override `preventAutoSleep()` in `CrossPointWebServerActivity` (returns true when web server running) - Override `preventAutoSleep()` in `OtaUpdateActivity` (returns true during update check/download) ## Additional Context * The existing `skipLoopDelay()` method controls loop timing (yield vs delay) for HTTP responsiveness. The new `preventAutoSleep()` method is semantically separate - it explicitly signals that an activity should keep the device awake. * `CrossPointWebServerActivity` uses both methods: `skipLoopDelay()` for responsive HTTP handling, `preventAutoSleep()` for staying awake. * `OtaUpdateActivity` only needs `preventAutoSleep()` since the OTA library handles HTTP internally.
Unintendedsideeffects
pushed a commit
to Unintendedsideeffects/crosspoint-reader
that referenced
this pull request
Feb 17, 2026
…point-reader#203) ## Summary * **What is the goal of this PR?** Fixes crosspoint-reader#199 - Device falls asleep during WiFi file transfer after 10 minutes of inactivity, disconnecting the web server. * **What changes are included?** - Add `preventAutoSleep()` virtual method to `Activity` base class - Modify main loop to reset inactivity timer when `preventAutoSleep()` returns true - Override `preventAutoSleep()` in `CrossPointWebServerActivity` (returns true when web server running) - Override `preventAutoSleep()` in `OtaUpdateActivity` (returns true during update check/download) ## Additional Context * The existing `skipLoopDelay()` method controls loop timing (yield vs delay) for HTTP responsiveness. The new `preventAutoSleep()` method is semantically separate - it explicitly signals that an activity should keep the device awake. * `CrossPointWebServerActivity` uses both methods: `skipLoopDelay()` for responsive HTTP handling, `preventAutoSleep()` for staying awake. * `OtaUpdateActivity` only needs `preventAutoSleep()` since the OTA library handles HTTP internally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What is the goal of this PR? Fixes Device can fall asleep during wifi file transfer #199 - Device falls asleep during WiFi file transfer after 10 minutes of inactivity, disconnecting the web server.
What changes are included?
preventAutoSleep()virtual method toActivitybase classpreventAutoSleep()returns truepreventAutoSleep()inCrossPointWebServerActivity(returns true when web server running)preventAutoSleep()inOtaUpdateActivity(returns true during update check/download)Additional Context
skipLoopDelay()method controls loop timing (yield vs delay) for HTTP responsiveness. The newpreventAutoSleep()method is semantically separate - it explicitly signals that an activity should keep the device awake.CrossPointWebServerActivityuses both methods:skipLoopDelay()for responsive HTTP handling,preventAutoSleep()for staying awake.OtaUpdateActivityonly needspreventAutoSleep()since the OTA library handles HTTP internally.