diff --git a/malcolm/modules/pandablocks/controllers/pandamanagercontroller.py b/malcolm/modules/pandablocks/controllers/pandamanagercontroller.py index de9371085..209f9944a 100644 --- a/malcolm/modules/pandablocks/controllers/pandamanagercontroller.py +++ b/malcolm/modules/pandablocks/controllers/pandamanagercontroller.py @@ -1,4 +1,5 @@ import json +import re import time from typing import Any, Dict, Sequence, Set, Tuple @@ -325,6 +326,6 @@ def set_layout(self, value): else: self._json_layout.pop(name, "") if self._json_layout != old_json_layout: - self._client.set_table( - "*METADATA", "LAYOUT", [json.dumps(self._json_layout)] - ) + # Custom encoding so the lines aren't too long and there aren't too many of them + lines = re.split(r'(?<=,) (?!"y")', json.dumps(self._json_layout)) + self._client.set_table("*METADATA", "LAYOUT", lines) diff --git a/tests/test_modules/test_pandablocks/test_pandablocksmanagercontroller.py b/tests/test_modules/test_pandablocks/test_pandablocksmanagercontroller.py index 16b23c23c..9f07536f0 100644 --- a/tests/test_modules/test_pandablocks/test_pandablocksmanagercontroller.py +++ b/tests/test_modules/test_pandablocks/test_pandablocksmanagercontroller.py @@ -269,7 +269,10 @@ def test_layout(self): [ ( "*METADATA.LAYOUT", - '{"COUNTER": {"x": 1.2, "y": 2.3}, "HDF": {"x": 3.5, "y": 4.1}}', + [ + '{"COUNTER": {"x": 1.2, "y": 2.3},', + '"HDF": {"x": 3.5, "y": 4.1}}', + ], ) ] ) @@ -287,8 +290,8 @@ def test_layout(self): "*METADATA", "LAYOUT", [ - '{"COUNTER": {"x": 1.2, "y": 2.3},' - ' "HDF": {"x": 3.5, "y": 4.1},' - ' "TTLIN1": {"x": 0.0, "y": 5.6}}' + '{"COUNTER": {"x": 1.2, "y": 2.3},', + '"HDF": {"x": 3.5, "y": 4.1},', + '"TTLIN1": {"x": 0.0, "y": 5.6}}', ], )