Minor changes

This commit is contained in:
Loic Guegan 2023-07-15 10:57:40 +02:00
parent 05bfba95c7
commit be6cfef7d2

View file

@ -47,7 +47,7 @@ int main (int argc, char *argv [])
printf("Log interval is too small (min=%ds)\n",MIN_INTERVAL);
exit(2);
}
if(!FILE_EXISTS(__regpower)){
if(FILE_EXISTS(__regpower)){
printf("Logger cannot access to %s\n",__regpower);
exit(3);
}
@ -55,6 +55,18 @@ int main (int argc, char *argv [])
//----- Start logging
printf("Logger started [client=%s,interval=%ds]\n",__client,__loginterval);
FILE *regptr,*logptr;
char logfilepath[255]="";
regptr=fopen("/home/loic/out.txt","r");
*logfilepath='\0';
sprintf(logfilepath,"%s/%ld",__logdir,INTERVAL(TIMESTAMP(),__loginterval));
logptr=fopen(logfilepath,"w");
fprintf(logptr,"timestamp,power\n");
fclose(logptr);
fclose(regptr);
// Extract bus id and ina260 chip address
/*char busid[10];
char chipaddr[10];