Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wake locks #88

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Add wake locks #88

wants to merge 12 commits into from

Conversation

Raidakarim
Copy link
Contributor

@Raidakarim Raidakarim commented Sep 18, 2023

Describe this pull request. Link to relevant GitHub issues, if any.

In service of issue #86

  • Enable NoSleep feature when state switches into RobotMotion
  • Disable NoSleep feature when state switches away from RobotMotion

Explain how this pull request was tested, including but not limited to the below checkmarks.

In iPhone device, with EC2 link of updated pulled code.


Before creating a pull request

  • Format React code with npm run format
  • Format Python code by running python3 -m black . in the top-level of this repository
  • Thoroughly test your code's functionality, including unintended uses.
  • Fully test the responsiveness of the feature as documented in the Responsiveness Testing Guidelines. If you deviate from those guidelines, document above why you deviated and what you did instead.
  • Consider the user flow between states that this feature introduces, consider different situations that might occur for the user, and ensure that there is no way for the user to get stuck in a loop.

Before merging a pull request

  • Squash all your commits into one (or Squash and Merge)

@Raidakarim Raidakarim self-assigned this Sep 18, 2023
@Raidakarim Raidakarim linked an issue Sep 18, 2023 that may be closed by this pull request
Copy link
Contributor

@amalnanavati amalnanavati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, as opposed to enabling NoSleep in every MealState that leads to RobotMotion, instead can't you enable it in the RobotMotion page instead? Specifically, in this useEffect you can call nosleep.enable() and then in the return value from that useEffect, you can call nosleep.disable(). In theory, that should enable nosleep every time the RobotMotion component mounts, and disable it every time the component unmounts. See here for more details on useEffect.

Let me know what you think. If you tried this, let me know why it didn't work.

Copy link
Contributor

@amalnanavati amalnanavati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. I'll test more on my mobile phone, with the actual robot, make any necessary changes, and merge it in after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent the phone from sleeping
2 participants