updated drivers and added pi version of abbflow
This commit is contained in:
@@ -180,8 +180,59 @@ class start(threading.Thread, deviceBase):
|
||||
self.sendtodbDev(1, 'public_ip_address', test_public_ip, 0, 'multisensor')
|
||||
self.public_ip_address = test_public_ip
|
||||
|
||||
|
||||
def multisensor_addcalibrationpoint(self, name, value):
|
||||
"""Add a calibration point to the calibration table"""
|
||||
# value = {"input": int, "height": float, "volume": float}
|
||||
value = value.replace("'", '"')
|
||||
parsed = json.loads(value)
|
||||
try:
|
||||
# parse json values, throw an error if one is missing
|
||||
input_number = int(parsed['input'])
|
||||
height = float(parsed['height'])
|
||||
volume = float(parsed['volume'])
|
||||
# write values to the tags
|
||||
write_height = write_tag(PLC_IP_ADDRESS, "input{}_cmd.inpCalLevel".format(input_number), height, plc_type="Micro800")
|
||||
#time.sleep(2)
|
||||
write_volume= write_tag(PLC_IP_ADDRESS, "input{}_cmd.inpCalVolume".format(input_number), volume, plc_type="Micro800")
|
||||
#time.sleep(2)
|
||||
if write_height and write_volume:
|
||||
write_cmd = write_tag(PLC_IP_ADDRESS, "input{}_cmd.cmdInsertCalPoint".format(input_number), 1, plc_type="Micro800")
|
||||
#time.sleep(2)
|
||||
if write_cmd:
|
||||
read_val = read_tag(PLC_IP_ADDRESS, "input{}.insertSuccess", plc_type="Micro800")
|
||||
if read_val[0] == 1:
|
||||
self.read_pond_calibration(pond_number)
|
||||
return True
|
||||
return "Wrote everything successfully, but delete didn't succeed (Check pond and point values)."
|
||||
return "Didn't write delete command correctly."
|
||||
return "Didn't write pond or point correctly."
|
||||
except KeyError as e:
|
||||
return "Couldn't parse input value: {} -- {}".format(value, e)
|
||||
|
||||
def multisensor_deletecalibrationpoint(self, name, value):
|
||||
"""Delete a calibration point from a calibration table"""
|
||||
# {"input": int, "point": int}
|
||||
value = value.replace("'", '"')
|
||||
parsed = json.loads(value)
|
||||
try:
|
||||
input_number = int(parsed['input'])
|
||||
point_number = int(parsed['point'])
|
||||
write_point = write_tag(PLC_IP_ADDRESS, "input{}_cmd.inpDeleteIndex".format(input_number), point_number, plc_type="Micro800")
|
||||
#time.sleep(2)
|
||||
if write_point:
|
||||
write_cmd = write_tag(PLC_IP_ADDRESS, "input{}_cmd.cmdDeleteCalPoint".format(input_number), 1, plc_type="Micro800")
|
||||
#time.sleep(2)
|
||||
if write_cmd:
|
||||
read_val = read_tag(PLC_IP_ADDRESS, "input{}.deleteSuccess", plc_type="Micro800")
|
||||
if read_val[0] == 1:
|
||||
self.read_pond_calibration(pond_number)
|
||||
return True
|
||||
return "Wrote everything successfully, but delete didn't succeed (Check input and point values)."
|
||||
return "Didn't write delete command correctly."
|
||||
return "Didn't write input or point correctly."
|
||||
except KeyError as e:
|
||||
return "Couldn't parse input value: {} -- {}".format(value, e)
|
||||
|
||||
|
||||
def multisensor_sync(self, name, value):
|
||||
"""Sync all data from the driver."""
|
||||
|
||||
Reference in New Issue
Block a user