88from .mserial import Serial
99from .mserial import SerialManagerWrapper
1010from .galvo import Galvo
11- from .config import config
1211from .ledmatrix import LedMatrix
1312from .motor import Motor
1413from .gripper import Gripper
@@ -39,11 +38,11 @@ class UC2Client(object):
3938
4039 is_wifi = False
4140 is_serial = False
41+ BAUDRATE = 115200
4242
43- # BAUDRATE = 500000
44- BAUDRATE = 500000
45-
46- def __init__ (self , host = None , port = 31950 , serialport = None , identity = "UC2_Feather" , baudrate = BAUDRATE , NLeds = 64 , SerialManager = None , DEBUG = False , logger = None , skipFirmwareCheck = False ):
43+ def __init__ (self , host = None , port = 31950 , serialport = None , identity = "UC2_Feather" , baudrate = BAUDRATE ,
44+ NLeds = 64 , SerialManager = None , DEBUG = False , logger = None , skipFirmwareCheck = False ,
45+ isPyScript = False ):
4746 '''
4847 This client connects to the UC2-REST microcontroller that can be found here
4948 https://github.com/openUC2/UC2-REST
@@ -61,7 +60,7 @@ def __init__(self, host=None, port=31950, serialport=None, identity="UC2_Feather
6160 self .logger = logger
6261
6362 # perhaps we are in the browser?
64- self .isPyScript = False
63+ self .isPyScript = isPyScript
6564
6665 # initialize communication channel (# connect to wifi or usb)
6766 if serialport is not None :
@@ -89,18 +88,9 @@ def __init__(self, host=None, port=31950, serialport=None, identity="UC2_Feather
8988
9089 # import libraries depending on API version
9190 self .logger .debug ("Using API version 2" )
92-
93- #FIXME
94- #self.set_state(debug=False)
95-
91+
9692 # initialize state
9793 self .state = State (self )
98- if not self .isPyScript :
99- state = self .state .get_state ()
100-
101- # initialize config
102- if not self .isPyScript :
103- self .config = config (self )
10494
10595 # initialize cmdRecorder
10696 self .cmdRecorder = cmdRecorder (self )
@@ -149,13 +139,6 @@ def __init__(self, host=None, port=31950, serialport=None, identity="UC2_Feather
149139
150140 # initialize messaging
151141 self .message = Message (self )
152-
153- # initialize config
154- if False : # not self.isPyScript:
155- self .config = config (self )
156- try : self .pinConfig = self .config .loadConfigDevice ()
157- except : self .pinConfig = None
158-
159142
160143 # initialize module controller
161144 self .modules = Modules (parent = self )
0 commit comments