Browse Source

stupid bug in verify_prompt

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@7613 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 13 years ago
parent
commit
b948561376
2 changed files with 4 additions and 4 deletions
  1. +3
    -2
      pc/calibrate.c
  2. +1
    -2
      pc/zoom.c

+ 3
- 2
pc/calibrate.c View File

@@ -84,6 +84,7 @@ void calibrate(int zoom, int gpib)
float idesired, iactual;
int i;
int zero;
int r = 0;
int dac[ZOOM_SWEEP_COUNT];
int adc[ZOOM_SWEEP_COUNT];

@@ -120,7 +121,7 @@ void calibrate(int zoom, int gpib)
info("DAC zero point = %d\n", zero);

info("Sweeping\n");
if (zoom_sweep(zoom, dac, adc) < 0) goto fail;
if ((r = zoom_sweep(zoom, dac, adc)) < 0) goto fail;

info("Results:\n");
for (i = 0; i < ZOOM_SWEEP_COUNT; i++) {
@@ -136,6 +137,6 @@ safecleanup:
return;

fail:
info("Failed\n");
info("Failed (code %d)\n", r);
goto safecleanup;
}

+ 1
- 2
pc/zoom.c View File

@@ -17,7 +17,7 @@ static int verify_prompt(int fd)
if (fdgets(s, 128, fd, 1000) == NULL)
return -1;
chomp(s);
if (sscanf(s, "%x %d %x %d", &dac1, &dac2, &adc1, &adc1) != 4)
if (sscanf(s, "%x %d %x %d", &dac1, &dac2, &adc1, &adc2) != 4)
return -1;
if (dac1 != dac2 || adc1 != adc2)
return -1;
@@ -70,7 +70,6 @@ int zoom_sweep(int fd, int dac[ZOOM_SWEEP_COUNT], int adc[ZOOM_SWEEP_COUNT])
if (fdgets(s, 128, fd, 1000) == NULL)
return -1;
chomp(s);
printf("got line: '%s'\n", s);
if (sscanf(s, "%d %d%c", &dac[i], &adc[i], &c) != 2)
return -2;
}


Loading…
Cancel
Save