Minor changes

This commit is contained in:
Loic Guegan 2023-07-17 10:53:26 +02:00
parent 4d0635e097
commit 44f332f91d
3 changed files with 7 additions and 7 deletions

View file

@ -20,7 +20,7 @@ logger: src/logger.c src/utils.c config.mk
$(CC) $(filter-out config.mk,$^) -o $@ $(MACROS) $(CC) $(filter-out config.mk,$^) -o $@ $(MACROS)
publish: publisher logger publish: publisher logger
for client in $$(basename -a /home/loic/registers/*); \ for client in $$(basename -a /sys/kernel/ina260/*); \
do \ do \
./logger $(LOGGERS_DIR) $$client $(LOG_INTERVAL) &> logger_$${client}.log & echo $$! >> pid; \ ./logger $(LOGGERS_DIR) $$client $(LOG_INTERVAL) &> logger_$${client}.log & echo $$! >> pid; \
done done

View file

@ -3,7 +3,7 @@
ZMQ_PORT=5556 ZMQ_PORT=5556
# SUBSCRIBER_ADDR is used by the publishers # SUBSCRIBER_ADDR is used by the publishers
# to contact the subscriber # to contact the subscriber
SUBSCRIBER_ADDR=localhost SUBSCRIBER_ADDR=10.128.0.133
# ZMQ_TOKEN is used by ZeroMQ to detect # ZMQ_TOKEN is used by ZeroMQ to detect
# messages from publishers. Leave as is if not sure. # messages from publishers. Leave as is if not sure.
ZMQ_TOKEN=ina260-zmq-publisher ZMQ_TOKEN=ina260-zmq-publisher
@ -15,11 +15,11 @@ ZMQ_MSG_SIZE=5242880
##### Loggers/Publisher ##### Loggers/Publisher
# LOGGERS_DIR will contains all the data generated by the loggers # LOGGERS_DIR will contains all the data generated by the loggers
# a.k.a the ina260 power measurements # a.k.a the ina260 power measurements
LOGGERS_DIR=./logs LOGGERS_DIR=/tmp/ina260_logs/
# LOGGERS_DELAY defines the delay between 2 consecutive # LOGGERS_DELAY defines the delay between 2 consecutive
# ina260 power read performed by the logger # ina260 power read performed by the logger
# Unit is milliseconds # Unit is milliseconds
LOGGERS_DELAY=1000 LOGGERS_DELAY=1
# SUBSCRIBER_DIR will contain all the measurments # SUBSCRIBER_DIR will contain all the measurments
# received from the publishers # received from the publishers
SUBSCRIBER_DIR=./data SUBSCRIBER_DIR=./data

View file

@ -52,7 +52,7 @@ int main (int argc, char *argv [])
printf("Log interval is too small (min=%ds)\n",MIN_INTERVAL); printf("Log interval is too small (min=%ds)\n",MIN_INTERVAL);
exit(2); exit(2);
} }
if(FILE_EXISTS(__regpower)){ // TODO UPDATE!! if(!FILE_EXISTS(__regpower)){
printf("Logger cannot access to %s\n",__regpower); printf("Logger cannot access to %s\n",__regpower);
exit(3); exit(3);
} }
@ -62,7 +62,7 @@ int main (int argc, char *argv [])
FILE *regptr,*logptr; FILE *regptr,*logptr;
char logfilepath[STATIC_LEN]=""; char logfilepath[STATIC_LEN]="";
regptr=fopen("/home/loic/out.txt","r"); // TODO UPDATE!!! regptr=fopen(__regpower,"r");
char buffer[STATIC_LEN]; char buffer[STATIC_LEN];
int power; int power;
time_t interval; time_t interval;
@ -89,7 +89,7 @@ int main (int argc, char *argv [])
#if LOGGERS_DELAY > 0 #if LOGGERS_DELAY > 0
usleep(LOGGERS_DELAY*1000); usleep(LOGGERS_DELAY*1000);
#endif #endif
printf("Tick\n"); fflush(stdout); //printf("Tick\n"); fflush(stdout);
} }
fclose(logptr); fclose(logptr);
} }