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

Skip to content
Snippets Groups Projects

Change activating Sweep mode after reply from TimeBase

Merged Schabbauer, Johannes requested to merge TimeBase-test into main
2 files
+ 6
15
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -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']}
Loading