mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-19 12:19:46 +00:00
Minor changes
This commit is contained in:
parent
76f13c34f3
commit
5d7436ba49
4 changed files with 7 additions and 6 deletions
|
@ -114,14 +114,14 @@ int main (int argc, char *argv [])
|
|||
fgets(buffer,STATIC_LEN,regptr);
|
||||
// Get power measurement timestamp:
|
||||
clock_gettime(CLOCK_REALTIME,&power_ts);
|
||||
char line[STATIC_LEN];
|
||||
char line[MAX_RECORD_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+MAX_RECORD_LEN)>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);
|
||||
queues[queue_id].size+=linelen;
|
||||
sprintf(queues[queue_id].msg+queues[queue_id].size,"%ld,%ld,%d\n",power_ts.tv_sec,power_ts.tv_nsec,atoi(buffer));
|
||||
queues[queue_id].size+=strlen(queues[queue_id].msg+queues[queue_id].size);
|
||||
}
|
||||
// Reset power register file:
|
||||
fseek(regptr,0,SEEK_SET);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue