mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-07 04:16:26 +02:00
Minor changes
This commit is contained in:
parent
83e6235919
commit
ec60f1e34a
1 changed files with 5 additions and 40 deletions
45
src/logger.c
45
src/logger.c
|
@ -18,8 +18,6 @@ char __logdir[255];
|
||||||
char __regpower[100];
|
char __regpower[100];
|
||||||
int __loginterval;
|
int __loginterval;
|
||||||
|
|
||||||
void start(char *power_path, char *busid, char *chipaddr);
|
|
||||||
|
|
||||||
int main (int argc, char *argv [])
|
int main (int argc, char *argv [])
|
||||||
{
|
{
|
||||||
if(argc != 4){
|
if(argc != 4){
|
||||||
|
@ -58,11 +56,12 @@ int main (int argc, char *argv [])
|
||||||
FILE *regptr,*logptr;
|
FILE *regptr,*logptr;
|
||||||
char logfilepath[255]="";
|
char logfilepath[255]="";
|
||||||
regptr=fopen("/home/loic/out.txt","r");
|
regptr=fopen("/home/loic/out.txt","r");
|
||||||
|
char buffer[255];
|
||||||
|
int power;
|
||||||
|
time_t interval;
|
||||||
|
|
||||||
for(int i=0;i<1;i++){
|
for(int i=0;i<1;i++){
|
||||||
char buffer[255];
|
interval=INTERVAL(__loginterval);
|
||||||
int power;
|
|
||||||
time_t interval=INTERVAL(__loginterval);
|
|
||||||
*logfilepath='\0';
|
*logfilepath='\0';
|
||||||
sprintf(logfilepath,"%s/%ld",__logdir);
|
sprintf(logfilepath,"%s/%ld",__logdir);
|
||||||
logptr=fopen(logfilepath,"w");
|
logptr=fopen(logfilepath,"w");
|
||||||
|
@ -80,39 +79,5 @@ int main (int argc, char *argv [])
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(regptr);
|
fclose(regptr);
|
||||||
|
|
||||||
// Extract bus id and ina260 chip address
|
|
||||||
/*char busid[10];
|
|
||||||
char chipaddr[10];
|
|
||||||
char *base=basename(argv[1]);
|
|
||||||
sscanf(base,"%[^-]-%[^-]",busid,chipaddr);
|
|
||||||
|
|
||||||
start("/home/loic/out.txt", busid,chipaddr);*/
|
|
||||||
|
|
||||||
// printf("ts=%d, dur=%d, interval=%d\n",15,__logfrequency,INTERVAL(15,__logfrequency));
|
|
||||||
// printf("ts=%d, dur=%d, interval_last=%d\n",15,__logfrequency,INTERVAL_LAST(15,__logfrequency));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void start(char *power_path, char *busid, char *chipaddr){
|
|
||||||
if (!FILE_EXISTS(power_path)){
|
|
||||||
printf("Could not read %s\n",power_path);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
char outdir[255];
|
|
||||||
mkdir(STRINGIFY(LOGGER_DIR),0755);
|
|
||||||
sprintf(outdir,"%s/%s-%s/",STRINGIFY(LOGGER_DIR), busid,chipaddr);
|
|
||||||
mkdir(outdir,0755);
|
|
||||||
|
|
||||||
char outfile[255];
|
|
||||||
time_t timestamp;
|
|
||||||
timestamp = time(NULL);
|
|
||||||
sprintf(outfile,"%s/%d",outdir,timestamp);
|
|
||||||
printf("aa %s\n",outfile);
|
|
||||||
|
|
||||||
FILE *f;
|
|
||||||
f=fopen(outfile, "w");
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue