Skip to content

Cannot disable a channel #39

@petewall

Description

@petewall

I'm trying to disable a channel, but adding a call to channelOff causes no samples to show up.

Here's the code that I'm testing with:

const Ganglion = require('openbci-ganglion');
const ganglion = new Ganglion({ debug: true });
ganglion.once('ganglionFound', (peripheral) => {
    ganglion.searchStop();
    ganglion.on('sample', (sample) => {
        console.log(sample.sampleNumber);
        for (let i = 0; i < ganglion.numberOfChannels(); i++) {
            console.log('Channel ' + (i + 1) + ': ' + sample.channelData[i].toFixed(8) + ' Volts.');
        }
    });
    ganglion.once('ready', () => {
        ganglion.channelOff(4);
        ganglion.streamStart();
    });
    ganglion.connect(peripheral);
});
ganglion.searchStart();

Here's the output on stdout:

Debug bytes:
>>>  62                                                |b|
Debug bytes:
>>>  34                                                |4|
Debug bytes:
<<  ce 44 65 61 63 74 69 76  61 74 69 6e 67 20 63 68  |.Deactivating ch|
<<  61 6e 6e 65                                       |anne|
Debug bytes:
<<  cf 6c 20 34 0a                                    |.l 4.|

There are no calls to the sample event handler. If I comment out the ganglion.channelOff(4); line, it behaves normally.

I'm using a MacBook Pro (mid-2015) running Mac OS X 10.13.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions