version stuff
This commit is contained in:
parent
8d56c5aff4
commit
5d1f7dde89
22
src/Makefile
22
src/Makefile
@ -5,15 +5,21 @@ LDFLAGS=-lwiringPi -lcurl -lconfig
|
|||||||
|
|
||||||
INST_DIR=/opt/sbin
|
INST_DIR=/opt/sbin
|
||||||
|
|
||||||
counter: counter.o LS7366R.o influx.o ringbuffer.o led.o logging.o
|
REFCNT:=$(shell git rev-list --all --count)
|
||||||
$(CC) -o $@ $(LDFLAGS) $^
|
VERSION:=$(shell cat VERSION)
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) -c $<
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: counter
|
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
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
-rm -f *.o counter
|
-rm -f *.o counter
|
||||||
@ -31,4 +37,10 @@ install:
|
|||||||
sudo systemctl enable $(INST_DIR)/counter.service
|
sudo systemctl enable $(INST_DIR)/counter.service
|
||||||
sudo systemctl start counter
|
sudo systemctl start counter
|
||||||
|
|
||||||
|
.PHONY: stop
|
||||||
|
stop:
|
||||||
|
sudo systemctl stop counter
|
||||||
|
|
||||||
|
.PHONY: start
|
||||||
|
start:
|
||||||
|
sudo systemctl start counter
|
||||||
|
1
src/VERSION
Normal file
1
src/VERSION
Normal file
@ -0,0 +1 @@
|
|||||||
|
0.94
|
@ -14,6 +14,9 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern char VERSION[];
|
||||||
|
extern uint32_t REFCNT;
|
||||||
|
|
||||||
const int CTRL_OUT = 16;
|
const int CTRL_OUT = 16;
|
||||||
const int INTR_IN = 19;
|
const int INTR_IN = 19;
|
||||||
const int SPI_CHAN = 0;
|
const int SPI_CHAN = 0;
|
||||||
@ -66,6 +69,7 @@ void start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main (void) {
|
int main (void) {
|
||||||
|
fprintf(stderr, "VERSION: %s, REFCNT: %u\n", VERSION, REFCNT);
|
||||||
|
|
||||||
readConfig();
|
readConfig();
|
||||||
init();
|
init();
|
||||||
@ -93,7 +97,7 @@ int main (void) {
|
|||||||
|
|
||||||
double gradient = f - lastF;
|
double gradient = f - lastF;
|
||||||
if (settled && (fabs(gradient) > epsilon)) {
|
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++;
|
skipped++;
|
||||||
f = lastF;
|
f = lastF;
|
||||||
valid = 0;
|
valid = 0;
|
||||||
|
6
src/version.c
Normal file
6
src/version.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
const uint32_t REFCNT = D_REFCNT;
|
||||||
|
const char VERSION[] = D_VERSION;
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user