add webui
This commit is contained in:
16
Plotter.py
16
Plotter.py
@@ -1,12 +1,20 @@
|
||||
from __future__ import division
|
||||
import serial
|
||||
|
||||
try:
|
||||
from config import plotter_port, plotter_baudrate, plotter_timeout, plotter_center_at_origin
|
||||
except ImportError:
|
||||
plotter_port = lambda: '/dev/ttyUSB0'
|
||||
plotter_baudrate = lambda: 9600
|
||||
plotter_timeout = lambda: 15
|
||||
plotter_center_at_origin = lambda: False
|
||||
|
||||
|
||||
class Plotter:
|
||||
|
||||
def __init__(self, boundaries=None):
|
||||
self.boundaries = boundaries
|
||||
self.p0incenter = False
|
||||
self.p0incenter = plotter_center_at_origin()
|
||||
if not boundaries:
|
||||
s = self.getoutput(b'OW;')
|
||||
print(s)
|
||||
@@ -17,7 +25,11 @@ class Plotter:
|
||||
|
||||
def getoutput(self, outstr):
|
||||
try:
|
||||
self.ser = serial.Serial('/dev/ttyUSB0', timeout=15)
|
||||
self.ser = serial.Serial(
|
||||
plotter_port(),
|
||||
baudrate=plotter_baudrate(),
|
||||
timeout=plotter_timeout()
|
||||
)
|
||||
print('try to get Status')
|
||||
if not self.ser:
|
||||
print('Plotter not available')
|
||||
|
||||
Reference in New Issue
Block a user