Updated outo-test

This commit is contained in:
Lorenz Meier 2014-04-28 20:42:46 +02:00
parent 7aefcb7a09
commit 9c81ab113e
2 changed files with 13 additions and 4 deletions

View File

@ -1,7 +1,7 @@
CC=g++ CC=g++
CFLAGS=-I. -I../../src/modules -I ../../src/include -I../../src/drivers \ CFLAGS=-I. -I../../src/modules -I ../../src/include -I../../src/drivers \
-I../../src -D__EXPORT="" -Dnullptr="0" -lm -I../../src -I../../src/lib -D__EXPORT="" -Dnullptr="0" -lm
all: mixer_test sbus2_test autodeclination_test all: mixer_test sbus2_test autodeclination_test
@ -20,7 +20,7 @@ SBUS2_FILES=../../src/modules/px4iofirmware/sbus.c \
hrt.cpp \ hrt.cpp \
sbus2_test.cpp sbus2_test.cpp
AUTODECLINATION_FILES=../../src/lib/geo/geo_mag_declination.c \ AUTODECLINATION_FILES= ../../src/lib/geo/geo_mag_declination.c \
hrt.cpp \ hrt.cpp \
autodeclination_test.cpp autodeclination_test.cpp
@ -31,7 +31,7 @@ sbus2_test: $(SBUS2_FILES)
$(CC) -o sbus2_test $(SBUS2_FILES) $(CFLAGS) $(CC) -o sbus2_test $(SBUS2_FILES) $(CFLAGS)
autodeclination_test: $(SBUS2_FILES) autodeclination_test: $(SBUS2_FILES)
$(CC) -o autodeclination_test $(SBUS2_FILES) $(CFLAGS) $(CC) -o autodeclination_test $(AUTODECLINATION_FILES) $(CFLAGS)
.PHONY: clean .PHONY: clean

View File

@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <systemlib/mixer/mixer.h> #include <systemlib/mixer/mixer.h>
@ -7,6 +8,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <px4iofirmware/px4io.h> #include <px4iofirmware/px4io.h>
#include "../../src/systemcmds/tests/tests.h" #include "../../src/systemcmds/tests/tests.h"
#include <geo/geo.h>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
warnx("autodeclination test started"); warnx("autodeclination test started");
@ -14,6 +16,13 @@ int main(int argc, char *argv[]) {
if (argc < 3) if (argc < 3)
errx(1, "Need lat/lon!"); errx(1, "Need lat/lon!");
char* p_end;
float lat = strtod(argv[1], &p_end);
float lon = strtod(argv[2], &p_end);
float declination = get_mag_declination(lat, lon);
printf("lat: %f lon: %f, dec: %f\n", lat, lon, declination);
} }