GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit fa732039 authored by bliss administrator's avatar bliss administrator

Added forcemeter and its counter

parent 57d7dd38
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2017 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.comm.util import get_comm_type, get_comm, SERIAL
from bliss.comm.serial import SerialTimeout
from bliss.comm.util import get_comm
from bliss.common.counter import SamplingCounter, SamplingMode
from bliss.controllers.counter import SamplingCounterController
import time
class ForceMeter(SamplingCounterController):
def __init__(self,name,config):
super().__init__(name)
opt = {"baudrate": 19200, "eol": b"\r"}
self._cnx = get_comm(config, ctype=SERIAL, **opt)
for counter_conf in config.get("counters", list()):
cname = counter_conf["counter_name"]
counter = self.create_counter(
SamplingCounter, cname, mode=SamplingMode.SINGLE
)
def read(self, counter):
self._cnx.flush()
#clear = b"\001" * 63
#self._cnx.write(clear)
ret = self._cnx.readline()
#print (ret)
ret = self._cnx.readline()
#print (ret)
value = float(ret[3:10])
#print (f"force value = {value}")
return value
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment