Skip to content

Commit

Permalink
Throttle frame rate of GUI processes to 60fps (#69)
Browse files Browse the repository at this point in the history
At the moment these processes are constantly looping and consuming CPU
while the scan command is running. This eats laptop battery life
surprisingly quickly and probably slows things down.
  • Loading branch information
russss authored Feb 11, 2025
1 parent 854754e commit 7b5b99f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions marimapper/detector_process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from multiprocessing import get_logger, Process, Queue, Event
import time
from marimapper.detector import (
show_image,
set_cam_default,
Expand Down Expand Up @@ -159,6 +160,7 @@ def run(self):
if self._display:
image = cam.read()
show_image(image)
time.sleep(1 / 60)

logger.info("resetting cam!")
set_cam_default(cam)
1 change: 1 addition & 0 deletions marimapper/visualize_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def run(self):

self._vis.poll_events()
self._vis.update_renderer()
time.sleep(1 / 60)

def initialise_visualiser__(self):
logger.debug("Renderer3D process initialising visualiser")
Expand Down

0 comments on commit 7b5b99f

Please sign in to comment.