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

CPU / Battery usage #2

Open
haakoni opened this issue May 20, 2021 · 1 comment
Open

CPU / Battery usage #2

haakoni opened this issue May 20, 2021 · 1 comment

Comments

@haakoni
Copy link

haakoni commented May 20, 2021

The server runs in a tight loop even when in "relaxed" mode (10 second idle timeout)

I would suggest to add this simple change to keep the raspberry much cooler and not using so much power when idle/relaxed;

diff --git a/Code/Server/Control.py b/Code/Server/Control.py
index 7e73f6e..d26060b 100644
--- a/Code/Server/Control.py
+++ b/Code/Server/Control.py
@@ -152,6 +152,8 @@ class Control:
         return flag
     def condition(self):
         while True:
+            if self.flag==0x00:
+                time.sleep(0.01)
             if (time.time()-self.timeout)>10 and  self.timeout!=0 and self.order[0]=='':
                 self.timeout=time.time()
                 self.relax(True)
@DenzelChen
Copy link
Contributor

Thank you for your suggestion. We will optimize the code. Have a nice day. :)

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

No branches or pull requests

2 participants