2011-06-20 12:12:55 -03:00
|
|
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
|
|
|
// These are function definitions so the Menu can be constructed before the functions
|
|
|
|
// are defined below. Order matters to the compiler.
|
|
|
|
static int8_t planner_gcs(uint8_t argc, const Menu::arg *argv);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
const struct Menu::command planner_menu_commands[] PROGMEM = {
|
|
|
|
{"gcs", planner_gcs},
|
|
|
|
};
|
|
|
|
|
|
|
|
// A Macro to create the Menu
|
|
|
|
MENU(planner_menu, "planner", planner_menu_commands);
|
|
|
|
|
2011-07-17 07:32:00 -03:00
|
|
|
static int8_t
|
2011-06-20 12:12:55 -03:00
|
|
|
planner_mode(uint8_t argc, const Menu::arg *argv)
|
|
|
|
{
|
2011-06-24 21:42:57 -03:00
|
|
|
Serial.printf_P(PSTR("Planner Mode\nNot intended for manual use\n\n"));
|
2011-06-20 12:12:55 -03:00
|
|
|
planner_menu.run();
|
2011-06-24 01:41:48 -03:00
|
|
|
return (0);
|
2011-06-20 12:12:55 -03:00
|
|
|
}
|
2011-06-24 01:41:48 -03:00
|
|
|
|
2011-06-20 12:12:55 -03:00
|
|
|
static int8_t
|
|
|
|
planner_gcs(uint8_t argc, const Menu::arg *argv)
|
|
|
|
{
|
2011-10-11 06:12:37 -03:00
|
|
|
gcs0.init(&Serial);
|
2011-06-24 01:41:48 -03:00
|
|
|
|
|
|
|
int loopcount = 0;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
if (millis()-fast_loopTimer > 19) {
|
|
|
|
fast_loopTimer = millis();
|
|
|
|
|
2011-10-11 06:12:37 -03:00
|
|
|
gcs_update();
|
2011-12-07 01:03:56 -04:00
|
|
|
|
2011-11-25 23:23:14 -04:00
|
|
|
read_radio();
|
2011-06-24 01:41:48 -03:00
|
|
|
|
2011-10-11 06:12:37 -03:00
|
|
|
gcs_data_stream_send(45, 1000);
|
2011-06-24 01:41:48 -03:00
|
|
|
|
2011-10-11 06:12:37 -03:00
|
|
|
if ((loopcount % 5) == 0) // 10 hz
|
|
|
|
gcs_data_stream_send(5, 45);
|
2011-06-24 01:41:48 -03:00
|
|
|
|
2011-10-11 06:12:37 -03:00
|
|
|
if ((loopcount % 16) == 0) { // 3 hz
|
|
|
|
gcs_data_stream_send(1, 5);
|
|
|
|
gcs_send_message(MSG_HEARTBEAT);
|
|
|
|
}
|
2011-06-24 01:41:48 -03:00
|
|
|
|
|
|
|
loopcount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
2011-06-20 12:12:55 -03:00
|
|
|
}
|
|
|
|
|