From 44f332f91d48e43a3a3c30fec4353ea9358d51fd Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 17 Jul 2023 10:53:26 +0200 Subject: [PATCH] Minor changes --- Makefile | 2 +- config.mk | 6 +++--- src/logger.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 6253512..5456ca3 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ logger: src/logger.c src/utils.c config.mk $(CC) $(filter-out config.mk,$^) -o $@ $(MACROS) publish: publisher logger - for client in $$(basename -a /home/loic/registers/*); \ + for client in $$(basename -a /sys/kernel/ina260/*); \ do \ ./logger $(LOGGERS_DIR) $$client $(LOG_INTERVAL) &> logger_$${client}.log & echo $$! >> pid; \ done diff --git a/config.mk b/config.mk index 4e01b7a..ae7b7b8 100644 --- a/config.mk +++ b/config.mk @@ -3,7 +3,7 @@ ZMQ_PORT=5556 # SUBSCRIBER_ADDR is used by the publishers # to contact the subscriber -SUBSCRIBER_ADDR=localhost +SUBSCRIBER_ADDR=10.128.0.133 # ZMQ_TOKEN is used by ZeroMQ to detect # messages from publishers. Leave as is if not sure. ZMQ_TOKEN=ina260-zmq-publisher @@ -15,11 +15,11 @@ ZMQ_MSG_SIZE=5242880 ##### Loggers/Publisher # LOGGERS_DIR will contains all the data generated by the loggers # a.k.a the ina260 power measurements -LOGGERS_DIR=./logs +LOGGERS_DIR=/tmp/ina260_logs/ # LOGGERS_DELAY defines the delay between 2 consecutive # ina260 power read performed by the logger # Unit is milliseconds -LOGGERS_DELAY=1000 +LOGGERS_DELAY=1 # SUBSCRIBER_DIR will contain all the measurments # received from the publishers SUBSCRIBER_DIR=./data diff --git a/src/logger.c b/src/logger.c index 409d7c0..2501e9a 100644 --- a/src/logger.c +++ b/src/logger.c @@ -52,7 +52,7 @@ int main (int argc, char *argv []) printf("Log interval is too small (min=%ds)\n",MIN_INTERVAL); exit(2); } - if(FILE_EXISTS(__regpower)){ // TODO UPDATE!! + if(!FILE_EXISTS(__regpower)){ printf("Logger cannot access to %s\n",__regpower); exit(3); } @@ -62,7 +62,7 @@ int main (int argc, char *argv []) FILE *regptr,*logptr; char logfilepath[STATIC_LEN]=""; - regptr=fopen("/home/loic/out.txt","r"); // TODO UPDATE!!! + regptr=fopen(__regpower,"r"); char buffer[STATIC_LEN]; int power; time_t interval; @@ -89,7 +89,7 @@ int main (int argc, char *argv []) #if LOGGERS_DELAY > 0 usleep(LOGGERS_DELAY*1000); #endif - printf("Tick\n"); fflush(stdout); + //printf("Tick\n"); fflush(stdout); } fclose(logptr); }