numat / alicat

Python driver and command line tool for Alicat mass flow controllers.
GNU General Public License v2.0
21 stars 27 forks source link

Inlet Controller Raises an exception on "set_flow_rate" #1

Closed jpsiegfried closed 9 years ago

jpsiegfried commented 9 years ago
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-7885e597e1f4> in <module>()
     19 
     20 # Close everything up
---> 21 inlet_controller.set_flow_rate(0.0)
     22 outlet_controller.set_flow_rate(0.0)
     23 inlet_controller.close()

/usr/local/lib/python2.7/dist-packages/alicat/__init__.pyc in set_flow_rate(self, flow)
     84         self.connection.write(command)
     85         line = self.ser.readline()
---> 86         if not line or abs(float(line) - flow) > 0.01:
     87             raise Exception("Could not set flow. Is your controller in "
     88                             "serial mode?")

ValueError: could not convert string to float: A +059.30 +024.48 +000.12 +000.50 000.50      N2 
jpsiegfried commented 9 years ago

This error is negated when the variable inlet_controller is initialized right before set_flow_rate is called inlet_controller = FlowController("/dev/ttyUSB0")

patrickfuller commented 9 years ago

This should be fixed by 010c5b3f204a420ab4c7f4ed41abf04cbe1ec1ad. Re-open this issue if that's not the case.