Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b60e68197 | |||
| 6efc5e1097 | |||
| a23394d3d1 | |||
| c96f76f438 | |||
| f0f1c9fc49 | |||
| 512c80af40 | |||
| 499964b287 | |||
| 16f12d40bf | |||
| 63c1ba8efb | |||
| 4a28348db4 | |||
| 64dfe87d05 | |||
| f7a5a867a4 | |||
| 1accaa9b9f | |||
| b810e35fb2 | |||
| 82c9d2b0e3 | |||
| e5a3f33b9f | |||
| 1dd4ae2ce4 |
@@ -1,5 +1,7 @@
|
||||
.DS_Store
|
||||
*.cpython-37.opt-2.pyc
|
||||
*.cpython-39-arm-linux-gnueabihf.so
|
||||
*.
|
||||
*.pyc
|
||||
*/__pycache__
|
||||
/.vscode
|
||||
|
||||
@@ -1578,10 +1578,13 @@ class ControlAPI(metaclass=Router):
|
||||
raise NotImplementedError()
|
||||
|
||||
def run_project(self, project) -> bool:
|
||||
print('create_project', project)
|
||||
self._project_manager.create(project)
|
||||
return False
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_running_project(self) -> bool:
|
||||
raise NotImplementedError()
|
||||
|
||||
def stop_project(self, project) -> bool:
|
||||
raise NotImplementedError()
|
||||
|
||||
# noinspection PyAbstractClass
|
||||
class ControlClient(SocketClient, ControlAPI, metaclass=SocketClientMacro(ControlAPI)):
|
||||
|
||||
@@ -881,12 +881,17 @@ class I4V4Z4T4DataDecoder(RecDataDecoder):
|
||||
def decode(self, data: bytes) -> Optional[RecordingData]:
|
||||
if len(data) < 18:
|
||||
return None
|
||||
|
||||
voltage = 0
|
||||
mem_cnt = data[1]
|
||||
time_stamp: float = struct.unpack('<I', data[4:8])[0] # unit: ms 0x18030000
|
||||
current = struct.unpack('<i', data[8:12])[0] # unit: nA
|
||||
voltage = struct.unpack('<i', data[12:16])[0] # unit: uV
|
||||
ch2 = struct.unpack('<i', data[12:16])[0] # unit: uV
|
||||
impedance = struct.unpack('<i', data[16:20])[0] # unit: mOm
|
||||
if self._mode == 16:
|
||||
voltage = impedance - ch2
|
||||
else:
|
||||
voltage = ch2
|
||||
|
||||
cycle_number = struct.unpack('<H', data[20:22])[0]
|
||||
finish_mode_falg = data[22]
|
||||
battery = struct.unpack('<i', data[23:27])[0]
|
||||
@@ -945,18 +950,18 @@ class I4V4Z4T4DataDecoder(RecDataDecoder):
|
||||
ret.append_data(1, voltage)
|
||||
ret.append_data(2, impedance)
|
||||
ret.append_data(3, cycle_number)
|
||||
ret.append_data(4, battery)
|
||||
ret.append_data(5, elite_notify_times)
|
||||
ret.append_data(6, mem_cnt)
|
||||
# ret.append_data(4, battery)
|
||||
# ret.append_data(5, elite_notify_times)
|
||||
# ret.append_data(6, mem_cnt)
|
||||
|
||||
# memoryboard information
|
||||
ret.append_data(7, ram_num)
|
||||
ret.append_data(8, broken_flag)
|
||||
try:
|
||||
ret.append_data(9, mem_wrong_information)
|
||||
# print('append_data success, mem_wrong_information:', mem_wrong_information, hex(mem_wrong_information))
|
||||
except:
|
||||
print('append_data fail, mem_wrong_information:', mem_wrong_information, hex(mem_wrong_information))
|
||||
# # memoryboard information
|
||||
# ret.append_data(7, ram_num)
|
||||
# ret.append_data(8, broken_flag)
|
||||
# try:
|
||||
# ret.append_data(9, mem_wrong_information)
|
||||
# # print('append_data success, mem_wrong_information:', mem_wrong_information, hex(mem_wrong_information))
|
||||
# except:
|
||||
# print('append_data fail, mem_wrong_information:', mem_wrong_information, hex(mem_wrong_information))
|
||||
|
||||
|
||||
|
||||
@@ -1396,39 +1401,33 @@ class EISZeroOneDataDecoder(RecDataDecoder):
|
||||
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
|
||||
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
|
||||
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
|
||||
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
|
||||
|
||||
#Lv[1] 20k
|
||||
index = 80
|
||||
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
|
||||
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
|
||||
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
|
||||
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
|
||||
|
||||
#Lv[2] 5k
|
||||
index = 100
|
||||
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
|
||||
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
|
||||
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
|
||||
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
|
||||
|
||||
#Lv[3] 200R
|
||||
index = 120
|
||||
hsrtia_a.append(struct.unpack('>i', cali_coeff[index+1:index+5])[0]/1e8)
|
||||
hsrtia_b.append(struct.unpack('>i', cali_coeff[index+5:index+9])[0]/1e8)
|
||||
hsrtia_c.append(struct.unpack('>i', cali_coeff[index+9:index+13])[0]/1e4)
|
||||
hsrtia_d.append(struct.unpack('>B', cali_coeff[index+13:index+14])[0])
|
||||
|
||||
# hsrtia_a.append(struct.unpack('>I', cali_coeff[index+1:index+5])[0])
|
||||
# hsrtia_b.append(struct.unpack('>I', cali_coeff[index+5:index+9])[0]/1e6)
|
||||
# hsrtia_c.append(struct.unpack('>I', cali_coeff[index+9:index+13])[0]/1e5)
|
||||
# hsrtia_d.append(struct.unpack('>I', cali_coeff[index+13:index+17])[0]/1e6)
|
||||
|
||||
# print('cutoff_freq', cutoff_freq)
|
||||
# print('hsrtia_a', hsrtia_a)
|
||||
# print('hsrtia_b', hsrtia_b)
|
||||
# print('hsrtia_c', hsrtia_c)
|
||||
# print('hsrtia_d', hsrtia_d)
|
||||
# print('phase_para_a', phase_para_a)
|
||||
# print('phase_para_b', phase_para_b)
|
||||
|
||||
@@ -1585,10 +1584,10 @@ class EISZeroOneDataDecoder(RecDataDecoder):
|
||||
|
||||
ret = RecordingData(self.device, int(time_stamp * 1000 / 2), 0)
|
||||
if (self._mode == 0): #EIS Mode
|
||||
ret.append_data(3, cycle_number)
|
||||
ret.append_data(0, ch1) #Raw Imag
|
||||
ret.append_data(1, ch2) #Raw Real
|
||||
ret.append_data(2, ch3 * 10) #Frequency [mHz]
|
||||
ret.append_data(3, cycle_number)
|
||||
ret.append_data(4, round(imag_after_cal)) #Z_imag [Ohm]
|
||||
ret.append_data(5, round(real_after_cal)) #Z_real [Ohm]
|
||||
ret.append_data(6, round(impedance)) #Impedance [Ohm]
|
||||
@@ -1597,10 +1596,10 @@ class EISZeroOneDataDecoder(RecDataDecoder):
|
||||
ret.append_data(9, gain) #Gain Level
|
||||
|
||||
else: #CV Mode
|
||||
ret.append_data(3, cycle_number)
|
||||
ret.append_data(0, ch1) #Iin [nA]
|
||||
ret.append_data(1, ch2) #Vset [nV]
|
||||
ret.append_data(2, ch3) #Vout [nV]
|
||||
ret.append_data(3, cycle_number)
|
||||
|
||||
if cycle_number != self._cycle_number:
|
||||
# notify cycle_number change
|
||||
|
||||
@@ -653,15 +653,9 @@ class DeviceInstruction:
|
||||
|
||||
VIS_CC_ZERO = 0x40
|
||||
|
||||
VIS_ASK = 0x30
|
||||
"""ask in virtual instruction"""
|
||||
|
||||
VIS_STI = 0xC0
|
||||
"""stimulation on virtual instruction"""
|
||||
|
||||
VIS_FUH = 0x90
|
||||
"""flush virtual instruction"""
|
||||
|
||||
VIS_INT = 0x60
|
||||
"""interrupt virtual instruction"""
|
||||
|
||||
@@ -750,8 +744,6 @@ class DeviceCommonInstruction:
|
||||
return '_sync(False)', '_notify(False)', 'VIS_INT'
|
||||
elif instruction == cls.CLOSE:
|
||||
return '_sync(False)', '_notify(False)', 'VIS_INT'
|
||||
elif instruction == cls.FLUSH:
|
||||
return 'VIS_FUH',
|
||||
elif instruction == cls.CALL:
|
||||
return 'VIS_CAL',
|
||||
elif instruction == cls.VIS_DEVICE_DETECT:
|
||||
|
||||
@@ -1012,6 +1012,10 @@ class CompletedDevice(Device):
|
||||
def device_id(self) -> int:
|
||||
return self._device_id
|
||||
|
||||
@property
|
||||
def memory_board(self) -> int:
|
||||
return self._device_id
|
||||
|
||||
@property
|
||||
def device_name(self) -> str:
|
||||
return self._device.device_name
|
||||
@@ -1274,15 +1278,20 @@ class CompletedDevice(Device):
|
||||
|
||||
def as_json(self) -> JSON_OBJECT:
|
||||
return {
|
||||
'id': self.device_id,
|
||||
'name': self.device_name,
|
||||
'status': self._status,
|
||||
'device_id': self.device_id,
|
||||
'device_name': self.device_name,
|
||||
'device_address': list(self.mac_address),
|
||||
'device_status': self._status,
|
||||
'mac_address': self.mac_address_in_str,
|
||||
'memory_board': self.memory_board,
|
||||
'serial_number': self.serial_number.as_json(),
|
||||
'version': self.device_version,
|
||||
'battery': self.battery,
|
||||
'parent': self.parent,
|
||||
'recording_file_name': self.recording_file_name,
|
||||
'device_version': self.device_version,
|
||||
'serial_number': self.serial_number.as_json(),
|
||||
'library_name': self._library.name,
|
||||
'library_version': str(self._library.version),
|
||||
'configuration': self.configuration.as_json(list_hide=True),
|
||||
|
||||
@@ -76,6 +76,8 @@ class MultiExtMemSpiInterface(LowLevelHardwareInterface):
|
||||
|
||||
def set_pin_mem_req(self, value: bool):
|
||||
channel = self.select
|
||||
# if self._pin_mem_req_value[channel] == value:
|
||||
# print('last_req_sig[channel] == value', channel, self._pin_mem_req_value[channel], value, datetime.now())
|
||||
self.pin_mem_req.output(value)
|
||||
self._pin_mem_req_value[channel] = value
|
||||
|
||||
|
||||
@@ -118,13 +118,13 @@ class Selector:
|
||||
self._p2.output(p[2])
|
||||
|
||||
# if (value == 4 and self._last_sel != 6):
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel)
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel, datetime.now())
|
||||
# elif (value == 5 and self._last_sel != 4):
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel)
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel, datetime.now())
|
||||
# elif (value == 7 and self._last_sel != 5):
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel)
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel, datetime.now())
|
||||
# elif (value == 6 and self._last_sel != 7):
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel)
|
||||
# print('mem_sel is not use gray code, value:', value, ', last value:', self._last_sel, datetime.now())
|
||||
|
||||
self._last_sel = value
|
||||
|
||||
|
||||
@@ -29,16 +29,18 @@ class Project(threading.Thread):
|
||||
self._end_time = None
|
||||
|
||||
self._id = None
|
||||
self._uuid = uuid4()
|
||||
self._uuid = str(uuid4())
|
||||
self._name = None
|
||||
self._desc = None
|
||||
self._device = None
|
||||
self._complete_device = []
|
||||
self._status = None
|
||||
self._status = 0
|
||||
|
||||
self._instruction_set = Instruction()
|
||||
self._stop_flag = False
|
||||
|
||||
self._task_manager = None
|
||||
|
||||
self.setup_project(project)
|
||||
self.setup_device(self._device)
|
||||
|
||||
@@ -49,6 +51,8 @@ class Project(threading.Thread):
|
||||
|
||||
if key == 'task':
|
||||
self._task_manager = TaskManager(project['task'])
|
||||
elif key == 'uuid':
|
||||
pass
|
||||
else:
|
||||
setattr(self, key, value)
|
||||
|
||||
@@ -107,17 +111,17 @@ class Project(threading.Thread):
|
||||
|
||||
@property
|
||||
def task_list(self):
|
||||
return self.task_manager.task_list
|
||||
return self._task_manager.export_task_list
|
||||
|
||||
|
||||
@property
|
||||
def mqtt_thread(self):
|
||||
return self._mqtt_thread
|
||||
|
||||
def run(self):
|
||||
self._status = 1
|
||||
self._start_time = time()
|
||||
|
||||
self.mqtt_thread.broadcast_command('project:' + self._name + ' start_at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
|
||||
self.mqtt_thread.broadcast_command('project:' + self._name + ' start at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
|
||||
|
||||
while not self._stop_flag :
|
||||
# check running task first
|
||||
delay_time = 0
|
||||
@@ -165,7 +169,6 @@ class Project(threading.Thread):
|
||||
|
||||
# check project done then close project
|
||||
if self.check_project_done() == True:
|
||||
self.mqtt_thread.broadcast_command('project:project ' + str(self._name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
|
||||
print('project stop at', datetime.now())
|
||||
self.close()
|
||||
|
||||
@@ -176,9 +179,19 @@ class Project(threading.Thread):
|
||||
# TODO
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
def stop(self):
|
||||
self._task_manager.running_task.stop()
|
||||
self.mqtt_thread.broadcast_command('project:task ' + str(self._task_manager.running_task.name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
|
||||
self._status = 2
|
||||
self._end_time = time()
|
||||
self._stop_flag = True
|
||||
self.mqtt_thread.broadcast_command('project:project ' + str(self._name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
|
||||
|
||||
def close(self):
|
||||
self._status = 2
|
||||
self._end_time = time()
|
||||
self._stop_flag = True
|
||||
self.mqtt_thread.broadcast_command('project:project ' + str(self._name) + ' stop at ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-3])
|
||||
|
||||
def check_project_done(self):
|
||||
for task in self._task_manager.task_list:
|
||||
@@ -191,19 +204,21 @@ class Project(threading.Thread):
|
||||
# if no running task
|
||||
if self._task_manager.running_task == None:
|
||||
return False
|
||||
device_list = self._task_manager.running_task.device
|
||||
for device in device_list:
|
||||
|
||||
for device in self._task_manager.running_task.device:
|
||||
if self._complete_device[device].status == 1:
|
||||
return False
|
||||
return True
|
||||
|
||||
def as_json(self):
|
||||
return {
|
||||
data = {
|
||||
'id': self._id,
|
||||
'name': self._name,
|
||||
'uuid': self._uuid,
|
||||
'desc': self._desc,
|
||||
'status': self._status,
|
||||
'device': self._device,
|
||||
'task_list': self.task_list,
|
||||
'task': self.task_list,
|
||||
'running_task': self._task_manager.running_task.as_json()
|
||||
}
|
||||
return data
|
||||
|
||||
@@ -23,11 +23,17 @@ class ProjectManager():
|
||||
self._project_list[index].stop()
|
||||
del self._project_list[index]
|
||||
|
||||
def get(self):
|
||||
return self._project_list
|
||||
def get(self, project_uuid = None):
|
||||
if project_uuid == None:
|
||||
return self._project_list
|
||||
else:
|
||||
for project in self._project_list:
|
||||
if project.uuid == project_uuid:
|
||||
return project
|
||||
|
||||
def run(self, project):
|
||||
def run_project(self, project):
|
||||
project.start()
|
||||
|
||||
def stop(self, project):
|
||||
project.stop()
|
||||
def stop_project(self, project):
|
||||
_project = self.get(project)
|
||||
_project.stop()
|
||||
|
||||
@@ -28,6 +28,10 @@ class TaskManager():
|
||||
def task_list(self):
|
||||
return self._task_list
|
||||
|
||||
@property
|
||||
def export_task_list(self):
|
||||
return [d.as_json() for d in self._task_list]
|
||||
|
||||
@property
|
||||
def prev_task(self):
|
||||
return self._prev_task
|
||||
|
||||
@@ -117,6 +117,9 @@ class DataServer(SocketServer, DataAPI):
|
||||
self.database_process = DataBaseProcess('data_server', self.log_verbose, self._queue_db, self._queue_ds_dict, self._queue_msg)
|
||||
self.database_process.start()
|
||||
|
||||
# self._no_data_total_duration = 0
|
||||
# self._recv_memory_cost_time = 0
|
||||
|
||||
@logging_info
|
||||
def setup(self):
|
||||
self._available_channel.clear()
|
||||
@@ -666,7 +669,17 @@ class DataServer(SocketServer, DataAPI):
|
||||
print("q size= ", self._configurations[device]._queue_rec.qsize())
|
||||
|
||||
self._configurations[device].put_rec_queue(data)
|
||||
# self._no_data_total_duration = 0
|
||||
ret = True
|
||||
# else:
|
||||
# time_diff = time() - self._recv_memory_cost_time
|
||||
# self._no_data_total_duration += time_diff
|
||||
# if self._no_data_total_duration > 1:
|
||||
# print('data is None', device, datetime.now(), self._no_data_total_duration)
|
||||
# print("sync.get_pin_mem_req() != sync.get_pin_ram_sel()")
|
||||
# print("no~", sync.select, sync.get_pin_mem_req(), sync.get_pin_ram_sel(), datetime.now())
|
||||
# print()
|
||||
# self._recv_memory_cost_time = time()
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
@@ -1014,9 +1014,20 @@ class ControlServer(SocketServer, ControlServerAPI):
|
||||
|
||||
@logging_info
|
||||
def run_project(self, project) -> bool:
|
||||
project = self._project_manager.create(project)
|
||||
self._project_manager.run(project)
|
||||
return False
|
||||
if project is not None:
|
||||
project = self._project_manager.create(project)
|
||||
self._project_manager.run_project(project)
|
||||
return project.as_json()
|
||||
|
||||
@logging_info
|
||||
def stop_project(self, project) -> bool:
|
||||
if project is not None:
|
||||
self._project_manager.stop_project(project)
|
||||
return True
|
||||
|
||||
@logging_info
|
||||
def get_running_project(self) -> bool:
|
||||
return self._project_manager.get()
|
||||
|
||||
@logging_info
|
||||
def device_internal_command(self, device: int, oper: str, value: Any) -> bool:
|
||||
|
||||
@@ -105,6 +105,9 @@ class RecordingProcess(Process):
|
||||
self._mem_tailer_len = 6
|
||||
self._single_data_len = self._elite_data_len + self._mem_header_len + self._mem_tailer_len
|
||||
|
||||
self._decoder = self.data_format()
|
||||
self._start_time = time()
|
||||
|
||||
def ensure_data_format(self) -> DataDecodeFormat:
|
||||
if isinstance(self._data_format, (str, bytes)):
|
||||
self._data_format = DataDecodeFormat.parse(self._data_format)
|
||||
@@ -133,9 +136,9 @@ class RecordingProcess(Process):
|
||||
decoder._prev_data = self._prev_data
|
||||
decoder._prev_delta_time = self._prev_delta_time
|
||||
decoder._prev_time_stamp = self._prev_time_stamp
|
||||
# elif isinstance(decoder, I4V4Z4T4DataDecoder):
|
||||
elif isinstance(decoder, I4V4Z4T4DataDecoder):
|
||||
# get cycle_time from meta file
|
||||
# decoder._mode = self._meta_file.configuration.MODE
|
||||
decoder._mode = self._meta_file.configuration.get_parameter('MODE')
|
||||
# decoder._cycle_start_time = self._cycle_start_time
|
||||
elif isinstance(decoder, NeuliveThreeOneDataDecoder):
|
||||
# get amp_gain from meta file
|
||||
@@ -151,9 +154,8 @@ class RecordingProcess(Process):
|
||||
decoder._prev_time_stamp = self._prev_time_stamp
|
||||
elif isinstance(decoder, EISZeroOneDataDecoder):
|
||||
# get amp_gain from meta file
|
||||
|
||||
decoder._ac_amp = self._meta_file.configuration.get_parameter('AC_AMP')
|
||||
decoder._mode = self._meta_file.configuration.get_parameter('MODE')
|
||||
decoder._ac_amp = self._meta_file.configuration.get_parameter('AC_AMP')
|
||||
decoder._freq_start = self._meta_file.configuration.get_parameter('FREQ_START')
|
||||
decoder._freq_stop = self._meta_file.configuration.get_parameter('FREQ_STOP')
|
||||
|
||||
@@ -200,14 +202,13 @@ class RecordingProcess(Process):
|
||||
self._isTimeOut = True
|
||||
self._timer = current_time
|
||||
|
||||
decoder = self.data_format()
|
||||
# print('sync_data')
|
||||
# print('data',data)
|
||||
|
||||
# print('server/data', self._prev_delta_time,self._prev_time_stamp, self._prev_data)
|
||||
|
||||
if data is None or len(data) == 0:
|
||||
result = decoder.decode(b'')
|
||||
result = self._decoder.decode(b'')
|
||||
if result is not None:
|
||||
ret = result
|
||||
|
||||
@@ -221,7 +222,7 @@ class RecordingProcess(Process):
|
||||
for offset, section in self._foreach_data_section(data):
|
||||
# for section in self._neu_foreach_data_section(data):
|
||||
|
||||
result = decoder.decode(section)
|
||||
result = self._decoder.decode(section)
|
||||
# if self._isTimeOut:
|
||||
# try:
|
||||
# print('result: ', result.data_size)
|
||||
@@ -229,9 +230,15 @@ class RecordingProcess(Process):
|
||||
# pass
|
||||
|
||||
try:
|
||||
if isinstance(decoder, I4V4Z4T4DataDecoder) or isinstance(decoder, EISZeroOneDataDecoder):
|
||||
if decoder.isFinishMode is not None and decoder.isFinishMode() == 1:
|
||||
time_duration = self._meta_file.configuration.get_parameter('TIME_DURATION')
|
||||
if time_duration and time_duration is not 0 and time() - self._start_time >= time_duration:
|
||||
self._queue_msg.put(['ds', self._device, 'interrupt'])
|
||||
return None
|
||||
|
||||
if isinstance(self._decoder, I4V4Z4T4DataDecoder) or isinstance(self._decoder, EISZeroOneDataDecoder):
|
||||
if self._decoder.isFinishMode is not None and self._decoder.isFinishMode() == 1:
|
||||
self._queue_msg.put(['ds', self._device, 'interrupt'])
|
||||
return None
|
||||
# content = {}
|
||||
# content['header'] = 'device_instruction/0'
|
||||
# content['device'] = result.device
|
||||
@@ -297,8 +304,8 @@ class RecordingProcess(Process):
|
||||
self._last_cnt[7] = head_counter - 1
|
||||
last_data_cnt = self._last_cnt[7]
|
||||
|
||||
# dont save to section when head or id is wrong
|
||||
if (head != 255 or device_id != device):
|
||||
# dont save to section when head or id is wrong
|
||||
if (head != 255 or device_id != device or head_counter > 255 or head_counter < 0):
|
||||
save = False
|
||||
last_data_cnt = last_data_cnt + 1
|
||||
|
||||
@@ -349,13 +356,14 @@ class RecordingProcess(Process):
|
||||
|
||||
if colum_total == 1:
|
||||
print('this ram data < 3 records, colum_total = ', colum_total)
|
||||
print('raw_data[0]', raw_data[0])
|
||||
return save
|
||||
print('raw_data[0]', list(raw_data[0]))
|
||||
save = True
|
||||
# return save
|
||||
|
||||
elif colum_total == 2:
|
||||
print('this ram data < 3 records, colum_total = ', colum_total)
|
||||
print('raw_data[0]', raw_data[0])
|
||||
print('raw_data[1]', raw_data[1])
|
||||
print('raw_data[0]', list(raw_data[0]))
|
||||
print('raw_data[1]', list(raw_data[1]))
|
||||
if (raw_data[col + 1][1] - raw_data[col][1] == 1) or (raw_data[col][1] == 255 and raw_data[col + 1][1] == 0):
|
||||
save = True
|
||||
|
||||
|
||||
@@ -11,9 +11,21 @@
|
||||
"constant": {
|
||||
"FREQ_MAX": 4294967296,
|
||||
"VOLT_MAX": 65536,
|
||||
"BLE_WRITE_MAX": 255
|
||||
"BLE_WRITE_MAX": 255,
|
||||
"TIME_MAX": 100000
|
||||
},
|
||||
"parameters": {
|
||||
"TIME_DURATION": {
|
||||
"description": "Run duration",
|
||||
"record_meta": true,
|
||||
"initial": 0,
|
||||
"domain": [
|
||||
"TIME_MAX"
|
||||
],
|
||||
"value": {
|
||||
"expression": "VALUE"
|
||||
}
|
||||
},
|
||||
"CHANNEL": {
|
||||
"derzteription": "record channels",
|
||||
"record_meta": true,
|
||||
@@ -48,9 +60,9 @@
|
||||
"description": "working mode",
|
||||
"record_meta": true,
|
||||
"value": [
|
||||
"EIS CURVE",
|
||||
"Cyclic Voltammetry",
|
||||
"Dev Mode"
|
||||
"EIS CURVE",
|
||||
"Cyclic Voltammetry",
|
||||
"Dev Mode"
|
||||
]
|
||||
},
|
||||
"FREQ_START": {
|
||||
@@ -58,10 +70,10 @@
|
||||
"record_meta": true,
|
||||
"initial": 13422819,
|
||||
"domain": [
|
||||
"FREQ_MAX"
|
||||
"FREQ_MAX"
|
||||
],
|
||||
"value": {
|
||||
"expression": "VALUE"
|
||||
"expression": "VALUE"
|
||||
}
|
||||
},
|
||||
"FREQ_STOP": {
|
||||
@@ -69,10 +81,10 @@
|
||||
"record_meta": true,
|
||||
"initial": 7,
|
||||
"domain": [
|
||||
"FREQ_MAX"
|
||||
"FREQ_MAX"
|
||||
],
|
||||
"value": {
|
||||
"expression": "VALUE"
|
||||
"expression": "VALUE"
|
||||
}
|
||||
},
|
||||
"DELAY": {
|
||||
@@ -91,21 +103,21 @@
|
||||
"record_meta": true,
|
||||
"initial": 8,
|
||||
"value": [
|
||||
2,
|
||||
4,
|
||||
8,
|
||||
16
|
||||
2,
|
||||
4,
|
||||
8,
|
||||
16
|
||||
]
|
||||
},
|
||||
"DC_BIAS": {
|
||||
"description": "DC voltage bias in mV",
|
||||
"record_meta": true,
|
||||
"initial": 15000,
|
||||
"initial": 25000,
|
||||
"domain": [
|
||||
35001
|
||||
"VOLT_MAX"
|
||||
],
|
||||
"value": {
|
||||
"expression": "VALUE"
|
||||
"expression": "VALUE"
|
||||
}
|
||||
},
|
||||
"AC_AMP": {
|
||||
@@ -113,7 +125,7 @@
|
||||
"record_meta": true,
|
||||
"initial": 25,
|
||||
"domain": [
|
||||
2048
|
||||
2048
|
||||
]
|
||||
},
|
||||
"SCALE": {
|
||||
@@ -121,8 +133,8 @@
|
||||
"record_meta": true,
|
||||
"initial": 0,
|
||||
"value": [
|
||||
0,
|
||||
1
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
"PPD": {
|
||||
@@ -130,7 +142,7 @@
|
||||
"record_meta": true,
|
||||
"initial": 10,
|
||||
"domain": [
|
||||
11
|
||||
11
|
||||
]
|
||||
},
|
||||
"RTIA": {
|
||||
@@ -138,11 +150,11 @@
|
||||
"record_meta": true,
|
||||
"initial": 4,
|
||||
"value": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
]
|
||||
},
|
||||
"ADC_VALUE_I": {
|
||||
@@ -154,10 +166,10 @@
|
||||
"record_meta": true,
|
||||
"initial": 10000,
|
||||
"domain": [
|
||||
100001
|
||||
100001
|
||||
],
|
||||
"value": {
|
||||
"expression": "VALUE"
|
||||
"expression": "VALUE"
|
||||
}
|
||||
},
|
||||
"CTRL_HIGH_Z_15": {
|
||||
@@ -242,9 +254,9 @@
|
||||
"BLE_WRITE": {
|
||||
"description": "send msg to elite",
|
||||
"domain": {
|
||||
"list": [
|
||||
"list": [
|
||||
"BLE_WRITE_MAX"
|
||||
]
|
||||
]
|
||||
},
|
||||
"initial": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",
|
||||
"value": "VALUE"
|
||||
@@ -254,12 +266,13 @@
|
||||
"domain": "int"
|
||||
}
|
||||
},
|
||||
|
||||
"instruction": {
|
||||
"start": [
|
||||
{
|
||||
"expression": "MODE",
|
||||
"when": {
|
||||
"*": "start_data"
|
||||
"*": "start_data"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -430,4 +443,4 @@
|
||||
"_cdr('20X>ADC_VALUE_I')"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
"minor_version_number": 6
|
||||
},
|
||||
"constant": {
|
||||
"TIME_MAX": 100000,
|
||||
"VOLT_MAX": 65536,
|
||||
"Const_Current_Range": 1500001,
|
||||
"BLE_WRITE_MAX": 255
|
||||
@@ -17,7 +18,7 @@
|
||||
"DPV_e_init": {
|
||||
"description": "DPV initial voltage ",
|
||||
"record_meta": true,
|
||||
"initial":20000,
|
||||
"initial": 20000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -28,7 +29,7 @@
|
||||
"DPV_e_final": {
|
||||
"description": "DPV final voltage",
|
||||
"record_meta": true,
|
||||
"initial":30000,
|
||||
"initial": 30000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -39,7 +40,7 @@
|
||||
"DPV_e_1": {
|
||||
"description": "DPV voltage return 1",
|
||||
"record_meta": true,
|
||||
"initial":35000,
|
||||
"initial": 35000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -50,7 +51,7 @@
|
||||
"DPV_e_2": {
|
||||
"description": "DPV voltage return 2",
|
||||
"record_meta": true,
|
||||
"initial":15000,
|
||||
"initial": 15000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -61,7 +62,7 @@
|
||||
"DPV_amp": {
|
||||
"description": "DPV pulse amplitude",
|
||||
"record_meta": true,
|
||||
"initial":25125,
|
||||
"initial": 25125,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -72,7 +73,7 @@
|
||||
"DPV_pul_width": {
|
||||
"description": "DPV pulse width",
|
||||
"record_meta": true,
|
||||
"initial":50,
|
||||
"initial": 50,
|
||||
"domain": [
|
||||
1000001
|
||||
],
|
||||
@@ -83,7 +84,7 @@
|
||||
"DPV_increment": {
|
||||
"description": "DPV increment",
|
||||
"record_meta": true,
|
||||
"initial":25025,
|
||||
"initial": 25025,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -94,7 +95,7 @@
|
||||
"DPV_step_time": {
|
||||
"description": "DPV step time = time of one period",
|
||||
"record_meta": true,
|
||||
"initial":500,
|
||||
"initial": 500,
|
||||
"domain": [
|
||||
1000001
|
||||
],
|
||||
@@ -105,7 +106,7 @@
|
||||
"DPV_notify_rate": {
|
||||
"description": "DPV sample rate",
|
||||
"record_meta": true,
|
||||
"initial":1000,
|
||||
"initial": 1000,
|
||||
"domain": [
|
||||
1001
|
||||
],
|
||||
@@ -116,7 +117,7 @@
|
||||
"DPV_curr_rec_min": {
|
||||
"description": "DPV current recording period start",
|
||||
"record_meta": true,
|
||||
"initial":25,
|
||||
"initial": 25,
|
||||
"domain": [
|
||||
101
|
||||
],
|
||||
@@ -127,7 +128,7 @@
|
||||
"DPV_curr_rec_max": {
|
||||
"description": "DPV current recording period end",
|
||||
"record_meta": true,
|
||||
"initial":100,
|
||||
"initial": 100,
|
||||
"domain": [
|
||||
101
|
||||
],
|
||||
@@ -166,7 +167,7 @@
|
||||
"V_initial_0": {
|
||||
"description": "Pulse Mode Segment Voltage 0",
|
||||
"record_meta": true,
|
||||
"initial":50000,
|
||||
"initial": 50000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -177,7 +178,7 @@
|
||||
"V_initial_1": {
|
||||
"description": "Pulse Mode Segment Voltage 1",
|
||||
"record_meta": true,
|
||||
"initial":25000,
|
||||
"initial": 25000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -188,7 +189,7 @@
|
||||
"V_initial_2": {
|
||||
"description": "Pulse Mode Segment Voltage 2",
|
||||
"record_meta": true,
|
||||
"initial":25000,
|
||||
"initial": 25000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -199,7 +200,7 @@
|
||||
"V_initial_3": {
|
||||
"description": "Pulse Mode Segment Voltage 3",
|
||||
"record_meta": true,
|
||||
"initial":25000,
|
||||
"initial": 25000,
|
||||
"domain": [
|
||||
50001
|
||||
],
|
||||
@@ -210,7 +211,7 @@
|
||||
"t_pulse_0": {
|
||||
"description": "Pulse Mode Segment Duration 0",
|
||||
"record_meta": true,
|
||||
"initial":750,
|
||||
"initial": 750,
|
||||
"domain": [
|
||||
1000001
|
||||
],
|
||||
@@ -221,7 +222,7 @@
|
||||
"t_pulse_1": {
|
||||
"description": "Pulse Mode Segment Duration 1",
|
||||
"record_meta": true,
|
||||
"initial":9250,
|
||||
"initial": 9250,
|
||||
"domain": [
|
||||
1000001
|
||||
],
|
||||
@@ -232,7 +233,7 @@
|
||||
"t_pulse_2": {
|
||||
"description": "Pulse Mode Segment Duration 2",
|
||||
"record_meta": true,
|
||||
"initial":1000,
|
||||
"initial": 1000,
|
||||
"domain": [
|
||||
1000001
|
||||
],
|
||||
@@ -243,7 +244,7 @@
|
||||
"t_pulse_3": {
|
||||
"description": "Pulse Mode Segment Duration 3",
|
||||
"record_meta": true,
|
||||
"initial":1000,
|
||||
"initial": 1000,
|
||||
"domain": [
|
||||
1000001
|
||||
],
|
||||
@@ -254,7 +255,7 @@
|
||||
"CURR_REC_START_0": {
|
||||
"description": "Pulse Mode Current Recording Period Start",
|
||||
"record_meta": true,
|
||||
"initial":35,
|
||||
"initial": 35,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -265,7 +266,7 @@
|
||||
"CURR_REC_START_1": {
|
||||
"description": "Pulse Mode Current Recording Period Start",
|
||||
"record_meta": true,
|
||||
"initial":35,
|
||||
"initial": 35,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -276,7 +277,7 @@
|
||||
"CURR_REC_START_2": {
|
||||
"description": "Pulse Mode Current Recording Period Start",
|
||||
"record_meta": true,
|
||||
"initial":35,
|
||||
"initial": 35,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -287,7 +288,7 @@
|
||||
"CURR_REC_START_3": {
|
||||
"description": "Pulse Mode Current Recording Period Start",
|
||||
"record_meta": true,
|
||||
"initial":35,
|
||||
"initial": 35,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -298,7 +299,7 @@
|
||||
"CURR_REC_END_0": {
|
||||
"description": "Pulse Mode Current Recording Period End",
|
||||
"record_meta": true,
|
||||
"initial":90,
|
||||
"initial": 90,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -309,7 +310,7 @@
|
||||
"CURR_REC_END_1": {
|
||||
"description": "Pulse Mode Current Recording Period End",
|
||||
"record_meta": true,
|
||||
"initial":99,
|
||||
"initial": 99,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -320,7 +321,7 @@
|
||||
"CURR_REC_END_2": {
|
||||
"description": "Pulse Mode Current Recording Period End",
|
||||
"record_meta": true,
|
||||
"initial":95,
|
||||
"initial": 95,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -331,7 +332,7 @@
|
||||
"CURR_REC_END_3": {
|
||||
"description": "Pulse Mode Current Recording Period End",
|
||||
"record_meta": true,
|
||||
"initial":95,
|
||||
"initial": 95,
|
||||
"domain": [
|
||||
100
|
||||
],
|
||||
@@ -478,13 +479,14 @@
|
||||
"Constant Current",
|
||||
"Cyclic Voltammetry",
|
||||
"Linear Sweep Voltammetry",
|
||||
"Chronoamperometric Graph",
|
||||
"Chronoamperometric",
|
||||
"Cali DAC - test",
|
||||
"Cali ADC - test",
|
||||
"Dev Mode",
|
||||
"Open Circuit Potential",
|
||||
"Pulse Sensing",
|
||||
"Differential Pulse Voltammetry (DPV)"
|
||||
"Differential Pulse Voltammetry (DPV)",
|
||||
"Chronopotentiometry"
|
||||
]
|
||||
},
|
||||
"VOLT_ORIGIN": {
|
||||
@@ -644,7 +646,7 @@
|
||||
},
|
||||
"CURRNET_LIMIT_VALUE": {
|
||||
"description": "Current value Setting",
|
||||
"initial":1500000,
|
||||
"initial": 1500000,
|
||||
"domain": [
|
||||
"Const_Current_Range"
|
||||
],
|
||||
@@ -685,6 +687,15 @@
|
||||
"expression": "VALUE"
|
||||
}
|
||||
},
|
||||
"CC_CP_SPEED": {
|
||||
"description": "charge speed for CC and CP mode",
|
||||
"initial": 1,
|
||||
"value": [
|
||||
"low",
|
||||
"normal",
|
||||
"high"
|
||||
]
|
||||
},
|
||||
"ADC_LEVEL_I_15": {
|
||||
"description": "ADC level",
|
||||
"record_meta": true,
|
||||
@@ -762,6 +773,17 @@
|
||||
"s",
|
||||
"ms"
|
||||
]
|
||||
},
|
||||
"TIME_DURATION": {
|
||||
"description": "Run duration",
|
||||
"record_meta": true,
|
||||
"initial": 0,
|
||||
"domain": [
|
||||
"TIME_MAX"
|
||||
],
|
||||
"value": {
|
||||
"expression": "VALUE"
|
||||
}
|
||||
}
|
||||
},
|
||||
"instruction": {
|
||||
@@ -812,7 +834,8 @@
|
||||
"7": "set_adc_gain_I",
|
||||
"8": "set_adc_gain_I",
|
||||
"9": "set_adc_gain_I",
|
||||
"13": "set_adc_gain_I"
|
||||
"13": "set_adc_gain_I",
|
||||
"16": "set_adc_gain_I"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -827,7 +850,8 @@
|
||||
"7": "set_adc_gain_Vin",
|
||||
"8": "set_adc_gain_Vin",
|
||||
"9": "set_adc_gain_Vin",
|
||||
"13": "set_adc_gain_Vin"
|
||||
"13": "set_adc_gain_Vin",
|
||||
"16": "set_adc_gain_Vin"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -845,7 +869,8 @@
|
||||
"9": "curve_const_vscan",
|
||||
"13": "curve_ocp",
|
||||
"14": "curve_pulse_sensing",
|
||||
"15": "curve_dpv"
|
||||
"15": "curve_dpv",
|
||||
"16": "curve_cp"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1043,6 +1068,7 @@
|
||||
"vb": "Const_Current_value",
|
||||
"vc": "VOLTSTOP_MAX",
|
||||
"vd": "VOLTSTOP_MIN",
|
||||
"ve": "CC_CP_SPEED",
|
||||
"pa": "ADC_LEVEL_I_15",
|
||||
"pb": "ADC_LEVEL_V_IN_15",
|
||||
"pc": "DAC_LEVEL_V_OUT_15",
|
||||
@@ -1054,7 +1080,31 @@
|
||||
"B>va;4B>vb;2B>vc;2B>vd;",
|
||||
"4b>pa;4b>pb;",
|
||||
"4b>pc;4b>pd;",
|
||||
"2B>pe"
|
||||
"2B>pe;",
|
||||
"4b>0b0001;4b>ve"
|
||||
]
|
||||
},
|
||||
"curve_cp": {
|
||||
"type": "RIS",
|
||||
"parameter": {
|
||||
"va": "Charge",
|
||||
"vb": "Const_Current_value",
|
||||
"vc": "VOLTSTOP_MAX",
|
||||
"vd": "VOLTSTOP_MIN",
|
||||
"ve": "CC_CP_SPEED",
|
||||
"pa": "ADC_LEVEL_I_15",
|
||||
"pb": "ADC_LEVEL_V_IN_15",
|
||||
"pc": "DAC_LEVEL_V_OUT_15",
|
||||
"pd": "CTRL_HIGH_Z_15",
|
||||
"pe": "SAMPLE_RATE"
|
||||
},
|
||||
"data": [
|
||||
"X07;",
|
||||
"B>va;4B>vb;2B>vc;2B>vd;",
|
||||
"4b>pa;4b>pb;",
|
||||
"4b>pc;4b>pd;",
|
||||
"2B>pe;",
|
||||
"4b>0b0000;4b>ve"
|
||||
]
|
||||
},
|
||||
"curve_cv3": {
|
||||
@@ -1313,9 +1363,7 @@
|
||||
"2B>va;4B>vb;1B>vc;1B>vd;1B>ve"
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
"curve_dpv":[
|
||||
"curve_dpv": [
|
||||
{
|
||||
"expression": "DPV_mode",
|
||||
"when": {
|
||||
@@ -1388,9 +1436,6 @@
|
||||
"4b>pc;4b>pd"
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
"dpv_advanced_mode": [
|
||||
"dpv_advanced_mode_ins_1",
|
||||
"dpv_advanced_mode_ins_2",
|
||||
@@ -1484,8 +1529,6 @@
|
||||
"dpv_engineering_mode_advanced": [
|
||||
"dpv_advanced_mode"
|
||||
],
|
||||
|
||||
|
||||
"VIS_CC_ZERO": [
|
||||
"_data_format('I4V4Z4T4')",
|
||||
"_disable_cache(False)",
|
||||
@@ -1526,6 +1569,4 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
find /home/pi -maxdepth 1 -type f -iname '*.out' -mtime +30 -delete
|
||||
Reference in New Issue
Block a user