00001
00005 #include <bpm/bpm_messages.h>
00006 #include <bpm/bpm_calibration.h>
00007
00008 int save_calibration( char *fname, bpmconf_t *bpm, bpmcalib_t *cal, int num_bpms ) {
00009
00010 if ( ! cal || ! fname ) {
00011 bpm_error( "Invalid pointer arguments in calibrate(...)",
00012 __FILE__, __LINE__ );
00013 return BPM_FAILURE;
00014 }
00015
00016 int i;
00017
00018
00019 FILE *f = fopen( fname, "w" );
00020 if ( ! f ) {
00021 char buf[255];
00022 printf("Unable to save calibration \"%s\" in save_calibration(...)", fname );
00023 bpm_error( buf, __FILE__, __LINE__ );
00024 return BPM_FAILURE;
00025 }
00026
00027 for (i = 0; i < num_bpms; i++) {
00028 fprintf( f, "%s %d %f %f %f %f %f %f %f %f\n", bpm[i].name, i, cal[i].freq,
00029 cal[i].tdecay, cal[i].ddcfiltBW, cal[i].ddcepsFilt, cal[i].t0Offset,
00030 cal[i].IQphase, cal[i].posscale, cal[i].slopescale );
00031 }
00032
00033
00034 return BPM_SUCCESS;
00035 }
00036
00037