Beispiel #1
0
#include "Rover.h"
#include "version.h"

#if LOGGING_ENABLED == ENABLED

#if CLI_ENABLED == ENABLED

// Code to interact with the user to dump or erase logs

// Creates a constant array of structs representing menu options
// and stores them in Flash memory, not RAM.
// User enters the string in the console to call the functions on the right.
// See class Menu in AP_Coommon for implementation details
static const struct Menu::command log_menu_commands[] = {
    {"dump",    MENU_FUNC(dump_log)},
    {"erase",   MENU_FUNC(erase_logs)},
    {"enable",  MENU_FUNC(select_logs)},
    {"disable", MENU_FUNC(select_logs)}
};

// A Macro to create the Menu
MENU2(log_menu, "Log", log_menu_commands, FUNCTOR_BIND(&rover, &Rover::print_log_menu, bool));

bool Rover::print_log_menu(void)
{
    cliSerial->printf("logs enabled: ");

    if (0 == g.log_bitmask) {
        cliSerial->printf("none");
    } else {
        // Macro to make the following code a bit easier on the eye.
Beispiel #2
0
#include "Rover.h"

#if CLI_ENABLED == ENABLED

// Command/function table for the setup menu
static const struct Menu::command setup_menu_commands[] = {
	// command			function called
	// =======        	===============
	{"erase",			MENU_FUNC(setup_erase)}
};

// Create the setup menu object.
MENU(setup_menu, "setup", setup_menu_commands);

// Called from the top-level menu to run the setup menu.
int8_t Rover::setup_mode(uint8_t argc, const Menu::arg *argv)
{
	// Give the user some guidance
	cliSerial->printf("Setup Mode\n"
						 "\n"
						 "IMPORTANT: if you have not previously set this system up, use the\n"
						 "'reset' command to initialize the EEPROM to sensible default values\n"
						 "and then the 'radio' command to configure for your radio.\n"
						 "\n");

	// Run the setup menu.  When the menu exits, we will return to the main menu.
	setup_menu.run();
    return 0;
}

int8_t Rover::setup_erase(uint8_t argc, const Menu::arg *argv)
int8_t Plane::main_menu_help(uint8_t argc, const Menu::arg *argv)
{
    cliSerial->printf_P(PSTR("Commands:\n"
                         "  logs        log readback/setup mode\n"
                         "  setup       setup mode\n"
                         "  test        test mode\n"
                         "  reboot      reboot to flight mode\n"
                         "\n"));
    return(0);
}

// Command/function table for the top-level menu.
static const struct Menu::command main_menu_commands[] PROGMEM = {
//   command		function called
//   =======        ===============
    {"logs",        MENU_FUNC(process_logs)},
    {"setup",       MENU_FUNC(setup_mode)},
    {"test",        MENU_FUNC(test_mode)},
    {"reboot",      MENU_FUNC(reboot_board)},
    {"help",        MENU_FUNC(main_menu_help)},
};

// Create the top-level menu object.
MENU(main_menu, THISFIRMWARE, main_menu_commands);

int8_t Plane::reboot_board(uint8_t argc, const Menu::arg *argv)
{
    hal.scheduler->reboot(false);
    return 0;
}
Beispiel #4
0
#include "Rover.h"

#if CLI_ENABLED == ENABLED

// Creates a constant array of structs representing menu options
// and stores them in Flash memory, not RAM.
// User enters the string in the console to call the functions on the right.
// See class Menu in AP_Common for implementation details
static const struct Menu::command test_menu_commands[] = {
	{"pwm",				MENU_FUNC(test_radio_pwm)},
	{"radio",			MENU_FUNC(test_radio)},
	{"passthru",		MENU_FUNC(test_passthru)},
	{"failsafe",		MENU_FUNC(test_failsafe)},
	{"relay",			MENU_FUNC(test_relay)},
	{"waypoints",		MENU_FUNC(test_wp)},
	{"modeswitch",		MENU_FUNC(test_modeswitch)},

	// Tests below here are for hardware sensors only present
	// when real sensors are attached or they are emulated
	{"gps",			MENU_FUNC(test_gps)},
	{"ins",			MENU_FUNC(test_ins)},
	{"sonartest",	MENU_FUNC(test_sonar)},
	{"compass",		MENU_FUNC(test_mag)},
	{"logging",		MENU_FUNC(test_logging)},
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
    {"shell", 				MENU_FUNC(test_shell)},
#endif
};

// A Macro to create the Menu
MENU(test_menu, "test", test_menu_commands);
Beispiel #5
0
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-

#include "Copter.h"

#if CLI_ENABLED == ENABLED

#define PWM_CALIB_MIN 1000
#define PWM_CALIB_MAX 2000
#define PWM_HIGHEST_MAX 2200
#define PWM_LOWEST_MAX 1200
#define PWM_HIGHEST_MIN 1800
#define PWM_LOWEST_MIN 800

// Command/function table for the setup menu
static const struct Menu::command setup_menu_commands[] = {
    {"reset",                       MENU_FUNC(setup_factory)},
    {"show",                        MENU_FUNC(setup_show)},
    {"set",                         MENU_FUNC(setup_set)},
    {"esc_calib",                   MENU_FUNC(esc_calib)},
};

// Create the setup menu object.
MENU(setup_menu, "setup", setup_menu_commands);

// Called from the top-level menu to run the setup menu.
int8_t Copter::setup_mode(uint8_t argc, const Menu::arg *argv)
{
    // Give the user some guidance
    cliSerial->printf("Setup Mode\n\n\n");

    // Run the setup menu.  When the menu exits, we will return to the main menu.
Beispiel #6
0
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-

#include "Plane.h"

#if CLI_ENABLED == ENABLED

// Creates a constant array of structs representing menu options
// and stores them in Flash memory, not RAM.
// User enters the string in the console to call the functions on the right.
// See class Menu in AP_Common for implementation details
static const struct Menu::command test_menu_commands[] PROGMEM = {
    {"pwm",                 MENU_FUNC(test_radio_pwm)},
    {"radio",               MENU_FUNC(test_radio)},
    {"passthru",            MENU_FUNC(test_passthru)},
    {"failsafe",            MENU_FUNC(test_failsafe)},
    {"relay",               MENU_FUNC(test_relay)},
    {"waypoints",           MENU_FUNC(test_wp)},
    {"xbee",                MENU_FUNC(test_xbee)},
    {"modeswitch",          MENU_FUNC(test_modeswitch)},

    // Tests below here are for hardware sensors only present
    // when real sensors are attached or they are emulated
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1
    {"adc",                 MENU_FUNC(test_adc)},
#endif
    {"gps",                 MENU_FUNC(test_gps)},
    {"ins",                 MENU_FUNC(test_ins)},
    {"airspeed",            MENU_FUNC(test_airspeed)},
    {"airpressure",         MENU_FUNC(test_pressure)},
    {"compass",             MENU_FUNC(test_mag)},
    {"logging",             MENU_FUNC(test_logging)},
Beispiel #7
0
    int8_t gpio_input_channel(uint8_t argc, const Menu::arg *argv) {
        hal.console->printf("GPIO Input using digital source\n");
        return test_gpio_input(argc, argv, true);
    }

    int8_t gpio_output_channel(uint8_t argc, const Menu::arg *argv) {
        hal.console->printf("GPIO Output using digital source\n");
        return test_gpio_output(argc, argv, true);
    }

};

MenuCommands commands;

const struct Menu::command test_menu_commands[] = {
    {"input",          MENU_FUNC(gpio_input)},
    {"output",         MENU_FUNC(gpio_output)},
    {"input_ch",       MENU_FUNC(gpio_input_channel)},
    {"output_ch",      MENU_FUNC(gpio_output_channel)}
};

MENU(main_menu, "GPIOTest: Please select one of the operations followed by the GPIO pin number", test_menu_commands);

void setup(void)
{
    Menu::set_port(hal.console);
    hal.console->set_blocking_writes(true);

    while (1) {
        main_menu.run();
    }
Beispiel #8
0
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-

#include "Sub.h"

#if CLI_ENABLED == ENABLED

// Creates a constant array of structs representing menu options
// and stores them in Flash memory, not RAM.
// User enters the string in the console to call the functions on the right.
// See class Menu in AP_Coommon for implementation details
static const struct Menu::command test_menu_commands[] = {
#if HIL_MODE == HIL_MODE_DISABLED
    {"baro",                MENU_FUNC(test_baro)},
#endif
    {"compass",             MENU_FUNC(test_compass)},
    {"ins",                 MENU_FUNC(test_ins)},
    {"optflow",             MENU_FUNC(test_optflow)},
    {"relay",               MENU_FUNC(test_relay)},
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
    {"shell", 				MENU_FUNC(test_shell)},
#endif
#if HIL_MODE == HIL_MODE_DISABLED
    {"rangefinder",         MENU_FUNC(test_sonar)},
#endif
};

// A Macro to create the Menu
MENU(test_menu, "test", test_menu_commands);

int8_t Sub::test_mode(uint8_t argc, const Menu::arg *argv)
{