From a43ee36beea0a40a1428cd06d8d902017f6d5fe9 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Wed, 15 Feb 2012 11:47:54 -0800 Subject: [PATCH] CH 6 Range setup --- ArduCopter/Parameters.pde | 2 ++ ArduCopter/setup.pde | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ArduCopter/Parameters.pde b/ArduCopter/Parameters.pde index 7de53403b43..27470800e9f 100644 --- a/ArduCopter/Parameters.pde +++ b/ArduCopter/Parameters.pde @@ -64,6 +64,8 @@ static const AP_Param::Info var_info[] PROGMEM = { GSCALAR(log_last_filenumber, "LOG_LASTFILE"), GSCALAR(esc_calibrate, "ESC"), GSCALAR(radio_tuning, "TUNE"), + GSCALAR(radio_tuning_low, "TUNE_LOW"), + GSCALAR(radio_tuning_high, "TUNE_HIGH"), GSCALAR(frame_orientation, "FRAME"), GSCALAR(top_bottom_ratio, "TB_RATIO"), GSCALAR(ch7_option, "CH7_OPT"), diff --git a/ArduCopter/setup.pde b/ArduCopter/setup.pde index 18e9f593734..7a327971da2 100644 --- a/ArduCopter/setup.pde +++ b/ArduCopter/setup.pde @@ -14,6 +14,7 @@ static int8_t setup_batt_monitor (uint8_t argc, const Menu::arg *argv); static int8_t setup_sonar (uint8_t argc, const Menu::arg *argv); static int8_t setup_compass (uint8_t argc, const Menu::arg *argv); static int8_t setup_tune (uint8_t argc, const Menu::arg *argv); +static int8_t setup_range (uint8_t argc, const Menu::arg *argv); //static int8_t setup_mag_offset (uint8_t argc, const Menu::arg *argv); static int8_t setup_declination (uint8_t argc, const Menu::arg *argv); static int8_t setup_optflow (uint8_t argc, const Menu::arg *argv); @@ -39,6 +40,7 @@ const struct Menu::command setup_menu_commands[] PROGMEM = { {"sonar", setup_sonar}, {"compass", setup_compass}, {"tune", setup_tune}, + {"range", setup_range}, // {"offsets", setup_mag_offset}, {"declination", setup_declination}, {"optflow", setup_optflow}, @@ -355,6 +357,19 @@ static int8_t setup_tune(uint8_t argc, const Menu::arg *argv) { g.radio_tuning.set_and_save(argv[1].i); + //g.radio_tuning_high.set_and_save(1000); + //g.radio_tuning_low.set_and_save(0); + report_tuning(); + return 0; +} + +static int8_t +setup_range(uint8_t argc, const Menu::arg *argv) +{ + Serial.printf_P(PSTR("\nCH 6 Ranges are divided by 1000: [low, high]\n")); + + g.radio_tuning_low.set_and_save(argv[1].i); + g.radio_tuning_high.set_and_save(argv[2].i); report_tuning(); return 0; } @@ -1159,7 +1174,9 @@ static void report_tuning() if (g.radio_tuning == 0){ print_enabled(g.radio_tuning.get()); }else{ - Serial.printf_P(PSTR(" %d\n"),(int)g.radio_tuning.get()); + float low = (float)g.radio_tuning_low.get() / 1000; + float high = (float)g.radio_tuning_high.get() / 1000; + Serial.printf_P(PSTR(" %d, Low:%1.4f, High:%1.4f\n"),(int)g.radio_tuning.get(), low, high); } print_blanks(2); }