CH 6 Range setup

This commit is contained in:
Jason Short 2012-02-15 11:47:54 -08:00
parent 3d63bb6cd4
commit a43ee36bee
2 changed files with 20 additions and 1 deletions

View File

@ -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"),

View File

@ -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);
}