mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-07 04:16:26 +02:00
Minor changes
This commit is contained in:
parent
1028f22e16
commit
3ca57c9683
2 changed files with 11 additions and 1 deletions
|
@ -15,6 +15,10 @@ ZMQ_MSG_SIZE=2550
|
||||||
# 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=./logs
|
||||||
|
# LOGGER_DELAY defines the delay between 2 consecutive
|
||||||
|
# ina260 power read performed by the logger
|
||||||
|
# Unit is milliseconds
|
||||||
|
LOGGER_DELAY=1000
|
||||||
# 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
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifndef LOGGER_DELAY
|
||||||
|
#define LOGGER_DELAY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// Global:
|
// Global:
|
||||||
char *__client;
|
char *__client;
|
||||||
char __logdir[255];
|
char __logdir[255];
|
||||||
|
@ -70,7 +74,9 @@ int main (int argc, char *argv [])
|
||||||
clock_gettime(CLOCK_REALTIME,&power_ts);
|
clock_gettime(CLOCK_REALTIME,&power_ts);
|
||||||
fprintf(logptr,"%d,%ld,%d\n",power_ts.tv_sec,power_ts.tv_nsec,power);
|
fprintf(logptr,"%d,%ld,%d\n",power_ts.tv_sec,power_ts.tv_nsec,power);
|
||||||
fseek(regptr,0,SEEK_SET);
|
fseek(regptr,0,SEEK_SET);
|
||||||
sleep(1);
|
#if LOGGER_DELAY > 0
|
||||||
|
usleep(LOGGER_DELAY*1000);
|
||||||
|
#endif
|
||||||
printf("Tick\n"); fflush(stdout);
|
printf("Tick\n"); fflush(stdout);
|
||||||
}
|
}
|
||||||
fclose(logptr);
|
fclose(logptr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue