Skip to content

Commit 24881e7

Browse files
committed
fixed a typo in hop()
1 parent 5d7f9ae commit 24881e7

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/tinySA_python.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def actual_freq(self, val=None):
415415
#get the dac
416416
writebyte = 'actual_freq\r\n'
417417
msgbytes = self.tinySA_serial(writebyte, printBool=False)
418-
elif (isinstance(val, int)) and (self.minSADeviceFreq <= val <=self.maxSADeviceFreq ):
418+
elif (isinstance(val, (int, float))) and (self.minSADeviceFreq <= val <=self.maxSADeviceFreq ):
419419
writebyte = 'actual_freq '+str(val)+'\r\n'
420420
msgbytes = self.tinySA_serial(writebyte, printBool=False)
421421
self.print_message("actual_freq set to " + str(val))
@@ -712,7 +712,7 @@ def dac(self, val=None):
712712
#get the dac
713713
writebyte = 'dac\r\n'
714714
msgbytes = self.tinySA_serial(writebyte, printBool=False)
715-
elif (isinstance(val, int)) and (0<= val <=4095):
715+
elif (isinstance(val, (int, float))) and (0<= val <=4095):
716716
writebyte = 'dac '+str(val)+'\r\n'
717717
msgbytes = self.tinySA_serial(writebyte, printBool=False)
718718
self.print_message("dac set to " + str(val))
@@ -833,7 +833,7 @@ def ext_gain(self, val):
833833
# example return: ''
834834

835835
#check input
836-
if (isinstance(val, int)) and (-100<= val <=100):
836+
if (isinstance(val, (int, float))) and (-100<= val <=100):
837837
writebyte = 'ext_gain '+str(val)+'\r\n'
838838
msgbytes = self.tinySA_serial(writebyte, printBool=False)
839839
self.print_message("ext_gain() set to " + str(val))
@@ -869,7 +869,7 @@ def freq(self, val):
869869
# example return: bytearray(b'')
870870

871871
#check input
872-
if (isinstance(val, int)) and (self.minSADeviceFreq<= val <=self.maxSADeviceFreq):
872+
if (isinstance(val, (int, float))) and (self.minSADeviceFreq<= val <=self.maxSADeviceFreq):
873873
writebyte = 'freq '+str(val)+'\r\n'
874874
msgbytes = self.tinySA_serial(writebyte, printBool=False)
875875
self.print_message("freq() set to " + str(val))
@@ -918,14 +918,12 @@ def hop(self, start, stop, inc, outmask=None):
918918
# outmask: 1 is frequency, 2 is level
919919
# example return: ''
920920

921-
if (isinstance(start, int)) and (isinstance(stop, int)) and (isinstance(inc, int)):
921+
if (isinstance(start, (int, float))) and (isinstance(stop, (int, float))) and (isinstance(inc, (int, float))):
922922
if (isinstance(outmask, int)) and (0<outmask<3):
923-
writebyte = 'hop ' + str(start) + ' ' + str(stop)
924-
+ ' ' + str(inc) + ' ' + str(outmask) + '\r\n'
923+
writebyte = 'hop ' + str(start) + ' ' + str(stop) + ' ' + str(inc) + ' ' + str(outmask) + '\r\n'
925924

926925
elif outmask ==None:
927-
writebyte = 'hop ' + str(start) + ' ' + str(stop)
928-
+ ' ' + str(inc) + '\r\n'
926+
writebyte = 'hop ' + str(start) + ' ' + str(stop) + ' ' + str(inc) + '\r\n'
929927

930928
msgbytes = self.tinySA_serial(writebyte, printBool=False)
931929
self.print_message("sampling over frequency range")
@@ -1065,7 +1063,7 @@ def line(self, val):
10651063
writebyte = 'line '+str(val)+'\r\n'
10661064
msgbytes = self.tinySA_serial(writebyte, printBool=False)
10671065
self.print_message("horizontal line turned off")
1068-
elif (isinstance(val, int)) or (isinstance(val, float)):
1066+
elif (isinstance(val, (int, float))): # or (isinstance(val, float)):
10691067
writebyte = 'line '+str(val)+'\r\n'
10701068
msgbytes = self.tinySA_serial(writebyte, printBool=False)
10711069
self.print_message("horizontal line turned off")
@@ -1171,7 +1169,7 @@ def marker(self, ID, val):
11711169
writebyte = 'marker ' + str(ID) + ' ' +str(val)+'\r\n'
11721170
msgbytes = self.tinySA_serial(writebyte, printBool=False)
11731171
self.print_message("marker set to " + str(val))
1174-
elif (isinstance(val, int)) or (isinstance(val, float)):
1172+
elif (isinstance(val, (int, float))): # or (isinstance(val, float)):
11751173
writebyte = 'marker ' + str(ID) + ' ' +str(val)+'\r\n'
11761174
msgbytes = self.tinySA_serial(writebyte, printBool=False)
11771175
self.print_message("marker set to " + str(val))
@@ -2109,7 +2107,7 @@ def vbat_offset(self, val=None):
21092107
#get the offset
21102108
writebyte = 'vbat_offset\r\n'
21112109
msgbytes = self.tinySA_serial(writebyte, printBool=False)
2112-
elif (isinstance(val, int)) and (0<= val <=4095):
2110+
elif (isinstance(val, (int, float))) and (0<= val <=4095):
21132111
writebyte = 'vbat_offset '+str(val)+'\r\n'
21142112
msgbytes = self.tinySA_serial(writebyte, printBool=False)
21152113
self.print_message("vbat_offset set to " + str(val))

0 commit comments

Comments
 (0)