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
cb13d2982c
commit
05bfba95c7
2 changed files with 9 additions and 3 deletions
|
@ -43,9 +43,13 @@ int main (int argc, char *argv [])
|
||||||
|
|
||||||
//----- Sanity checks
|
//----- Sanity checks
|
||||||
mkdirp(__logdir);
|
mkdirp(__logdir);
|
||||||
|
if(__loginterval<MIN_INTERVAL){
|
||||||
|
printf("Log interval is too small (min=%ds)\n",MIN_INTERVAL);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
if(!FILE_EXISTS(__regpower)){
|
if(!FILE_EXISTS(__regpower)){
|
||||||
printf("Logger cannot access to %s\n",__regpower);
|
printf("Logger cannot access to %s\n",__regpower);
|
||||||
exit(2);
|
exit(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- Start logging
|
//----- Start logging
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define STR(symbol) #symbol
|
#define MIN_INTERVAL 30
|
||||||
#define STRINGIFY(symbol) STR(symbol)
|
|
||||||
|
|
||||||
#define INA260_SYSFS "/sys/kernel/ina260"
|
#define INA260_SYSFS "/sys/kernel/ina260"
|
||||||
#define INA260_POWER_REGISTER "registers/power"
|
#define INA260_POWER_REGISTER "registers/power"
|
||||||
|
|
||||||
|
#define STR(symbol) #symbol
|
||||||
|
#define STRINGIFY(symbol) STR(symbol)
|
||||||
|
|
||||||
#define INTERVAL(timestamp,duration)\
|
#define INTERVAL(timestamp,duration)\
|
||||||
((timestamp) - ((timestamp)%(duration)))
|
((timestamp) - ((timestamp)%(duration)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue