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

Enable control by default #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions muselsl/muse.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def __init__(self,
self.name = name
self.callback_eeg = callback_eeg
self.callback_telemetry = callback_telemetry
self.callback_control = callback_control
self.callback_control = callback_control or self._default_control_callback
self.callback_acc = callback_acc
self.callback_gyro = callback_gyro
self.callback_ppg = callback_ppg

self.enable_eeg = not callback_eeg is None
self.enable_control = not callback_control is None
self.enable_control = True # Always enable control
self.enable_telemetry = not callback_telemetry is None
self.enable_acc = not callback_acc is None
self.enable_gyro = not callback_gyro is None
Expand All @@ -66,6 +66,11 @@ def __init__(self,
self.preset = preset
self.disable_light = disable_light

self._init_control()

def _default_control_callback(self, message):
logger.info(f"Control message: {message}")

def connect(self, interface=None, retries=0):
"""Connect to the device"""
try:
Expand Down Expand Up @@ -113,7 +118,7 @@ def connect(self, interface=None, retries=0):

if self.enable_ppg:
self._subscribe_ppg()

if self.disable_light:
self._disable_light()

Expand Down Expand Up @@ -146,7 +151,7 @@ def connect(self, interface=None, retries=0):

if self.enable_ppg:
self._subscribe_ppg()

if self.disable_light:
self._disable_light()

Expand Down Expand Up @@ -608,6 +613,6 @@ def _unpack_ppg_channel(self, packet):
data = res[1:]

return packetIndex, data

def _disable_light(self):
self._write_cmd_str('L0')