mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Use timeout_add to lower CPU usage
This commit is contained in:
parent
2cd8fe26ac
commit
be82b952c3
@ -227,7 +227,7 @@ class OMVGtk:
|
|||||||
try:
|
try:
|
||||||
# open VCP and configure the terminal
|
# open VCP and configure the terminal
|
||||||
self.serial = serial.Serial(self.config.get("main", "serial_port"), self.baudrate, timeout=0.1)
|
self.serial = serial.Serial(self.config.get("main", "serial_port"), self.baudrate, timeout=0.1)
|
||||||
gobject.gobject.idle_add(omvgtk.update_terminal)
|
gobject.gobject.timeout_add(10, omvgtk.update_terminal)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# create fresh config if needed
|
# create fresh config if needed
|
||||||
if platform.system() == "Linux" and not os.path.isfile(UDEV_PATH):
|
if platform.system() == "Linux" and not os.path.isfile(UDEV_PATH):
|
||||||
@ -683,5 +683,5 @@ class OMVGtk:
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
omvgtk = OMVGtk()
|
omvgtk = OMVGtk()
|
||||||
omvgtk.window.show_all()
|
omvgtk.window.show_all()
|
||||||
gobject.gobject.idle_add(omvgtk.update_drawing)
|
gobject.gobject.timeout_add(30, omvgtk.update_drawing)
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user