Browse Source

some clenaups

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@7700 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 13 years ago
parent
commit
b1453864da
2 changed files with 28 additions and 20 deletions
  1. +27
    -15
      pc/calibrate.c
  2. +1
    -5
      pc/gpib.c

+ 27
- 15
pc/calibrate.c View File

@@ -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);


+ 1
- 5
pc/gpib.c View File

@@ -89,8 +89,6 @@ int keithley2002_init(int fd)
if (isnan(i))
return -1;
return 0;

return 0;
}

int keithley2002_init2(int fd)
@@ -108,8 +106,6 @@ int keithley2002_init2(int fd)
if (isnan(i))
return -1;
return 0;

return 0;
}

double keithley2002_read(int fd)
@@ -126,7 +122,7 @@ double keithley2002_read(int fd)

}

double keithley2002_read2(int fd, double* tx)
double keithley2002_read2(int fd, double *tx)
{
char s[128];
double i;


Loading…
Cancel
Save