From ddbb6c33486d9ddefc69745eef984b4546004000 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sun, 13 Nov 2011 14:54:42 +1100 Subject: [PATCH] purple: fixed CLI code for non-ADC hardware and no sonar purple hardware does not use the ADC driver --- ArduCopter/test.pde | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ArduCopter/test.pde b/ArduCopter/test.pde index b64a069ccb..285644c1e5 100644 --- a/ArduCopter/test.pde +++ b/ArduCopter/test.pde @@ -60,7 +60,7 @@ const struct Menu::command test_menu_commands[] PROGMEM = { // {"failsafe", test_failsafe}, // {"stabilize", test_stabilize}, {"gps", test_gps}, -#if HIL_MODE != HIL_MODE_ATTITUDE +#if HIL_MODE != HIL_MODE_ATTITUDE && CONFIG_ADC == ENABLED // {"adc", test_adc}, #endif {"ins", test_ins}, @@ -77,7 +77,9 @@ const struct Menu::command test_menu_commands[] PROGMEM = { #if HIL_MODE != HIL_MODE_ATTITUDE {"altitude", test_baro}, #endif +#if CONFIG_SONAR == ENABLED {"sonar", test_sonar}, +#endif //{"compass", test_mag}, #ifdef OPTFLOW_ENABLED {"optflow", test_optflow}, @@ -393,7 +395,8 @@ static int8_t } */ -/*#if HIL_MODE != HIL_MODE_ATTITUDE + +/*#if HIL_MODE != HIL_MODE_ATTITUDE && CONFIG_ADC == ENABLED static int8_t //test_adc(uint8_t argc, const Menu::arg *argv) { @@ -401,6 +404,10 @@ static int8_t Serial.printf_P(PSTR("ADC\n")); delay(1000); + adc.Init(&timer_scheduler); + + delay(50); + while(1){ for(int i = 0; i < 9; i++){ Serial.printf_P(PSTR("%u,"),adc.Ch(i)); @@ -937,6 +944,7 @@ static int8_t /* test the sonar */ +#if CONFIG_SONAR == ENABLED static int8_t test_sonar(uint8_t argc, const Menu::arg *argv) { @@ -959,6 +967,7 @@ test_sonar(uint8_t argc, const Menu::arg *argv) return (0); } +#endif #ifdef OPTFLOW_ENABLED static int8_t