Minor changes

This commit is contained in:
Loic Guegan 2023-07-15 10:34:20 +02:00
parent cb13d2982c
commit 05bfba95c7
2 changed files with 9 additions and 3 deletions

View file

@ -43,9 +43,13 @@ int main (int argc, char *argv [])
//----- Sanity checks
mkdirp(__logdir);
if(__loginterval<MIN_INTERVAL){
printf("Log interval is too small (min=%ds)\n",MIN_INTERVAL);
exit(2);
}
if(!FILE_EXISTS(__regpower)){
printf("Logger cannot access to %s\n",__regpower);
exit(2);
exit(3);
}
//----- Start logging

View file

@ -5,12 +5,14 @@
#include <stdlib.h>
#include <string.h>
#define STR(symbol) #symbol
#define STRINGIFY(symbol) STR(symbol)
#define MIN_INTERVAL 30
#define INA260_SYSFS "/sys/kernel/ina260"
#define INA260_POWER_REGISTER "registers/power"
#define STR(symbol) #symbol
#define STRINGIFY(symbol) STR(symbol)
#define INTERVAL(timestamp,duration)\
((timestamp) - ((timestamp)%(duration)))