コード例 #1
0
/*---------------------------------------------------------------------------------------------------------------------
Updates the AT command client by flushing pending commands.
---------------------------------------------------------------------------------------------------------------------*/
C_RESULT ardrone_tool_update()
{
	int delta;

	C_RESULT res = C_OK;

	// Update subsystems & custom tool
	if( need_update )
	{
	
		ardrone_timer_update(&ardrone_tool_timer);

		ardrone_tool_input_update();
		res = ardrone_tool_update_custom();

		if( send_com_watchdog == TRUE )
		{
			ardrone_at_reset_com_watchdog();
			send_com_watchdog = FALSE;
		}
		// Send all pushed messages
		ardrone_at_send();

		need_update = FALSE;
	}

	delta = ardrone_timer_delta_ms(&ardrone_tool_timer);
	if( delta >= ArdroneToolRefreshTimeInMs)
	{
		// Render frame
		res = ardrone_tool_display_custom();
		need_update = TRUE;
	}
	else
	{
		Sleep((ArdroneToolRefreshTimeInMs - delta));
	}

	return res;
}
コード例 #2
0
C_RESULT ardrone_tool_update()
{
	int delta;

	C_RESULT res = C_OK;
	
	delta = ardrone_timer_delta_us(&ardrone_tool_timer);
	if( delta >= ArdroneToolRefreshTimeInUs)
	{
		// Render frame
		ardrone_timer_update(&ardrone_tool_timer);
		
		if(!ardrone_tool_in_pause)
		{
			ardrone_tool_input_update();
			res = ardrone_tool_update_custom();
		}
		
		if( send_com_watchdog == TRUE )
		{
			ardrone_at_reset_com_watchdog();
			send_com_watchdog = FALSE;
		}
		
		// Send all pushed messages
		ardrone_at_send();
		
		res = ardrone_tool_display_custom();
	}
	else
	{
		usleep(ArdroneToolRefreshTimeInUs - delta);
	}

	return res;
}