@@ -103,9 +103,9 @@ def oscilloscope(
103
103
if duration >= max_duration :
104
104
samples = max_samples
105
105
else :
106
- samples = ( duration * 1e6 ) // min_timegap
106
+ samples = round (( duration * 1e6 ) / min_timegap )
107
107
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 )
109
109
duration -= max_duration
110
110
111
111
return ["Timestamp" ] + active_channels , xy
@@ -213,17 +213,6 @@ def pwm(handler: Handler, args: argparse.Namespace):
213
213
channels = args .channel ,
214
214
prescaler = args .prescaler ,
215
215
)
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 )
227
216
228
217
229
218
def main (args : argparse .Namespace ):
@@ -296,7 +285,7 @@ def add_collect_args(subparser: argparse._SubParsersAction):
296
285
collect .add_argument (
297
286
"-d" ,
298
287
"--duration" ,
299
- type = int ,
288
+ type = float ,
300
289
default = 1 ,
301
290
required = False ,
302
291
help = "Duration for capturing (in seconds)" ,
@@ -355,7 +344,19 @@ def add_wave_args(subparser: argparse._SubParsersAction):
355
344
required = False ,
356
345
help = "Phase between waveforms in degrees" ,
357
346
)
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 )
359
360
load .add_argument (
360
361
"channel" ,
361
362
choices = ["SI1" , "SI2" ],
@@ -432,43 +433,11 @@ def add_pwm_args(subparser: argparse._SubParsersAction):
432
433
map_ .add_argument (
433
434
"-p" ,
434
435
"--prescaler" ,
435
- type = float ,
436
+ type = int ,
436
437
required = True ,
437
438
help = "Prescaler value in interval [0, 15]."
438
439
+ "The output frequency is 128 / (1 << prescaler) MHz" ,
439
440
)
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
- )
472
441
473
442
474
443
def cmdline (args : List [str ] = None ):
0 commit comments