openbci-archive / OpenBCI_NodeJS

Node.js SDK for the all OpenBCI Biosensor Boards
https://www.npmjs.com/package/openbci
138 stars 50 forks source link

simulator sample rate optionally parameter doesn't work #25

Closed andrewheusser closed 8 years ago

andrewheusser commented 8 years ago

I think the issue is here. when you make the new openbciSimulator object, the simulatorSampleRate never makes it into the object, so its just set to the default 250

OpenBCIBoard.prototype.connect = function(portName) {
        this.connected = false;

        return new Promise((resolve,reject) => {
            // If we are simulating, set boardSerial to fake name
            var boardSerial;
            /* istanbul ignore else */
            if (this.options.simulate || portName === k.OBCISimulatorPortName) {
                this.options.simulate = true;
                if (this.options.verbose) console.log('using faux board ' + portName);
                boardSerial = new openBCISimulator.OpenBCISimulator(portName, {
                    verbose: this.options.verbose
                });
            } else {
                /* istanbul ignore if */
                if (this.options.verbose) console.log('using real board ' + portName);
                boardSerial = new serialPort.SerialPort(portName, {
                    baudRate: this.options.baudRate
                },(err) => {
                    if (err) reject(err);
                });
            }
andrewheusser commented 8 years ago

when I manually set it, it does the job:

                boardSerial = new openBCISimulator.OpenBCISimulator(portName, {
                    verbose: this.options.verbose,
                    samplerate: 20
                });
andrewjaykeller commented 8 years ago

ok good problem solving @andyh616 looks like an easy fix, let's keep this issue open and see if we can get this impedance testing working with this update too, i think so minor tweaks on that as well might need to happen.

andrewjaykeller commented 8 years ago

Fixed. Will be solved in 0.2.1