*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 866f00f0 authored by Schabbauer, Johannes's avatar Schabbauer, Johannes
Browse files

Updated TimeBase worker for command necessary to update parameters in Sweep mode.

parent adfcbfb4
No related branches found
No related tags found
1 merge request!3Change activating Sweep mode after reply from TimeBase
......@@ -33,25 +33,18 @@ class TimeBaseWorker(Worker):
with h5py.File(h5file,"r") as file:
group = file[f"devices/{device_name}"]
for channel in group:
any_changed = False
for attr,value in group[channel].attrs.items():
if self.smart_cache[channel].get(attr) != group[channel].attrs[attr] or fresh:
# Disable sweep mode, if it was in use.
# This is necessary is update the sweep mode parameters.
if self.smart_cache[channel].get("Sswpm") != 0:
print(f"Programming {channel}, Sswpm=0")
self.client.send(f"{channel}|Sswpm:0\r\n".encode())
self.smart_cache[channel]["Sswpm"] = 0
time.sleep(0.01)
if attr == "Sswpm":
# Skip sweep mode, becasue I want to enable it only after
# setting all other values
continue
any_changed = True
print(f"Programming {channel}, {attr}")
self.client.send(f"{channel}|{attr}:{value:.0f}\r\n".encode())
self.smart_cache[channel][attr] = group[channel].attrs[attr]
time.sleep(0.01) # TODO: What's the best time here? Do we need to wait at all? According to the DIM-3000 manual the rate is 10 commands per second, it seems router can also handle faster times?
# Program actual value of sweep mode
if group[channel].attrs["Sswpm"] != 0:
if group[channel].attrs["Sswpm"] != 0 and any_changed:
# Set the value of sweep mode (again)
# This has to be done after changing any of the sweep parameters.
# For simplicity I do that if any parameter was programmed.
print(f"Programming {channel}, Sswpm")
self.client.send(f"{channel}|Sswpm:{group[channel].attrs['Sswpm']}\r\n".encode())
self.smart_cache[channel]["Sswpm"] = {group[channel].attrs['Sswpm']}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment