From 01c4cde14fe42b90cebee681bddd27945f109731 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 Mar 2012 13:23:18 +1100 Subject: [PATCH] AP_Declination: fixed build under SITL --- libraries/AP_Declination/AP_Declination.cpp | 4 ++-- .../AP_Declination_test.pde | 19 ++++++++++++++++++- .../examples/AP_Declination_test/Makefile | 3 +++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Declination/AP_Declination.cpp b/libraries/AP_Declination/AP_Declination.cpp index 2dc94a000b..125bc30c1c 100644 --- a/libraries/AP_Declination/AP_Declination.cpp +++ b/libraries/AP_Declination/AP_Declination.cpp @@ -194,7 +194,7 @@ AP_Declination::get_lookup_value(uint8_t x, uint8_t y) for(i = start_index; i < (start_index + declination_keys[1][x]) && current_virtual_index <= y; i++){ // Pull out the row_value struct - memcpy_P((void*) &stval, (void *) &declination_values[i], sizeof(struct row_value)); + memcpy_P((void*) &stval, (const prog_char *)&declination_values[i], sizeof(struct row_value)); // Pull the first offset and determine sign offset = stval.abs_offset; @@ -208,4 +208,4 @@ AP_Declination::get_lookup_value(uint8_t x, uint8_t y) } } return val; -} \ No newline at end of file +} diff --git a/libraries/AP_Declination/examples/AP_Declination_test/AP_Declination_test.pde b/libraries/AP_Declination/examples/AP_Declination_test/AP_Declination_test.pde index fc2d3838ef..ff46cd09ab 100644 --- a/libraries/AP_Declination/examples/AP_Declination_test/AP_Declination_test.pde +++ b/libraries/AP_Declination/examples/AP_Declination_test/AP_Declination_test.pde @@ -5,6 +5,23 @@ #include #include #include +#include + +#ifdef DESKTOP_BUILD +// all of this is needed to build with SITL +#include +#include +#include +#include +#include +#include +#include +#include +#include +Arduino_Mega_ISR_Registry isr_registry; +AP_Baro_BMP085_HIL barometer; +AP_Compass_HIL compass; +#endif FastSerialPort(Serial, 0); @@ -108,4 +125,4 @@ float get_declination(float lat, float lon) decmin = (lon - lonmin) / 5 * (decSE - decSW) + decSW; decmax = (lon - lonmin) / 5 * (decNE - decNW) + decNW; return (lat - latmin) / 5 * (decmax - decmin) + decmin; -} \ No newline at end of file +} diff --git a/libraries/AP_Declination/examples/AP_Declination_test/Makefile b/libraries/AP_Declination/examples/AP_Declination_test/Makefile index d1f40fd90f..fcdc8ff8fe 100644 --- a/libraries/AP_Declination/examples/AP_Declination_test/Makefile +++ b/libraries/AP_Declination/examples/AP_Declination_test/Makefile @@ -1 +1,4 @@ include ../../../AP_Common/Arduino.mk + +sitl: + make -f ../../../../libraries/Desktop/Desktop.mk