|
|
@@ -35,11 +35,13 @@ int main(int argc, char *argv[]) |
|
|
|
int ota_opt = 0; |
|
|
|
int ota_sweep_count = 64; |
|
|
|
int ota_cmd = 32768; |
|
|
|
int tmp; |
|
|
|
char *end; |
|
|
|
|
|
|
|
static struct option long_opts[] = { |
|
|
|
{ "zoom-device", required_argument, NULL, 'z' }, |
|
|
|
{ "gpib-device", required_argument, NULL, 'g' }, |
|
|
|
{ "startup-zero", required_argument, NULL, 's' }, |
|
|
|
{ "startup-zero", no_argument, NULL, 's' }, |
|
|
|
{ "ota-sweep", required_argument, NULL, 'o' }, |
|
|
|
{ "ota-hold", required_argument, NULL, 'l' }, |
|
|
|
{ "help", no_argument, NULL, 'h' }, |
|
|
@@ -48,7 +50,7 @@ int main(int argc, char *argv[]) |
|
|
|
int help=0; |
|
|
|
char c; |
|
|
|
|
|
|
|
while ((c = getopt_long(argc, argv, "z:g:solh?", |
|
|
|
while ((c = getopt_long(argc, argv, "z:g:so:l:h?", |
|
|
|
long_opts, &getopt_index)) != -1) { |
|
|
|
switch(c) |
|
|
|
{ |
|
|
@@ -65,9 +67,23 @@ int main(int argc, char *argv[]) |
|
|
|
break; |
|
|
|
case 'o': |
|
|
|
ota_opt = 1; |
|
|
|
tmp = strtoul(optarg, &end, 0); |
|
|
|
if (*end) { |
|
|
|
fprintf(stderr, "bad number %s\n", optarg); |
|
|
|
help = 1; |
|
|
|
} else { |
|
|
|
ota_sweep_count = tmp; |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'l': |
|
|
|
ota_opt = 2; |
|
|
|
tmp = strtoul(optarg, &end, 0); |
|
|
|
if (*end) { |
|
|
|
fprintf(stderr, "bad number %s\n", optarg); |
|
|
|
help = 1; |
|
|
|
} else { |
|
|
|
ota_cmd = tmp; |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'h': |
|
|
|
|
|
|
@@ -84,8 +100,8 @@ int main(int argc, char *argv[]) |
|
|
|
fprintf(stderr, " -z, --zoom-device %-14s zoom NILM serial port\n", "/dev/xxx" /*zoomdev*/); |
|
|
|
fprintf(stderr, " -g, --gpib-device %-14s GPIB serial port\n", "/dev/xxx" /*gpibdev*/); |
|
|
|
fprintf(stderr, " -s, --startup-zero assist startup by writing '0' to zoom NILM\n"); |
|
|
|
fprintf(stderr, " -o, --ota-sweep sweep OTA\n"); |
|
|
|
fprintf(stderr, " -l, --ota-hold hold OTA constantt\n"); |
|
|
|
fprintf(stderr, " -o, --ota-sweep %-14d sweep OTA\n", ota_sweep_count); |
|
|
|
fprintf(stderr, " -l, --ota-hold %-14d hold OTA constant\n", ota_cmd); |
|
|
|
fprintf(stderr, " -h, --help this help\n"); |
|
|
|
return 1; |
|
|
|
} |
|
|
@@ -106,20 +122,16 @@ int main(int argc, char *argv[]) |
|
|
|
|
|
|
|
signal(SIGINT, handle_sig); |
|
|
|
|
|
|
|
/* sweep OTA only */ |
|
|
|
if(ota_opt == 1){ |
|
|
|
switch (ota_opt) { |
|
|
|
case 1: |
|
|
|
sweep_ota(zoom, gpib, ota_sweep_count); |
|
|
|
|
|
|
|
} |
|
|
|
else if(ota_opt == 2){ |
|
|
|
if(argc > 2){ |
|
|
|
sscanf(argv[2],"%d",&ota_cmd); |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
case 2: |
|
|
|
hold_ota(zoom, gpib, ota_cmd); |
|
|
|
} |
|
|
|
else{ |
|
|
|
break; |
|
|
|
default: |
|
|
|
calibrate(zoom, gpib); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
close(zoom); |
|
|
|