diff --git a/examples/sample_client.py b/examples/sample_client.py index 7602d84..254d2cd 100755 --- a/examples/sample_client.py +++ b/examples/sample_client.py @@ -64,7 +64,7 @@ async def main(args: argparse.Namespace): await sc.start() # receive notifications for 5 seconds - await asyncio.sleep(5) + await asyncio.sleep(args.seconds) # stop the indicate/notify await sc.stop() @@ -90,6 +90,13 @@ async def main(args: argparse.Namespace): help="the mac address to connect to", metavar="", ) + parser.add_argument( + "--seconds", + default=10, + help="seconds to read data", + metavar="", + type=int, + ) args = parser.parse_args() diff --git a/myo/core.py b/myo/core.py index ad6bcb9..a34ef9e 100644 --- a/myo/core.py +++ b/myo/core.py @@ -441,16 +441,15 @@ async def setup( # never sleep await self.set_sleep_mode(SleepMode.NEVER_SLEEP) # setup modes - self.emg_mode = emg_mode - self.imu_mode = imu_mode - self.classifier_mode = classifier_mode - - # enforce the modes when aggregate_all - if self.aggregate_all and ( - self.emg_mode != EMGMode.SEND_FILT or self.imu_mode in (IMUMode.NONE, IMUMode.SEND_EVENTS, IMUMode.SEND_RAW) - ): + if self.aggregate_all: + # enforce the modes when aggregate_all + self.classifier_mode = ClassifierMode.DISABLED self.emg_mode = EMGMode.SEND_FILT - self.imu_mode = IMUMode.SEND_ALL + self.imu_mode = IMUMode.SEND_DATA + else: + self.classifier_mode = classifier_mode + self.emg_mode = emg_mode + self.imu_mode = imu_mode await self.set_mode( classifier_mode=self.classifier_mode,