Jump command was reported to have issues, updated to match APM branch.

This commit is contained in:
Jason Short 2011-09-18 16:27:43 -07:00
parent 2755748d44
commit 151cae6074
3 changed files with 11 additions and 9 deletions

View File

@ -101,8 +101,7 @@ static void set_command_with_index(struct Location temp, int i)
static void increment_WP_index()
{
if (g.waypoint_index < g.waypoint_total) {
g.waypoint_index.set_and_save(g.waypoint_index + 1);
//SendDebug("MSG <increment_WP_index> WP index is incremented to ");
g.waypoint_index++;
}
SendDebugln(g.waypoint_index,DEC);

View File

@ -616,13 +616,15 @@ static void do_jump()
struct Location temp;
if(next_command.lat > 0) {
command_must_index = NO_COMMAND;
command_may_index = NO_COMMAND;
command_must_index = 0;
command_may_index = 0;
temp = get_command_with_index(g.waypoint_index);
temp.lat = next_command.lat - 1; // Decrement repeat counter
set_command_with_index(temp, g.waypoint_index);
g.waypoint_index.set_and_save(next_command.p1 - 1);
g.waypoint_index = next_command.p1 - 1;
} else if (next_command.lat == -1) {
g.waypoint_index = next_command.p1 - 1;
}
}

View File

@ -26,6 +26,7 @@ static void update_commands(void)
// fetch next command if the next command queue is empty
// -----------------------------------------------------
if (g.waypoint_index < g.waypoint_total) {
// only if we have a cmd stored in EEPROM
next_command = get_command_with_index(g.waypoint_index + 1);
//Serial.printf("queue CMD %d\n", next_command.id);
@ -162,7 +163,7 @@ static void process_may()
{
//gcs.send_text_P(SEVERITY_LOW,PSTR("<process_may>"));
//gcs.send_message(MSG_COMMAND_LIST, g.waypoint_index);
Serial.print("pmay");
//Serial.print("pmay");
command_may_ID = next_command.id;
handle_process_may();
@ -170,6 +171,6 @@ static void process_may()
static void process_now()
{
Serial.print("pnow");
//Serial.print("pnow");
handle_process_now();
}