示例#1
0
static void boot_drone(int attempt)
{
	char cmds[1000];
	INFO ("Attempting to boot \n");
	sprintf(cmds,"AT*CONFIG=%i,\"general:navdata_demo\",\"TRUE\"\r",nb_sequence++);
	nb_sequence = nb_sequence+2;
	at_write ((int8_t*)cmds, strlen (cmds));
	printf (cmds);
	at_comwdg();
	if ( get_mask_from_state( mykonos_state,MYKONOS_NAVDATA_BOOTSTRAP )) {
		at_write ((int8_t*)cmds, strlen (cmds));

		INFO ("Attempting to boot \n");
		int retry = 20;
		int bcontinue = true;
		int next = 0;
		while (bcontinue && retry) {
			if (next == 0) {
				if (get_mask_from_state( mykonos_state, MYKONOS_COMMAND_MASK )) {
					INFO ("[CONTROL] Processing the current command ... \n");
					next++;
				}else{
					sprintf(cmds,"AT*CONFIG=%i,\"general:navdata_demo\",\"TRUE\"\r",nb_sequence++);
					at_write ((int8_t*)cmds, strlen (cmds));
				}
				fprintf(stdout,"Mykonos 1\n");
			}
			else {
/*				char str[AT_BUFFER_SIZE];
				memset (str, 0, AT_BUFFER_SIZE); 
				sprintf (str, "AT*CTRL=%d,%d\r", ACK_CONTROL_MODE, 0);
				at_write ((int8_t*)str, strlen (str));
				fprintf(stdout,"Mykonos 2\n");*/

				if ( !get_mask_from_state( mykonos_state, MYKONOS_COMMAND_MASK )) {
					INFO ("[CONTROL] Ack control event OK, send navdata demo\n");
					bcontinue = FALSE;
				}
			}
			usleep (100000);
			retry--;
		}
	}
	at_comwdg();
}
示例#2
0
char *reset_com(char *message)
{
    pthread_mutex_lock(&m_atcommand);
    at_comwdg(message);
    if (send_message(message, at_socket) != 0)
        printf("[FAILED] Message sending failed\n");
    pthread_mutex_unlock(&m_atcommand);
    return message;
}
void CHeli::takeoff()
{
    if (landed){
        usleep(100000);
        at_ui_reset();
        usleep(200000);
        at_trim();
        usleep(200000);
        fprintf(stdout,"Taking off");
        at_ui_pad_start_pressed();
        usleep(100000);
        at_comwdg();
        landed = false;
    }
}