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

@ -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");
}