Organization, order, User.py usability
Esse commit está contido em:
+1
-1
@@ -103,7 +103,7 @@ User serial interface enabled...
|
||||
Connecting to /dev/ttyUSB0
|
||||
Serial established...
|
||||
View command map at http://docs.openbci.com.
|
||||
Type start to run. Type exit to exit.
|
||||
Type start to run. Type /exit to exit.
|
||||
|
||||
-->
|
||||
OpenBCI V3 8bit Board
|
||||
|
||||
+2
-4
@@ -68,7 +68,7 @@ class OpenBCIBoard(object):
|
||||
if not port:
|
||||
raise OSError('Cannot find OpenBCI port')
|
||||
|
||||
print("Conencting to board through port: %s" %(port))
|
||||
print("Conencting to %s" %(port))
|
||||
self.ser = serial.Serial(port, baud)
|
||||
print("Serial established...")
|
||||
|
||||
@@ -140,7 +140,7 @@ class OpenBCIBoard(object):
|
||||
print("Warning: %s" % text)
|
||||
|
||||
def stop(self):
|
||||
self.warn("Stopping streaming...")
|
||||
self.warn("Stopping streaming...\nWait for buffer to flush...")
|
||||
self.streaming = False
|
||||
self.ser.write('s')
|
||||
|
||||
@@ -251,7 +251,6 @@ class OpenBCIBoard(object):
|
||||
#Wait for device to send data
|
||||
time.sleep(0.5)
|
||||
if self.ser.inWaiting():
|
||||
print("-------------------")
|
||||
line = ''
|
||||
c = ''
|
||||
#Look for end sequence $$$
|
||||
@@ -259,7 +258,6 @@ class OpenBCIBoard(object):
|
||||
c = self.ser.read()
|
||||
line += c
|
||||
print(line);
|
||||
print("-------------------\n")
|
||||
|
||||
def print_register_settings(self):
|
||||
self.ser.write('?')
|
||||
|
||||
+15
-6
@@ -4,19 +4,28 @@ from yapsy.IPlugin import IPlugin
|
||||
class PluginPrint(IPlugin):
|
||||
# args: passed by command line
|
||||
def activate(self, args):
|
||||
print "I'm activated"
|
||||
print "Print activated"
|
||||
# tell outside world that init went good
|
||||
return True
|
||||
|
||||
def deactivate(self):
|
||||
print "Goodbye"
|
||||
print "Print Deactivated"
|
||||
|
||||
def show_help(self):
|
||||
print "I do not need any parameter, just printing stuff."
|
||||
|
||||
# called with each new sample
|
||||
def __call__(self, sample):
|
||||
print "----------------"
|
||||
print("%f" %(sample.id))
|
||||
print sample.channel_data
|
||||
print sample.aux_data
|
||||
sample_string = "ID: %f\n%s\n%s" %(sample.id, str(sample.channel_data)[1:-1], str(sample.aux_data)[1:-1])
|
||||
print "---------------------------------"
|
||||
print sample_string
|
||||
print "---------------------------------"
|
||||
|
||||
# DEBBUGING
|
||||
# try:
|
||||
# sample_string.decode('ascii')
|
||||
# except UnicodeDecodeError:
|
||||
# print "Not a ascii-encoded unicode string"
|
||||
# else:
|
||||
# print sample_string
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário