Merge branch 'master' of ssh://home.hottis.de:2922/wolutator/mains-frequency-counter-stm32 into master
This commit is contained in:
commit
7fc58fe364
@ -12,7 +12,7 @@ C_INCLUDES = \
|
|||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = $(C_INCLUDES) -Wall -Werror -std=c99
|
CFLAGS = $(C_INCLUDES) -Wall -Werror -std=c99
|
||||||
LDFLAGS = -lconfig
|
LDFLAGS = -lconfig -lcurl
|
||||||
TARGET = sink20169
|
TARGET = sink20169
|
||||||
|
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
|
@ -223,17 +223,17 @@ int forwardMinuteBuffer(t_forwarderHandle *handle, t_minuteBuffer *buf) {
|
|||||||
int frequency_before_point = buf->s.events[j].frequency / 1000;
|
int frequency_before_point = buf->s.events[j].frequency / 1000;
|
||||||
int frequency_behind_point = buf->s.events[j].frequency - (frequency_before_point * 1000);
|
int frequency_behind_point = buf->s.events[j].frequency - (frequency_before_point * 1000);
|
||||||
|
|
||||||
char buf[256];
|
char payload[256];
|
||||||
int res = snprintf(buf, sizeof(buf),
|
int res = snprintf(payload, sizeof(payload),
|
||||||
"%s,valid=1,location=%s,host=%s freq=%d.%d %lu",
|
"%s,valid=1,location=%s,host=%s freq=%d.%03d %lu",
|
||||||
handle->influxMeasurement, buf->s.location, buf->s.deviceId,
|
handle->influxMeasurement, buf->s.location, buf->s.deviceId,
|
||||||
frequency_before_point, frequency_behind_point,
|
frequency_before_point, frequency_behind_point,
|
||||||
buf->s.events[j].timestamp);
|
buf->s.events[j].timestamp);
|
||||||
if (res > sizeof(buf)) {
|
if (res > sizeof(payload)) {
|
||||||
logmsg(LOG_ERR, "payload buffer to small");
|
logmsg(LOG_ERR, "payload buffer to small");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
logmsg(LOG_INFO, "Payload: %s", buf);
|
logmsg(LOG_INFO, "Payload: %s", payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user