Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1e577a6

Browse files
committed
leveloffset update
1 parent09cbf95 commit1e577a6

File tree

2 files changed

+91
-13
lines changed

2 files changed

+91
-13
lines changed

‎README.md‎

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ Quick Link Table:
15721572
*`get_bulk_data()`
15731573
***CLI Wrapper Usage:**
15741574
***Notes:**
1575-
All numbers are binary coded 2 bytes little endian. The pixel data is encoded as 2 bytes per pixel. This is data returned by the device when in AUTO REFRESH mode. NOTE: may need to be paired with a continious buffer read and dump, which will be tested in the next
1575+
All numbers are binary coded 2 bytes little endian. The pixel data is encoded as 2 bytes per pixel. This is data returned by the device when in AUTO REFRESH mode. NOTE: may need to be paired with a continious buffer read and dump, which will be tested in the nextupdate
15761576

15771577

15781578
###**calc**
@@ -1860,12 +1860,34 @@ Quick Link Table:
18601860
###**leveloffset**
18611861
***Description:** Sets or gets the level calibration data
18621862
***Original Usage:**`leveloffset low|high|switch [output] {error}`
1863-
***Direct Library Function Call:**`level_offset()`
1864-
***Example Return:** empty bytearray
1863+
* alternative returned information for format:`leveloffset [low|switch|receive_switch|out_switch|lna|harmonic|shift|shift1|shift2|shift3|drive1|drive2|drive3|direct|direct_lna|ultra|ultra_lna|harmonic_lna|adf] {output} [-20..+20]`
1864+
***Direct Library Function Call:**`level_offset(val=low|switch|receive_switch|out_switch|lna|harmonic|shift|shift1|shift2|shift3|drive1|drive2|drive3|direct|direct_lna|ultra|ultra_lna|harmonic_lna|adf, offset=[-20.0...20.0], isOutput=True|False)`
1865+
*`isOutput` boolean variable determines if the 'output' argument is included in the statement. See examples below.
1866+
***Example Return:**
1867+
*`leveloffset`, with no arguments
1868+
* output:`bytearray(b'-8.462500e+01 0.000000000 ... \r\n-8.128125e+01 0.000000000 \r')`
1869+
*`leveloffset low -3.0`
1870+
* output:`bytearray(b'')`
1871+
*`leveloffset low output 0.0`
1872+
* output:`bytearray(b'')`
18651873
***Alias Functions:**
18661874
* None
18671875
***CLI Wrapper Usage:**
1868-
***Notes:** TODO. error checking needed
1876+
***Notes:**
1877+
* NOT ALL COMBINATIONS ARE VALID.
1878+
* Calibration tables:
1879+
*`low` - Low frequency mode corrections
1880+
*`switch` - Switch-related corrections
1881+
*`receive_switch` - Receive switch corrections
1882+
*`out_switch` - Output switch corrections
1883+
*`lna` - LNA (Low Noise Amplifier) corrections
1884+
*`harmonic` - Harmonic mode corrections
1885+
*`shift/shift1/shift2/shift3` - Frequency shift corrections
1886+
*`drive1/drive2/drive3` - Drive level corrections
1887+
*`direct/direct_lna` - Direct mode corrections
1888+
*`ultra/ultra_lna` - Ultra mode corrections
1889+
*`harmonic_lna` - Harmonic mode with LNA corrections
1890+
*`adf` - ADF (frequency synthesizer) corrections
18691891

