Skip to content

Commit dcf7f75

Browse files
nkpro2000srbessman
authored andcommitted
Fix errors
1 parent 3d84a0a commit dcf7f75

File tree

1 file changed

+17
-48
lines changed

1 file changed

+17
-48
lines changed

PSL/cli.py

Lines changed: 17 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def oscilloscope(
103103
if duration >= max_duration:
104104
samples = max_samples
105105
else:
106-
samples = (duration * 1e6) // min_timegap
106+
samples = round((duration * 1e6) / min_timegap)
107107

108-
np.append(xy, scope.capture(channels, samples, min_timegap), axis=1)
108+
xy = np.append(xy, scope.capture(channels, samples, min_timegap), axis=1)
109109
duration -= max_duration
110110

111111
return ["Timestamp"] + active_channels, xy
@@ -213,17 +213,6 @@ def pwm(handler: Handler, args: argparse.Namespace):
213213
channels=args.channel,
214214
prescaler=args.prescaler,
215215
)
216-
elif args.pwm_function == "set":
217-
if args.states == "PWM":
218-
states = ["PWM"] * 4
219-
else:
220-
states = args.states
221-
222-
states[0] = args.sq1 or states[0]
223-
states[1] = args.sq2 or states[1]
224-
states[2] = args.sq3 or states[2]
225-
states[3] = args.sq4 or states[3]
226-
pwm_generator.set_state(*states)
227216

228217

229218
def main(args: argparse.Namespace):
@@ -296,7 +285,7 @@ def add_collect_args(subparser: argparse._SubParsersAction):
296285
collect.add_argument(
297286
"-d",
298287
"--duration",
299-
type=int,
288+
type=float,
300289
default=1,
301290
required=False,
302291
help="Duration for capturing (in seconds)",
@@ -355,7 +344,19 @@ def add_wave_args(subparser: argparse._SubParsersAction):
355344
required=False,
356345
help="Phase between waveforms in degrees",
357346
)
358-
load = wave_functions.add_parser("load")
347+
description = """
348+
TABLE:
349+
JSON array of voltage values which make up the waveform. Array length
350+
must be 512. If the array length less than 512, then the array will be
351+
expanded in length of 512. Values outside the range -3.3 V to 3.3 V
352+
will be clipped.
353+
354+
examples:
355+
[1,0] or [1,...,0,...],
356+
[0,1,0,-1,0,1,0,-1,...],
357+
[0,.025,.05,.075,.1,.125,.15,...]
358+
"""
359+
load = wave_functions.add_parser("load", description=description)
359360
load.add_argument(
360361
"channel",
361362
choices=["SI1", "SI2"],
@@ -432,43 +433,11 @@ def add_pwm_args(subparser: argparse._SubParsersAction):
432433
map_.add_argument(
433434
"-p",
434435
"--prescaler",
435-
type=float,
436+
type=int,
436437
required=True,
437438
help="Prescaler value in interval [0, 15]."
438439
+ "The output frequency is 128 / (1 << prescaler) MHz",
439440
)
440-
set_ = pwm_functions.add_parser("set")
441-
set_.add_argument(
442-
"states",
443-
nargs="*",
444-
choices=["HIGH", "LOW", "PWM"],
445-
default="PWM",
446-
help="Set the state of SQ1, SQ2, SQ3, SQ4",
447-
)
448-
set_.add_argument(
449-
"--sq1",
450-
default=None,
451-
required=False,
452-
help="Set the state of SQ1",
453-
)
454-
set_.add_argument(
455-
"--sq2",
456-
default=None,
457-
required=False,
458-
help="Set the state of SQ2",
459-
)
460-
set_.add_argument(
461-
"--sq3",
462-
default=None,
463-
required=False,
464-
help="Set the state of SQ3",
465-
)
466-
set_.add_argument(
467-
"--sq4",
468-
default=None,
469-
required=False,
470-
help="Set the state of SQ4",
471-
)
472441

473442

474443
def cmdline(args: List[str] = None):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy