2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-26 03:38:25 +08:00

simple: refactor RPC client set_dataset

This commit is contained in:
Simon Renblad 2023-07-12 10:33:22 +08:00 committed by Sébastien Bourdeauducq
parent 16a3ce274f
commit d1f2727126

View File

@ -49,8 +49,15 @@ class AppletControlRPC:
self.background_tasks.add(task)
task.add_done_callback(self.background_tasks.discard)
def set_dataset(self, key, value, persist=None):
self._background(self.dataset_ctl.set, key, value, persist)
def set_dataset(self, key, value, unit=None, scale=None, precision=None, persist=None):
metadata = {}
if unit is not None:
metadata["unit"] = unit
if scale is not None:
metadata["scale"] = scale
if precision is not None:
metadata["precision"] = precision
self._background(self.dataset_ctl.set, key, value, metadata=metadata, persist=persist)
def mutate_dataset(self, key, index, value):
mod = {"action": "setitem", "path": [key, 1], "key": index, "value": value}