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

Error with Mindwave headset and RF dongle #6

Open
anber500 opened this issue Feb 5, 2014 · 2 comments
Open

Error with Mindwave headset and RF dongle #6

anber500 opened this issue Feb 5, 2014 · 2 comments

Comments

@anber500
Copy link

anber500 commented Feb 5, 2014

I have the Mindset headset with the RF dongle.
I've tested with various scripts including the code snipped from your example.

The headset connects but just after that it receives the following error:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
    self.run()
  File "F:\code\EEG_Python_learning\mindwave.py", line 73, in run
    self.parse_payload(payload)
  File "F:\code\EEG_Python_learning\mindwave.py", line 143, in parse_payload
    raw=ord(value[0])*256+ord(value[1])
IndexError: string index out of range

I can't seem to figure out what the correct value should be and why I'm getting this error.

This happens all the time

@anber500
Copy link
Author

anber500 commented Feb 5, 2014

I were able to "fix" it for now.
I wrapped the code in the parse_payload() method in a try catch. It seems to have worked.

                if code == RAW_VALUE:
                    try:
                        raw=ord(value[0])*256+ord(value[1])
                        if (raw>=32768):
                            raw=raw-65536
                        self.headset.raw_value = raw
                        for handler in self.headset.raw_value_handlers:
                            handler(self.headset, self.headset.raw_value)
                    except IndexError:
                        continue

@qubodup
Copy link

qubodup commented Oct 24, 2015

Thank you very much! I got this error after 1-2 seconds of running the example and the attention/meditation values wouldn't change afterwards.

Now it has been running for a minute and the values still change!

I would like to confirm this fix solves the problem.

My system specs just in case:

Distro (Arch Linux        4.1.10-2-lts x86_64
Mainboard     FOXCONN A7GM-S 2.0
CPU           AMD Phenom(tm) 9550 Quad-Core Processor
              4 x 2200 MHz, 64-bit
RAM           7.8G
Video         Advanced Micro Devices, Inc. [AMD/ATI]
              Cape Verde PRO [Radeon HD 7750/8740 / R7 250E]
OpenGL        4.4.13399 Core Profile Context 15.20.1013, GLSL 4.40
GCC           gcc (GCC) 5.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants