diff --git a/muselsl/muse.py b/muselsl/muse.py index 3eb47fc..71bd726 100644 --- a/muselsl/muse.py +++ b/muselsl/muse.py @@ -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 @@ -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: @@ -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() @@ -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() @@ -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')