Skip to content

Commit e7a881e

Browse files
comments
1 parent e0f670b commit e7a881e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

examples/mid_level/example_mid_level_update.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ async def main() -> int:
1717
p1: ChannelPoint = ChannelPoint(200, 20)
1818
p2: ChannelPoint = ChannelPoint(100, 0)
1919
p3: ChannelPoint = ChannelPoint(200, -20)
20-
# channel configuration, we want to ignore first and last two channels
20+
# channel configuration
21+
# we want to ignore first and last two channels (just for demonstration purpose)
2122
# we need to pad list with None to achieve correct indices
2223
# [None, None, ChannelConfig, ChannelConfig, ChannelConfig, ChannelConfig]
2324
channel_config = [MidLevelChannelConfiguration(False, 3, 20, [p1, p2, p3]) for x in range(4)]
@@ -34,9 +35,12 @@ def input_callback(input_value: str) -> bool:
3435
return True
3536
if "1" <= input_value <= "8":
3637
index = int(input_value) - 1
38+
# check if index is in range of channel_config
3739
if 0 <= index < len(channel_config):
3840
cc = channel_config[index]
41+
# check if index contains a ChannelConfiguration object
3942
if cc is not None:
43+
# toggle active
4044
cc.is_active = not cc.is_active
4145
asyncio.run(mid_level.update(channel_config))
4246
else:

0 commit comments

Comments
 (0)