syntax fixes for channel, read pond calibration data
This commit is contained in:
@@ -6,7 +6,7 @@ import time
|
||||
from random import randint
|
||||
|
||||
from device_base import deviceBase
|
||||
from Channel import PLCChannel, read_tag, write_tag
|
||||
from channel import PLCChannel, read_tag, write_tag
|
||||
from utilities import get_public_ip_address
|
||||
from logger import filelogger
|
||||
|
||||
@@ -127,9 +127,9 @@ class start(threading.Thread, deviceBase):
|
||||
last_read_height = -1.0
|
||||
cal_values = []
|
||||
cal_index = 1
|
||||
while last_read_height != 0 and cal_index <=10:
|
||||
cal_tag_height = "pond{}CalibrationHeight[{}]".format(input_number, cal_index)
|
||||
cal_tag_volume = "pond{}CalibrationVolume[{}]".format(input_number, cal_index)
|
||||
while last_read_height != 0 and cal_index <= 10:
|
||||
cal_tag_height = "input{}.calibrationLevel[{}]".format(input_number, cal_index)
|
||||
cal_tag_volume = "input{}.calibrationVolume[{}]".format(input_number, cal_index)
|
||||
read_height = read_tag(PLC_IP_ADDRESS, cal_tag_height, plc_type="Micro800")
|
||||
time.sleep(2)
|
||||
read_volume = read_tag(PLC_IP_ADDRESS, cal_tag_volume, plc_type="Micro800")
|
||||
@@ -143,7 +143,7 @@ class start(threading.Thread, deviceBase):
|
||||
if cal_values != CALIBRATION_TABLES[input_number] or self.force_send:
|
||||
calibration_channel = "pond{}calibration".format(input_number)
|
||||
calibration_string = json.dumps(cal_values).replace('"', "'")
|
||||
self.sendtodbDev(1, calibration_channel, calibration_string, 0, 'plcpond')
|
||||
self.sendtodbDev(1, calibration_channel, calibration_string, 0, 'multisensor')
|
||||
CALIBRATION_TABLES[input_number] = cal_values
|
||||
|
||||
def _check_watchdog(self):
|
||||
@@ -179,6 +179,7 @@ class start(threading.Thread, deviceBase):
|
||||
def multisensor_sync(self, name, value):
|
||||
"""Sync all data from the driver."""
|
||||
self.force_send = True
|
||||
print("got sync({}, {})".format(name, value))
|
||||
self.sendtodb("log", "synced", 0)
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user