Skip to content

Commit

Permalink
docs: Update the example code to show all the input arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nfelt14 committed Oct 31, 2024
1 parent 0bbffac commit f23bf24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions examples/scopes/tekscope/save_screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,31 @@

with DeviceManager(verbose=True) as dm:
# Add a scope
scope: MSO6B = dm.add_scope("192.168.0.1")
scope: MSO6B = dm.add_scope("192.168.1.5")

# Send some commands
scope.add_new_math("MATH1", "CH1") # add MATH1 to CH1
scope.turn_channel_on("CH2") # turn on channel 2
scope.set_and_check(":HORIZONTAL:SCALE", 100e-9) # adjust horizontal scale

# Save a screenshot as a timestamped file, will create a screenshot on the device,
# Save a screenshot as a timestamped file. This will create a screenshot on the device,
# copy it to the current working directory on the local machine,
# and then delete the screenshot file from the device.
scope.save_screenshot()

# Save a screenshot as example.png, will create a screenshot on the device,
# Save a screenshot as "example.png". This will create a screenshot on the device,
# copy it to the current working directory on the local machine,
# and then delete the screenshot file from the device.
scope.save_screenshot("example.png")

# Save a screenshot as example.jpg, will create a screenshot on the device,
# copy it to ./images/example.jpg on the local machine,
# Save a screenshot as "example.jpg". This will create a screenshot on the device
# using INVERTED colors in the "./device_folder" folder,
# copy it to "./images/example.jpg" on the local machine,
# but this time the screenshot file on the device will not be deleted.
scope.save_screenshot("example.jpg", local_folder="./images", keep_device_file=True)
scope.save_screenshot(
"example.jpg",
colors="INVERTED",
local_folder="./images",
device_folder="./device_folder",
keep_device_file=True,
)
2 changes: 1 addition & 1 deletion src/tm_devices/drivers/scopes/tekscope/tekscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ def _save_screenshot(
(local_folder / filename).write_bytes(data)
if not keep_device_file:
self.write(f"FILESYSTEM:DELETE {device_filepath_string}", opc=True)
time.sleep(0.5) # wait to ensure the file is deleted
time.sleep(0.2) # wait to ensure the file is deleted

def _reboot(self) -> None:
"""Reboot the device."""
Expand Down

0 comments on commit f23bf24

Please sign in to comment.