version stuff

This commit is contained in:
root 2019-11-13 21:14:31 +01:00
parent 8d56c5aff4
commit 5d1f7dde89
4 changed files with 29 additions and 6 deletions

View File

@ -5,15 +5,21 @@ LDFLAGS=-lwiringPi -lcurl -lconfig
INST_DIR=/opt/sbin
counter: counter.o LS7366R.o influx.o ringbuffer.o led.o logging.o
$(CC) -o $@ $(LDFLAGS) $^
.c.o:
$(CC) $(CFLAGS) -c $<
REFCNT:=$(shell git rev-list --all --count)
VERSION:=$(shell cat VERSION)
.PHONY: all
all: counter
counter: counter.o LS7366R.o influx.o ringbuffer.o led.o logging.o version.o
$(CC) -o $@ $(LDFLAGS) $^
version.o: version.c VERSION
$(CC) -DD_REFCNT=$(REFCNT) -DD_VERSION=\"$(VERSION)\" -c $<
.c.o:
$(CC) $(CFLAGS) -c $<
.PHONY: clean
clean:
-rm -f *.o counter
@ -31,4 +37,10 @@ install:
sudo systemctl enable $(INST_DIR)/counter.service
sudo systemctl start counter
.PHONY: stop
stop:
sudo systemctl stop counter
.PHONY: start
start:
sudo systemctl start counter

1
src/VERSION Normal file
View File

@ -0,0 +1 @@
0.94

View File

@ -14,6 +14,9 @@
#include "logging.h"
extern char VERSION[];
extern uint32_t REFCNT;
const int CTRL_OUT = 16;
const int INTR_IN = 19;
const int SPI_CHAN = 0;
@ -66,6 +69,7 @@ void start() {
}
int main (void) {
fprintf(stderr, "VERSION: %s, REFCNT: %u\n", VERSION, REFCNT);
readConfig();
init();
@ -93,7 +97,7 @@ int main (void) {
double gradient = f - lastF;
if (settled && (fabs(gradient) > epsilon)) {
logmsg(LOG_INFO, "Current f=%f, last f=%f, gradient too large, invalid\n", f, lastF);
logmsg(LOG_INFO, "Current f=%f, last f=%f, gradient %f too large, invalid\n", f, lastF, gradient);
skipped++;
f = lastF;
valid = 0;

6
src/version.c Normal file
View File

@ -0,0 +1,6 @@
#include <stdint.h>
const uint32_t REFCNT = D_REFCNT;
const char VERSION[] = D_VERSION;