mirror of
https://github.com/owntracks/recorder.git
synced 2026-05-07 02:46:36 +00:00
normalize acc to double
This commit is contained in:
12
recorder.c
12
recorder.c
@@ -553,7 +553,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
{
|
||||
JsonNode *json, *j, *geo = NULL;
|
||||
char *tid = NULL, *t = NULL, *p;
|
||||
double lat, lon;
|
||||
double lat, lon, acc;
|
||||
long tst;
|
||||
struct udata *ud = (struct udata *)userdata;
|
||||
char **topics;
|
||||
@@ -807,7 +807,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
|
||||
tst = time(NULL);
|
||||
if ((j = json_find_member(json, "tst")) != NULL) {
|
||||
if (j && j->tag == JSON_STRING) {
|
||||
if (j->tag == JSON_STRING) {
|
||||
tst = strtoul(j->string_, NULL, 10);
|
||||
json_remove_from_parent(j);
|
||||
json_append_member(json, "tst", json_mknumber(tst));
|
||||
@@ -821,6 +821,14 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((j = json_find_member(json, "acc")) != NULL) {
|
||||
if (j->tag == JSON_STRING) {
|
||||
acc = atof(j->string_);
|
||||
json_remove_from_parent(j);
|
||||
json_append_member(json, "acc", json_mknumber(acc));
|
||||
}
|
||||
}
|
||||
|
||||
if ((j = json_find_member(json, "tid")) != NULL) {
|
||||
if (j->tag == JSON_STRING) {
|
||||
tid = strdup(j->string_);
|
||||
|
||||
Reference in New Issue
Block a user