18701892
###**line**
18711893
***Description:** Disables the horizontal line or sets it to a specific level.
@@ -2277,12 +2299,12 @@ Marker levels will use the selected unit Marker peak will activate the marker (i
22772299
*`run_sweep(start=FREQ, stop=FREQ, pts=INT)`
22782300
***CLI Wrapper Usage:**
22792301
***Notes:** sweep without arguments lists the current sweep settings, the frequencies specified should be within the permissible range. The sweep commands apply both to input and output modes. MAX PTS is device dependent; 290 for tinySA Basic and 450 for tinySA Ultra and newer
2280-
* sweep start {frequency}: sets the start frequency of the sweep.
2281-
* sweep stop {frequency}: sets the stop frequency of the sweep.
2282-
* sweep center {frequency}: sets the center frequency of the sweep.
2283-
* sweep span {frequency}: sets the span of the sweep.
2284-
* sweep cw {frequency}: sets the continuous wave frequency (zero span sweep).
2285-
* sweep {start(Hz)} {stop(Hz)}[0..MAX PTS]: sets the start and stop frequencies, and optionally the number of points in the sweep
2302+
*`sweep start {integer}`: sets the start frequency of the sweep.
2303+
*`sweep stop {integer}`: sets the stop frequency of the sweep.
2304+
*`sweep center {integer}`: sets the center frequency of the sweep.
2305+
*`sweep span {integer}`: sets the span of the sweep.
2306+
*`sweep cw {integer}`: sets the continuous wave frequency (zero span sweep).
2307+
*`sweep {start(Hz)} {stop(Hz)} [0..MAX PTS]`: sets the start and stop frequencies, and optionally the number of points in the sweep
22862308

22872309

22882310
###**sweeptime**

‎tsapython/src/tsapython/core.py‎

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ def set_level_change(self, val):
10301030
returnself.level_change(val)
10311031

10321032

1033-
deflevel_offset(self):
1033+
deflevel_offset(self,val,offset,isOutput=False):
10341034
# sets or dumps the level calibration data.
10351035
# For the output corrections first ensure correct output
10361036
# levels at maximum output level.
@@ -1042,7 +1042,63 @@ def level_offset(self):
10421042
# error = measured level - specified level
10431043

10441044

1045-
# usage: leveloffset low|high|switch [output] {error}
1045+
# usage: leveloffset [low|switch|receive_switch|out_switch|lna|
1046+
# harmonic|shift|shift1|shift2|shift3|drive1|drive2|drive3|
1047+
# direct|direct_lna|ultra|ultra_lna|harmonic_lna|adf]
1048+
# {output} [-20..+20]
1049+
1050+
1051+
#NOTE: there's probably some limitations on which of these take the 'output' command,
1052+
# but that error checking isn't done here YET
1053+
1054+
#explicitly allowed vals
1055+
accepted_vals= ["low","switch","receive_switch","out_switch","lna",
1056+
"harmonic","shift","shift1","shift2","shift3",
1057+
"drive1","drive2","drive3","direct","direct_lna",
1058+
"ultra","ultra_lna","harmonic_lna","adf"]
1059+
#check input
1060+
if (valinaccepted_vals):
1061+
if (-20.0<=offset<=20.0):
1062+
ifisOutput==True:
1063+
# success message
1064+
writebyte='leveloffset '+str(val)+' output '+str(float(offset))+'\r\n'
1065+
msgbytes=self.tinySA_serial(writebyte,printBool=False)
1066+
self.print_message("leveloffset() set to "+str(val)+" output "+str(offset))
1067+
1068+
1069+
elifisOutput==False:
1070+
# success message
1071+
writebyte='leveloffset '+str(val)+' '+str(float(offset))+'\r\n'
1072+
msgbytes=self.tinySA_serial(writebyte,printBool=False)
1073+
self.print_message("leveloffset() set to "+str(val)+" "+str(offset))
1074+
1075+
else:
1076+
# just for the error check when bulking this function out
1077+
self.print_message("ERROR: leveloffset() value isOutput is a Boolean")
1078+
self.print_message("ERROR: value set to"+str(isOutput))
1079+
msgbytes=self.error_byte_return()
1080+
returnmsgbytes
1081+
1082+
1083+
else:
1084+
self.print_message("ERROR: leveloffset() takes offset vals as floats [-20.0 - 20.0]")
1085+
self.print_message("ERROR: value set to"+str(offset))
1086+
msgbytes=self.error_byte_return()
1087+
1088+
1089+
else:
1090+
self.print_message("ERROR: leveloffset() takes value arguments low|switch|receive_switch|out_switch|lna|" \
1091+
"harmonic|shift|shift1|shift2|shift3|drive1|drive2|drive3|direct|" \
1092+
"direct_lna|ultra|ultra_lna|harmonic_lna|adf, ans specificed output and level")
1093+
self.print_message("ERROR: value set to"+str(val))
1094+
msgbytes=self.error_byte_return()
1095+
returnmsgbytes
1096+
1097+
1098+
1099+
1100+
1101+
10461102
msgbytes=self.error_byte_return()
10471103
self.print_message("Function does not exist yet. error checking needed")
10481104
returnNone
@@ -2246,8 +2302,8 @@ def tinySA_help(self):
22462302
tsa.set_error_byte_return(True)#get explicit b'ERROR'
22472303
msg=tsa.get_device_id()
22482304
print(msg)
2249-
22502305

2306+
22512307
tsa.disconnect()
22522308
else:
22532309
print("ERROR: could not connect to port")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp