Minor changes

This commit is contained in:
Loic Guegan 2023-07-17 18:22:36 +02:00
parent 8f78b632bf
commit 76f13c34f3
3 changed files with 7 additions and 6 deletions

View file

@ -9,7 +9,7 @@ SUBSCRIBER_ADDR=10.128.0.133
ZMQ_TOKEN=ina260-zmq-publisher
# ZMQ_MSG_SIZE max number of bytes per ZeroMQ messages
# Be careful with this parameter. Default is 5MiB
# Units is MiB
# Units is bytes
ZMQ_MSG_SIZE=5242880
##### Loggers/Publisher
@ -19,7 +19,7 @@ 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=0
# SUBSCRIBER_DIR will contain all the measurments
# received from the publishers
SUBSCRIBER_DIR=./data
@ -28,7 +28,7 @@ SUBSCRIBER_DIR=./data
# a file with all the power measurements is generated by the loggers in LOGGERS_DIR
# This file, is then transmitted by the publishers to the subscriber
# Unit is seconds
LOG_INTERVAL=5
LOG_INTERVAL=20
# KEY is attached to all the messages published by the node
# It allows you to filter the messages received on the client
# if you are using multiple monitoring nodes (multiple publishers)

View file

@ -117,7 +117,7 @@ int main (int argc, char *argv [])
char line[STATIC_LEN];
sprintf(line,"%ld,%ld,%d\n",power_ts.tv_sec,power_ts.tv_nsec,atoi(buffer));
int linelen=strlen(line);
if(queues[queue_id].size+linelen>ZMQ_MSG_SIZE){
if((queues[queue_id].size+linelen)>ZMQ_MSG_SIZE){
printf("To many measurements to publish. Please increase ZMQ_MSG_SIZE\n");
} else {
memcpy(queues[queue_id].msg+queues[queue_id].size,line,linelen);
@ -128,7 +128,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);
}
publish(queue_id,publisher);
}
@ -144,4 +144,5 @@ int main (int argc, char *argv [])
void publish(int queue_id, void* publisher){
printf("Publishing...\n");
zmq_send(publisher,queues[queue_id].msg,queues[queue_id].size,0);
printf("Done\n");
}

View file

@ -79,7 +79,7 @@ int main (int argc, char *argv [])
// Write all the measurements:
if(line>4){
fwrite(token, strlen(token), 1, fptr);
printf("%s\n",token);
//printf("%s\n",token);
fwrite("\n",1,1,fptr);
}