bicarlsen / easy-biologic

Python library for communicating with Biologic devices.
GNU General Public License v3.0
18 stars 11 forks source link

syntax for setting ElectrodeConnection and set_channel_configuration #13

Closed Cdriko closed 2 years ago

Cdriko commented 2 years ago

Hello I whant to set both Electrode connection to STANDARD and channel 6 hardware configuration to FLOATING, and I'm not sure to understand the syntax. Is the following is good ?

import easy_biologic as ebl

bl = ebl.BiologicDevice( '192.168.1.2' )

bl.set_channel_configuration(5,FLOATING,STANDARD)

thanks

bicarlsen commented 2 years ago

It is best to use the enums easy_biologic.lib.ec_lib.ElectrodeConnection and easy_biologic.lib.ec_lib.ChannelMode for this.

e.g.

from easy_biologic.device import BiologicDevice
from easy_biologic.lib.ec_lib import ChannelMode, ElectrodeConnection

bl = BiologicDevice( '192.168.1.2' )
bl.set_channel_configuration( 5,  ChannelMode.FLOATING, ElectrodeConnection.STANDARD )
Cdriko commented 2 years ago

thanks, I try that but get an error :

  bl.set_channel_configuration( 5,  ChannelMode.GROUNDED , ElectrodeConnection.STANDARD )
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\easy_biologic\device.py", line 263, in set_channel_configuration
    raise RuntimeError( 'Hardware configuration is only available for SP-300 devices.' )
RuntimeError: Hardware configuration is only available for SP-300 devices.

But it's a VSP300 : kind : DeviceCodes.KBIO_DEV_VSP300

bicarlsen commented 2 years ago

As the error says you can only set these parameter on SP-300 devices. This is a limitation of the hardware, not this package.