Mercurial > hg > fxanalyse
comparison FXAnalyse.c @ 237:a41c872bce48
Enforce the number of counter channels when writing data to disk
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Thu, 29 Jan 2015 18:25:48 +0100 |
parents | 95572be109a4 |
children | 78fdba868884 |
comparison
equal
deleted
inserted
replaced
236:cf2e21b81dcf | 237:a41c872bce48 |
---|---|
453 .control = __control, \ | 453 .control = __control, \ |
454 .write = __write, \ | 454 .write = __write, \ |
455 } | 455 } |
456 | 456 |
457 struct datafile datafiles[] = { | 457 struct datafile datafiles[] = { |
458 DATAFILE("Raw", event.data, 4, PANEL_SAVE_RAW, TRUE), | 458 // set the counter channels number to zero. it will |
459 DATAFILE("DDS", ad9912.frequency, 4, PANEL_SAVE_DDS, FALSE), | 459 // be updated when the configuration file is read |
460 DATAFILE("Lo", &Math2, 1, PANEL_SAVE_LO, FALSE), | 460 DATAFILE("Raw", event.data, 0, PANEL_SAVE_RAW, TRUE), |
461 DATAFILE("Hg", &Math3, 1, PANEL_SAVE_HG, FALSE), | 461 DATAFILE("DDS", ad9912.frequency, 4, PANEL_SAVE_DDS, FALSE), |
462 DATAFILE("Sr", &Math4, 1, PANEL_SAVE_SR, FALSE), | 462 DATAFILE("Lo", &Math2, 1, PANEL_SAVE_LO, FALSE), |
463 DATAFILE("Ex", &Math5, 1, PANEL_SAVE_EXTRA, FALSE), | 463 DATAFILE("Hg", &Math3, 1, PANEL_SAVE_HG, FALSE), |
464 { NULL, } | 464 DATAFILE("Sr", &Math4, 1, PANEL_SAVE_SR, FALSE), |
465 DATAFILE("Ex", &Math5, 1, PANEL_SAVE_EXTRA, FALSE), | |
466 { NULL, } | |
465 }; | 467 }; |
466 | 468 |
467 | 469 |
468 static void write_data(const char *folder, const char *name, const char *id, | 470 static void write_data(const char *folder, const char *name, const char *id, |
469 const char *timestr, double utc, double *v, int nchan) | 471 const char *timestr, double utc, double *v, int nchan) |
560 | 562 |
561 | 563 |
562 int main (int argc, char *argv[]) | 564 int main (int argc, char *argv[]) |
563 { | 565 { |
564 int rv; | 566 int rv; |
567 int nchan; | |
565 double frequency; | 568 double frequency; |
566 char expr[1024]; | 569 char expr[1024]; |
567 char host[256]; | 570 char host[256]; |
568 double clock; | 571 double clock; |
569 | 572 |
581 char path[MAX_PATHNAME_LEN]; | 584 char path[MAX_PATHNAME_LEN]; |
582 GetIniFilePath(path); | 585 GetIniFilePath(path); |
583 IniText configuration = Ini_New(TRUE); | 586 IniText configuration = Ini_New(TRUE); |
584 Ini_ReadFromFile(configuration, path); | 587 Ini_ReadFromFile(configuration, path); |
585 | 588 |
589 // KK counter channel number | |
590 rv = Ini_GetInt(configuration, "KK", "nchan", &nchan); | |
591 if (rv < 1) | |
592 nchan = 4; | |
593 // update number of channels to save to disk | |
594 datafiles[0].nchan = nchan; | |
595 | |
586 // data folder | 596 // data folder |
587 rv = Ini_GetStringCopy(configuration, "data", "folder", &datafolder); | 597 rv = Ini_GetStringCopy(configuration, "data", "folder", &datafolder); |
588 if (rv > 0) { | 598 if (rv > 0) { |
589 logmessage(INFO, "writing data files in %s", datafolder); | 599 logmessage(INFO, "writing data files in %s", datafolder); |
590 } else { | 600 } else { |
605 rv = ad9956_init(&ad9956, host, clock); | 615 rv = ad9956_init(&ad9956, host, clock); |
606 if (rv) | 616 if (rv) |
607 logmessage(ERROR, "ad9956 init erorr=%d", -rv); | 617 logmessage(ERROR, "ad9956 init erorr=%d", -rv); |
608 ad9956_set_w(&ad9956, dedrift.fDDS, dedrift.applied); | 618 ad9956_set_w(&ad9956, dedrift.fDDS, dedrift.applied); |
609 | 619 |
610 // ad9912 configuration parameters | 620 // AD9912 configuration parameters |
611 rv = Ini_GetStringIntoBuffer(configuration, "AD9912", "host", host, sizeof(host)); | 621 rv = Ini_GetStringIntoBuffer(configuration, "AD9912", "host", host, sizeof(host)); |
612 if (! rv) | 622 if (! rv) |
613 return -1; | 623 return -1; |
614 rv = Ini_GetDouble(configuration, "AD9912", "clock", &clock); | 624 rv = Ini_GetDouble(configuration, "AD9912", "clock", &clock); |
615 if (! rv) | 625 if (! rv) |