purple: fixed CLI code for non-ADC hardware and no sonar

purple hardware does not use the ADC driver
This commit is contained in:
Pat Hickey 2011-11-13 14:54:42 +11:00
parent 99ae313695
commit ddbb6c3348

View File

@ -60,7 +60,7 @@ const struct Menu::command test_menu_commands[] PROGMEM = {
// {"failsafe", test_failsafe}, // {"failsafe", test_failsafe},
// {"stabilize", test_stabilize}, // {"stabilize", test_stabilize},
{"gps", test_gps}, {"gps", test_gps},
#if HIL_MODE != HIL_MODE_ATTITUDE #if HIL_MODE != HIL_MODE_ATTITUDE && CONFIG_ADC == ENABLED
// {"adc", test_adc}, // {"adc", test_adc},
#endif #endif
{"ins", test_ins}, {"ins", test_ins},
@ -77,7 +77,9 @@ const struct Menu::command test_menu_commands[] PROGMEM = {
#if HIL_MODE != HIL_MODE_ATTITUDE #if HIL_MODE != HIL_MODE_ATTITUDE
{"altitude", test_baro}, {"altitude", test_baro},
#endif #endif
#if CONFIG_SONAR == ENABLED
{"sonar", test_sonar}, {"sonar", test_sonar},
#endif
//{"compass", test_mag}, //{"compass", test_mag},
#ifdef OPTFLOW_ENABLED #ifdef OPTFLOW_ENABLED
{"optflow", test_optflow}, {"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 static int8_t
//test_adc(uint8_t argc, const Menu::arg *argv) //test_adc(uint8_t argc, const Menu::arg *argv)
{ {
@ -401,6 +404,10 @@ static int8_t
Serial.printf_P(PSTR("ADC\n")); Serial.printf_P(PSTR("ADC\n"));
delay(1000); delay(1000);
adc.Init(&timer_scheduler);
delay(50);
while(1){ while(1){
for(int i = 0; i < 9; i++){ for(int i = 0; i < 9; i++){
Serial.printf_P(PSTR("%u,"),adc.Ch(i)); Serial.printf_P(PSTR("%u,"),adc.Ch(i));
@ -937,6 +944,7 @@ static int8_t
/* /*
test the sonar test the sonar
*/ */
#if CONFIG_SONAR == ENABLED
static int8_t static int8_t
test_sonar(uint8_t argc, const Menu::arg *argv) test_sonar(uint8_t argc, const Menu::arg *argv)
{ {
@ -959,6 +967,7 @@ test_sonar(uint8_t argc, const Menu::arg *argv)
return (0); return (0);
} }
#endif
#ifdef OPTFLOW_ENABLED #ifdef OPTFLOW_ENABLED
static int8_t static int8_t