Exemple #1
0
void draw_nullstate(MENU *state) {
	set_bgcolor(state->bgcolor);
	clr();

	int i;
	for (i = 0; i < state->buttonCount; i++) {
		draw_text_button(state->buttons[i]);
	}

}
void draw_recordstate(MENU *state) {
#ifdef STATETESTMODE
	printf("Clear state for record state->\n");
#endif
	set_bgcolor(state->bgcolor);
	clr();

	int i;
	for (i = 0; i < state->buttonCount; i++) {
		draw_text_button(state->buttons[i]);
	}
}
Exemple #3
0
void screen_model (ESContext *esContext) {
#ifndef SDLGL
	ESMatrix modelview;
	UserData *userData = esContext->userData;
#endif
	draw_title(esContext, "Model");

	char tmp_str[100];
	int n = 0;

#ifndef SDLGL
	esMatrixLoadIdentity(&modelview);
	esMatrixMultiply(&userData->mvpMatrix, &modelview, &userData->perspective);
	esMatrixMultiply(&userData->mvpMatrix2, &modelview, &userData->perspective);
#endif

	if (clientmode == 1) {

		draw_text_button(esContext, "clientmode", VIEW_MODE_MODEL, "Client-Mode / No Config", FONT_PINK, 0.0, 0.0, 0.002, 0.1, ALIGN_CENTER, ALIGN_TOP, model_null, (float)n);

		return;
	}

	if (select_teletype == 1) {
		for (n = 0; n < TELETYPE_LAST; n++) {
			draw_text_button(esContext, teletypes[n], VIEW_MODE_MODEL, teletypes[n], FONT_WHITE, -1.25, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_teletype_set, (float)n);
		}
		return;
	}

	draw_text_button(esContext, "Model", VIEW_MODE_MODEL, "Model", FONT_WHITE, -1.25, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_null, (float)n);
	draw_line_f3(esContext, -1.3, -0.8 + n * 0.12 + 0.1, 0.002, 1.25, -0.8 + n * 0.12 + 0.1, 0.002, 255, 255, 0, 128);
	n++;

	draw_text_button(esContext, "model_load", VIEW_MODE_MODEL, "[LOAD]", FONT_WHITE, 1.1, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_RIGHT, ALIGN_TOP, model_load, 0);

	draw_text_button(esContext, "model_load2", VIEW_MODE_MODEL, "NAME:", FONT_WHITE, -1.1, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_name_edit, 0);
	if (ModelData[ModelActive].name[0] == 0) {
		strcpy(ModelData[ModelActive].name, "model1");
	}
	sprintf(tmp_str, "%s", ModelData[ModelActive].name);
	draw_text_button(esContext, "model_name_edit", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_name_edit, 0);
	n++;
	draw_text_button(esContext, "model_type", VIEW_MODE_MODEL, "TYPE:", FONT_WHITE, -1.1, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_dronetype_change, 0);

	if (ModelData[ModelActive].dronetype > 26) {
		sprintf(tmp_str, "UNKNOWN: %i", ModelData[ModelActive].dronetype);
		draw_text_button(esContext, "dronetype_change", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_dronetype_change, 0);
	} else {
		draw_text_button(esContext, "dronetype_change", VIEW_MODE_MODEL, dronetypes[ModelData[ModelActive].dronetype], FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_dronetype_change, 0);
	}


#ifdef SDLGL
//	get_background_model(ModelActive, tmp_str);

if (ModelData[ModelActive].dronetype > 26) {
	sprintf(tmp_str, "%s/obj3d/_.obj", BASE_DIR);
} else {
	sprintf(tmp_str, "%s/obj3d/%s.obj", BASE_DIR, dronetypes[ModelData[ModelActive].dronetype]);
}
	if (file_exists(tmp_str) != 0) {
		static uint8_t startup = 0;
		static float rotate = 0.0;
		rotate += 0.5;
		if (startup == 0 || strcmp(obj3d_dronetype.name, tmp_str) != 0) {
			startup = 1;
			if (obj3d_dronetype.faces_num != 0) {
				object3d_free(&obj3d_dronetype);
			}
			object3d_load(&obj3d_dronetype, tmp_str);
		}
		glPushMatrix();
		glTranslatef(0.5, (-0.8 + n * 0.12 + 0.2) * -1.0, -2.0);
		if (ModelData[ModelActive].heartbeat == 0) {
			glRotatef(rotate, 0.2, 1.0, 0.3);
		} else {
			glRotatef(-90.0, 1.0, 0.0, 0.0);
//			glRotatef(ModelData[ModelActive].yaw, 0.0, 0.0, -1.0);
			glRotatef(ModelData[ModelActive].pitch, 1.0, 0.0, 0.0);
			glRotatef(ModelData[ModelActive].roll, 0.0, 1.0, 0.0);
		}
		glScalef(0.25, 0.25, 0.25);
		object3d_draw(&obj3d_dronetype, 255, 255, 255, 100);
		glPopMatrix();
	} else {
		sprintf(tmp_str, "%s/textures/%s.png", BASE_DIR, dronetypes[ModelData[ModelActive].dronetype]);
		draw_image_f3(esContext, -1.1 + 1.0, -0.8 + n * 0.12 - 0.02, -1.1 + 1.0 + 0.1, -0.8 + n * 0.12 + 0.1 - 0.02, 0.002, tmp_str);
	}
#else
	sprintf(tmp_str, "%s/textures/%s.png", BASE_DIR, dronetypes[ModelData[ModelActive].dronetype]);
	draw_image_f3(esContext, -1.1 + 1.0, -0.8 + n * 0.12 - 0.02, -1.1 + 1.0 + 0.1, -0.8 + n * 0.12 + 0.1 - 0.02, 0.002, tmp_str);
#endif


	n++;

	draw_text_button(esContext, "model_image_change", VIEW_MODE_MODEL, "IMAGE:", FONT_WHITE, -1.1, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_image_change, 0);
	draw_image_f3(esContext, -1.1 + 0.3, -0.8 + n * 0.12 - 0.02, -1.2 + 0.3 + 0.4, -0.8 + n * 0.12 + 0.3 - 0.02, 0.002, ModelData[ModelActive].image);
	n++;

	n++;
	draw_text_button(esContext, "Telemetry", VIEW_MODE_MODEL, "Telemetry", FONT_WHITE, -1.25, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_null, (float)n);
	draw_line_f3(esContext, -1.3, -0.8 + n * 0.12 + 0.1, 0.002, 1.25, -0.8 + n * 0.12 + 0.1, 0.002, 255, 255, 0, 128);
	n++;

	draw_text_button(esContext, "model_load3", VIEW_MODE_MODEL, "TYPE:", FONT_WHITE, -1.1, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_teletype_change, 0);
	draw_text_button(esContext, "model_teletype_change", VIEW_MODE_MODEL, teletypes[ModelData[ModelActive].teletype], FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_teletype_change, 0);
	n++;


#ifdef SDLGL
	if (ModelData[ModelActive].pilottype == MAV_AUTOPILOT_PIXHAWK) {
		sprintf(tmp_str, "%s/obj3d/%s.obj", BASE_DIR, "PIXHAWK");
	} else {
		sprintf(tmp_str, "%s/obj3d/%s.obj", BASE_DIR, teletypes[ModelData[ModelActive].teletype]);
	}
	if (file_exists(tmp_str) != 0) {
		static uint8_t startup = 0;
		static float rotate = 0.0;
		rotate += 0.4;
		if (startup == 0 || strcmp(obj3d_teletype.name, tmp_str) != 0) {
			startup = 1;
			if (obj3d_teletype.faces_num != 0) {
				object3d_free(&obj3d_teletype);
			}
			object3d_load(&obj3d_teletype, tmp_str);
		}
		glTranslatef(0.5, -0.15, -2.0);
		glRotatef(rotate, -1.0, -1.0, 0.2);
		glScalef(0.25, 0.25, 0.25);
		object3d_draw(&obj3d_teletype, 255, 255, 255, 100);
		glMatrixMode( GL_MODELVIEW );
		glLoadIdentity();
	}
#endif


	draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "DEVICE:");
	if (ModelData[ModelActive].telemetry_port[0] == 0) {
//		strcpy(ModelData[ModelActive].telemetry_port, "/dev/rfcomm0");
	}
	sprintf(tmp_str, "%s [SELECT]", ModelData[ModelActive].telemetry_port);
	draw_text_button(esContext, "device_select", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_device_change, 0);
	n++;

	if (strcmp(ModelData[ModelActive].telemetry_port, "TCP") == 0) {
		draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "IP:");
		sprintf(tmp_str, "%s [CHANGE]", ModelData[ModelActive].netip);
		draw_text_button(esContext, "model_ip_edit", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_ip_edit, n);
		n++;
		draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "PORT:");
		sprintf(tmp_str, "%i [CHANGE]", ModelData[ModelActive].netport);
		draw_text_button(esContext, "model_port_edit", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_port_edit, n);
		n++;
	} else if (strcmp(ModelData[ModelActive].telemetry_port, "UDP") == 0) {
		if (ModelData[ModelActive].teletype == TELETYPE_ARDUPILOT) {
			draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "USEID:");
			sprintf(tmp_str, "%i [CHANGE]", ModelData[ModelActive].use_deviceid);
			if (ModelData[ModelActive].use_deviceid == 1) {
				draw_text_button(esContext, "rc_useid", VIEW_MODE_MODEL, tmp_str, FONT_GREEN, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_use_deviceid_change, n);
				n++;
				draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "SysID:");
				sprintf(tmp_str, "%i [CHANGE]", ModelData[ModelActive].mavlink_sysid);
				draw_text_button(esContext, "rc_mavlink_sysid", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_mavlink_sysid_change, n);
			} else {
				draw_text_button(esContext, "rc_useid", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_use_deviceid_change, n);
			}
		}
		n++;
	} else {
		draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "BAUD:");
		sprintf(tmp_str, "%i [CHANGE]", ModelData[ModelActive].telemetry_baud);
		draw_text_button(esContext, "rc_baud", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_baud_change, n);
		n++;

		draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "USEID:");
		sprintf(tmp_str, "%i [CHANGE]", ModelData[ModelActive].use_deviceid);
		if (ModelData[ModelActive].use_deviceid == 1) {
			draw_text_button(esContext, "rc_useid", VIEW_MODE_MODEL, tmp_str, FONT_GREEN, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_use_deviceid_change, n);
			n++;
			draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "ID:");
			draw_text_button(esContext, "rc_deviceid", VIEW_MODE_MODEL, ModelData[ModelActive].deviceid, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_null, n);
		} else {
			draw_text_button(esContext, "rc_useid", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_use_deviceid_change, n);
		}
		n++;
	}

	draw_text_f3(esContext, -1.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "FORWARD:");
	if (ModelData[ModelActive].mavlink_forward == 0) {
		sprintf(tmp_str, "NO [CHANGE]");
	} else if (ModelData[ModelActive].mavlink_forward == 1) {
		sprintf(tmp_str, "READ/WRITE [CHANGE]");
	} else if (ModelData[ModelActive].mavlink_forward == 2) {
		sprintf(tmp_str, "WRITE PROTECT [CHANGE]");
	}

	draw_text_button(esContext, "mavlink_forward_change", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.3, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_mavlink_forward_change, n);
	n++;

	if (strstr(ModelData[ModelActive].telemetry_port, "rfcomm") > 0) {
		n++;
		draw_text_f3(esContext, -1.1 + 0.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "BLUETOOTH_DEVICE:");
		if (ModelData[ModelActive].telebtaddr[0] == 0) {
			strcpy(ModelData[ModelActive].telebtaddr, "00:00:00:00:00:00");
		}
		sprintf(tmp_str, "%s [RESCAN]", ModelData[ModelActive].telebtaddr);
		draw_text_button(esContext, "bt_scan", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.8, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_null, n);

		n++;
		draw_text_f3(esContext, -1.1 + 0.1, -0.8 + n * 0.12, 0.002, 0.06, 0.06, FONT_WHITE, "BLUETOOTH_PIN:");
		if (ModelData[ModelActive].telebtpin[0] == 0) {
			strcpy(ModelData[ModelActive].telebtpin, "1234");
		}
		sprintf(tmp_str, "%s [CHANGE]", ModelData[ModelActive].telebtpin);
		draw_text_button(esContext, "bt_pin", VIEW_MODE_MODEL, tmp_str, FONT_WHITE, -1.1 + 0.8, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_LEFT, ALIGN_TOP, model_null, n);
	} else {
		n++;
		n++;
	}

	n = 13;
	draw_text_button(esContext, "model_reconnect", VIEW_MODE_MODEL, "[RECONNECT]", FONT_WHITE, 0.0, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, model_reconnect, n);
	n++;
	draw_text_button(esContext, "model_save", VIEW_MODE_MODEL, "[SAVE]", FONT_WHITE, 0.0, -0.8 + n * 0.12, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, model_save, n);

	screen_keyboard(esContext);
	screen_filesystem(esContext);
	screen_device(esContext);
	screen_baud(esContext);
}
Exemple #4
0
void screen_system(ESContext *esContext) {
#ifndef SDLGL
	ESMatrix modelview;
	UserData *userData = esContext->userData;
#endif
#ifndef WINDOWS
	FILE *cmd = NULL;
#endif
	char buffer[1025];
	static char ip[30];
	static char bcast[30];
	static char mask[30];
	static char hostname[30];
	static char dnsserver[30];
	static char gateway[30];
	uint32_t now_time = time(0);
	static uint32_t last_time = 0;
#ifndef SDLGL
	esMatrixLoadIdentity(&modelview);
	esMatrixMultiply(&userData->mvpMatrix, &modelview, &userData->perspective);
#endif
	draw_title(esContext, "System");
	if (last_time != now_time) {
		strcpy(ip, "---.---.---.---");
		strcpy(bcast, "---.---.---.---");
		strcpy(mask, "---.---.---.---");
		strcpy(dnsserver, "---.---.---.---");
		strcpy(gateway, "---.---.---.---");
#ifndef WINDOWS
#ifndef ANDROID
#ifdef OSX
		if ((cmd = popen("LANG=C ifconfig en0 | grep \"inet \" | sed \"s|[a-zA-Z:]||g\"", "r")) != NULL) {
			while (!feof(cmd)) {
				if (fgets(buffer, 1024, cmd) != NULL) {
					sscanf(buffer, "%s %s %s", (char *)&ip, (char *)&bcast, (char *)&mask);
					//			SDL_Log("## %s, %s, %s ##\n", ip, bcast, mask);
				}
			}
			pclose(cmd);
		}
#else
		if ((cmd = popen("LANG=C ifconfig eth0 | grep \"inet addr:\" | sed \"s|[a-zA-Z:]||g\"", "r")) != NULL) {
			while (!feof(cmd)) {
				if (fgets(buffer, 1024, cmd) != NULL) {
					sscanf(buffer, "%s %s %s", (char *)&ip, (char *)&bcast, (char *)&mask);
					//			SDL_Log("## %s, %s, %s ##\n", ip, bcast, mask);
				}
			}
			pclose(cmd);
		}
		if ((cmd = popen("grep \"^nameserver \" /etc/resolv.conf | cut -d\" \" -f2", "r")) != NULL) {
			while (!feof(cmd)) {
				if (fgets(dnsserver, 1024, cmd) != NULL) {
				}
			}
		}
		pclose(cmd);
		if ((cmd = popen("route -n | grep \" 0.0.0.0.*255.255.255.0 \" | cut -d\" \" -f1", "r")) != NULL) {
			while (!feof(cmd)) {
				if (fgets(gateway, 1024, cmd) != NULL) {
				}
			}
		}
		pclose(cmd);
#endif
		if ((cmd = popen("hostname", "r")) != NULL) {
			while (!feof(cmd)) {
				if (fgets(hostname, 1024, cmd) != NULL) {
				}
			}
		}
		pclose(cmd);
#endif
#endif
		last_time = now_time;
	}
	sprintf(buffer, "Name  : %s", hostname);
	draw_text_f(esContext, -0.5, -0.8 + 1 * 0.1, 0.06, 0.06, FONT_GREEN, buffer);
	sprintf(buffer, "IP    : %s", ip);
	draw_text_f(esContext, -0.5, -0.8 + 3 * 0.1, 0.06, 0.06, FONT_GREEN, buffer);
	sprintf(buffer, "BCAST : %s", bcast);
	draw_text_f(esContext, -0.5, -0.8 + 4 * 0.1, 0.06, 0.06, FONT_GREEN, buffer);
	sprintf(buffer, "MASK  : %s", mask);
	draw_text_f(esContext, -0.5, -0.8 + 5 * 0.1, 0.06, 0.06, FONT_GREEN, buffer);
	sprintf(buffer, "DNS   : %s", dnsserver);
	draw_text_f(esContext, -0.5, -0.8 + 6 * 0.1, 0.06, 0.06, FONT_GREEN, buffer);
	sprintf(buffer, "GATE  : %s", gateway);
	draw_text_f(esContext, -0.5, -0.8 + 7 * 0.1, 0.06, 0.06, FONT_GREEN, buffer);
	draw_text_button(esContext, "system_dhclient", VIEW_MODE_SYSTEM, "<GET IP OVER DHCP>", FONT_GREEN, 0.0, -0.8 + 9 * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, system_dhclient, 0.0);
	//	draw_text_button(esContext, "system_gcs", VIEW_MODE_SYSTEM, "<UPDATE GCS>", FONT_GREEN, 0.0, -0.8 + 10 * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, system_update, 0.0);
	// Connections-Status
	char tmp_str[100];
	uint8_t n = 0;
	if (ModelData[ModelActive].teletype == TELETYPE_AUTOQUAD || ModelData[ModelActive].teletype == TELETYPE_ARDUPILOT || ModelData[ModelActive].teletype == TELETYPE_MEGAPIRATE_NG) {
		if (mavlink_connection_status(ModelActive) != 0) {
			sprintf(tmp_str, "MAVLINK %s (%i / %i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud, (uint8_t)(time(0)) - mavlink_connection_status(ModelActive));
			draw_text_button(esContext, "mavlink_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		} else {
			sprintf(tmp_str, "MAVLINK %s (%i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud);
			draw_text_button(esContext, "mavlink_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		}
	} else {
		draw_text_button(esContext, "mavlink_connection_status", VIEW_MODE_SYSTEM, "MAVLINK", FONT_TRANS, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
	}
	if (ModelData[ModelActive].teletype == TELETYPE_MULTIWII_21 || ModelData[ModelActive].teletype == TELETYPE_BASEFLIGHT) {
		if (mwi21_connection_status(ModelActive) != 0) {
			sprintf(tmp_str, "MULTIWII21 %s (%i / %i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud, (uint8_t)(time(0)) - mwi21_connection_status(ModelActive));
			draw_text_button(esContext, "mwi21_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		} else {
			sprintf(tmp_str, "MULTIWII21 %s (%i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud);
			draw_text_button(esContext, "mwi21_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		}
	} else {
		draw_text_button(esContext, "mwi21_connection_status", VIEW_MODE_SYSTEM, "MULTIWII21", FONT_TRANS, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
	}
	if (ModelData[ModelActive].teletype == TELETYPE_BASEFLIGHT) {
		if (mwi21_connection_status(ModelActive) != 0) {
			sprintf(tmp_str, "BASEFLIGHT %s (%i / %i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud, (uint8_t)(time(0)) - mwi21_connection_status(ModelActive));
			draw_text_button(esContext, "mwi21_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		} else {
			sprintf(tmp_str, "BASEFLIGHT %s (%i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud);
			draw_text_button(esContext, "mwi21_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		}
	} else {
		draw_text_button(esContext, "mwi21_connection_status", VIEW_MODE_SYSTEM, "BASEFLIGHT", FONT_TRANS, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
	}
	if (ModelData[ModelActive].teletype == TELETYPE_OPENPILOT) {
		if (openpilot_connection_status(ModelActive) != 0) {
			sprintf(tmp_str, "OPENPILOT %s (%i / %i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud, (uint8_t)(time(0)) - openpilot_connection_status(ModelActive));
			draw_text_button(esContext, "openpilot_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		} else {
			sprintf(tmp_str, "OPENPILOT %s (%i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud);
			draw_text_button(esContext, "openpilot_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		}
	} else {
		draw_text_button(esContext, "openpilot_connection_status", VIEW_MODE_SYSTEM, "OPENPILOT", FONT_TRANS, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
	}
	if (ModelData[ModelActive].teletype == TELETYPE_GPS_NMEA) {
		if (gps_connection_status(ModelActive) != 0) {
			sprintf(tmp_str, "NMEA-GPS %s (%i / %i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud, (uint8_t)(time(0)) - gps_connection_status(ModelActive));
			draw_text_button(esContext, "gps_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		} else {
			sprintf(tmp_str, "NMEA-GPS %s (%i)", ModelData[ModelActive].telemetry_port, ModelData[ModelActive].telemetry_baud);
			draw_text_button(esContext, "gps_connection_status", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
		}
	} else {
		draw_text_button(esContext, "gps_connection_status", VIEW_MODE_SYSTEM, "NMEA-GPS", FONT_TRANS, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_null, 0.0);
	}
	if (frsky_connection_status() != 0) {
		sprintf(tmp_str, "FRSKY %s (%i / %i)", setup.frsky_port, setup.frsky_baud, (uint8_t)(time(0)) - frsky_connection_status());
		draw_text_button(esContext, "frsky", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	} else {
		sprintf(tmp_str, "FRSKY %s (%i)", setup.frsky_port, setup.frsky_baud);
		draw_text_button(esContext, "frsky", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	}
	if (jeti_connection_status() != 0) {
		sprintf(tmp_str, "JETI %s (%i / %i)", setup.jeti_port, setup.jeti_baud, (uint8_t)(time(0)) - jeti_connection_status());
		draw_text_button(esContext, "jeti", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	} else {
		sprintf(tmp_str, "JETI %s (%i)", setup.jeti_port, setup.jeti_baud);
		draw_text_button(esContext, "jeti", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	}
	if (gcsgps_connection_status() != 0) {
		sprintf(tmp_str, "GCS-GPS %s (%i / %i)", setup.gcs_gps_port, setup.gcs_gps_baud, (uint8_t)(time(0)) - gcsgps_connection_status());
		draw_text_button(esContext, "gcs_gps", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	} else {
		sprintf(tmp_str, "GCS-GPS %s (%i)", setup.gcs_gps_port, setup.gcs_gps_baud);
		draw_text_button(esContext, "gcs_gps", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	}
	if (rcflow_connection_status() != 0) {
		sprintf(tmp_str, "RCFLOW %s (%i / %i)", setup.rcflow_port, setup.rcflow_baud, (uint8_t)(time(0)) - rcflow_connection_status());
		draw_text_button(esContext, "rcflow", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	} else {
		sprintf(tmp_str, "RCFLOW %s (%i)", setup.rcflow_port, setup.rcflow_baud);
		draw_text_button(esContext, "rcflow", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	}
	if (tracker_connection_status() != 0) {
		sprintf(tmp_str, "TRACKER %s (%i / %i)", setup.tracker_port, setup.tracker_baud, (uint8_t)(time(0)) - tracker_connection_status());
		draw_text_button(esContext, "tracker", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	} else {
		sprintf(tmp_str, "TRACKER %s (%i)", setup.tracker_port, setup.tracker_baud);
		draw_text_button(esContext, "tracker", VIEW_MODE_SYSTEM, tmp_str, FONT_WHITE, -1.3, 0.2 + n++ * 0.065, 0.002, 0.04, ALIGN_LEFT, ALIGN_TOP, system_device_change, 0.0);
	}

	sprintf(tmp_str, "Font: %s (%i/%i)", fontnames[(int)setup.font], setup.font + 1, FONT_MAX);
	draw_text_button(esContext, "_font", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, 0.55, 0.2, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_font, 0.0);

	sprintf(tmp_str, "Resolution: %ix%i", esContext->width, esContext->height);
	draw_text_button(esContext, "_res", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, 0.55, 0.3, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_fps, 0.0);

	draw_text_button(esContext, "_border_x", VIEW_MODE_SYSTEM, "X-Border", FONT_GREEN, 0.55, 0.4, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_border_x, 0.0);
	draw_text_button(esContext, "_border_x--", VIEW_MODE_SYSTEM, "[-]", FONT_GREEN, 0.85, 0.4, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_border_x, -2.0);
	draw_text_button(esContext, "_border_x++", VIEW_MODE_SYSTEM, "[+]", FONT_GREEN, 0.95, 0.4, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_border_x, 2.0);
	draw_text_button(esContext, "_border_y", VIEW_MODE_SYSTEM, "Y-Border", FONT_GREEN, 0.55, 0.5, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_border_y, 0.0);
	draw_text_button(esContext, "_border_y--", VIEW_MODE_SYSTEM, "[-]", FONT_GREEN, 0.85, 0.5, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_border_y, -2.0);
	draw_text_button(esContext, "_border_y++", VIEW_MODE_SYSTEM, "[+]", FONT_GREEN, 0.95, 0.5, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_border_y, 2.0);
	sprintf(tmp_str, "Ratio(%0.1f)", setup.keep_ratio);
	draw_text_button(esContext, "ratio", VIEW_MODE_SYSTEM, tmp_str, FONT_GREEN, 0.55, 0.6, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_ratio, 0.0);
	draw_text_button(esContext, "ratio--", VIEW_MODE_SYSTEM, "[-]", FONT_GREEN, 0.85, 0.6, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_ratio, -0.1);
	draw_text_button(esContext, "ratio++", VIEW_MODE_SYSTEM, "[+]", FONT_GREEN, 0.95, 0.6, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_ratio, 0.1);
	if (setup.side_by_side == 1) {
		draw_text_button(esContext, "side_by_side", VIEW_MODE_SYSTEM, "SideBySide", FONT_PINK, 0.55, 0.7, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_side_by_side, 0.1);
	} else {
		draw_text_button(esContext, "side_by_side", VIEW_MODE_SYSTEM, "SideBySide", FONT_GREEN, 0.55, 0.7, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_side_by_side, 0.1);
	}
#ifndef ANDROID
#ifdef SDL2
	if (setup.fullscreen == 0) {
		draw_text_button(esContext, "fullscreen", VIEW_MODE_SYSTEM, "TOGGLE FULLSCREEN", FONT_WHITE, 0.55, 0.7, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_fullscreen, 0.0);
	} else {
		draw_text_button(esContext, "fullscreen", VIEW_MODE_SYSTEM, "TOGGLE FULLSCREEN", FONT_GREEN, 0.55, 0.7, 0.002, 0.05, ALIGN_LEFT, ALIGN_TOP, system_set_fullscreen, 0.0);
	}
#endif
#endif
	if (setup.weather_enable == 1) {
		draw_text_button(esContext, "copyright", VIEW_MODE_SYSTEM, "Weather-Data copyright by http://www.openweathermap.org", FONT_PINK, 0.0, 0.88, 0.002, 0.04, ALIGN_CENTER, ALIGN_TOP, system_null, 0.0);
	}
	draw_text_button(esContext, "copyright", VIEW_MODE_SYSTEM, "Copyright by Oliver Dippel ([email protected])", FONT_PINK, 0.0, 0.93, 0.002, 0.04, ALIGN_CENTER, ALIGN_TOP, system_null, 0.0);
	screen_device(esContext);
	screen_baud(esContext);
	if (resize != 0) {
		resize = 0;
#ifdef SDL2
		glResize(esContext, setup.screen_w, setup.screen_h);
#endif
	}
}
Exemple #5
0
void screen_overview(ESContext *esContext) {
#ifndef SDLGL
	ESMatrix modelview;
	UserData *userData = esContext->userData;
#endif
	char tmp_str[1024];
	uint8_t n = 0;
#ifndef SDLGL
	esMatrixLoadIdentity(&modelview);
	esMatrixMultiply(&userData->mvpMatrix, &modelview, &userData->perspective);
#endif
	reset_buttons();
	draw_text_button(esContext, "Screens", setup.view_mode, "Screens", FONT_PINK, -0.8, -0.6 + -2 * 0.1, 0.002, 0.08, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)0);
	for (n = 0; n < VIEW_MODE_LAST; n++) {
		sprintf(tmp_str, "%s", view_names[n]);
		if (setup.view_mode == n) {
			draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_GREEN, -0.8, -0.6 + n * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n);
		} else {
			draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -0.8, -0.6 + n * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n);
		}
	}
	draw_text_button(esContext, "Options", setup.view_mode, "Options", FONT_PINK, 0.8, -0.6 + -2 * 0.1, 0.002, 0.08, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)0);
	n = 0;
	if (setup.speak == 1) {
		draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_GREEN, 0.8, -0.6 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	} else {
		draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_WHITE, 0.8, -0.6 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	}
	if (logmode == 1) {
		draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_GREEN, 0.8, -0.6 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	} else {
		draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_WHITE, 0.8, -0.6 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	}
#ifndef OSX
	if (logplay == 1) {
		draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_GREEN, 0.8, -0.6 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	} else {
		draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_WHITE, 0.8, -0.6 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	}
#endif
	n++;
	n++;
	n++;
	draw_text_button(esContext, "EXIT", setup.view_mode, "EXIT", FONT_WHITE, 0.8, -0.6 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
}
Exemple #6
0
void screen_overview(ESContext *esContext) {
#ifndef SDLGL
	ESMatrix modelview;
	UserData *userData = esContext->userData;
#endif
	char tmp_str[1024];
	uint8_t n = 0;
#ifndef SDLGL
	esMatrixLoadIdentity(&modelview);
	esMatrixMultiply(&userData->mvpMatrix, &modelview, &userData->perspective);
#endif
	reset_buttons();
	int x = 0;
	int y = 0;
	for (n = 0; n < VIEW_MODE_LAST; n++) {
		if (x >= 4) {
			x = 0;
			y += 1;
		}
#ifndef WINDOWS
#ifndef ANDROID
		draw_to_buffer();
		if (n == VIEW_MODE_HUD) {
			screen_hud(esContext);
		} else if (n == VIEW_MODE_TELEMETRY) {
			screen_telemetry(esContext);
		} else if (n == VIEW_MODE_MODEL) {
			screen_model(esContext);
		} else if (n == VIEW_MODE_RCFLOW) {
			screen_rcflow(esContext);
		} else if (n == VIEW_MODE_FMS) {
			screen_fms(esContext);
		} else if (n == VIEW_MODE_WPEDIT) {
			screen_wpedit(esContext);
		} else if (n == VIEW_MODE_MAP) {
			screen_map(esContext, lat, lon, zoom);
		} else if (n == VIEW_MODE_SYSTEM) {
			screen_system(esContext);
#ifndef ANDROID
		} else if (n == VIEW_MODE_VIDEOLIST) {
			screen_videolist(esContext);
#ifdef USE_TCL
		} else if (n == VIEW_MODE_TCL) {
			screen_tcl(esContext);
#endif
#endif
		} else if (n == VIEW_MODE_TRACKER) {
			screen_tracker(esContext);
		} else if (n == VIEW_MODE_FCMENU) {
			if (ModelData[ModelActive].teletype == TELETYPE_MULTIWII_21) {
				screen_mwi_menu(esContext);
			} else if (ModelData[ModelActive].teletype == TELETYPE_BASEFLIGHT) {
				screen_mwi_menu(esContext);
			} else if (ModelData[ModelActive].teletype == TELETYPE_GPS_NMEA) {
				screen_graph(esContext);
			} else if (ModelData[ModelActive].teletype == TELETYPE_OPENPILOT) {
				screen_openpilot(esContext);
			} else {
				screen_mavlink_menu(esContext);
			}
		}
		draw_to_screen();
		draw_buffer_to_screen(-1.422 + x * 0.71, -0.99 + y * 0.66, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, 0.002, 1.0);
		sprintf(tmp_str, "%s", view_names[n]);
		if (setup.view_mode == n) {
			draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_GREEN, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n);
		} else {
			draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n);
		}
#else
		sprintf(tmp_str, "%s", view_names[n]);
		draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66 + 0.3, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n);
#endif
#else
		sprintf(tmp_str, "%s", view_names[n]);
		draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66 + 0.3, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n);
#endif
		reset_buttons();
		x++;
	}
	x = 0;
	y = 0;
	for (n = 0; n < VIEW_MODE_LAST; n++) {
		if (x >= 4) {
			x = 0;
			y += 1;
		}
		//		draw_rect_f3(esContext, -1.3 + x * 0.5, -0.8 + y * 0.4, 0.002, -1.3 + x * 0.5 + 0.5, -0.8 + y * 0.4 + 0.4, 0.002, 255, 255, 255, 255);
		//		set_button(view_names[n], setup.view_mode, -1.3 + x * 0.5, -0.8 + y * 0.4, -1.3 + x * 0.5 + 0.5, -0.8 + y * 0.4 + 0.4, overview_set, (float)n, 0);
		draw_rect_f3(esContext, -1.422 + x * 0.71, -0.99 + y * 0.66, 0.002, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, 0.002, 255, 255, 255, 255);
		set_button(view_names[n], setup.view_mode, -1.422 + x * 0.71, -0.99 + y * 0.66, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, overview_set, (float)n, 0);
		x++;
	}
	draw_text_button(esContext, "Options", setup.view_mode, "Options", FONT_PINK, 1.05, 0.55 + -2 * 0.1, 0.002, 0.08, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)0);
	n = 0;
	if (setup.speak == 1) {
		draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	} else {
		draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	}
	if (logmode == 1) {
		draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	} else {
		draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	}
#ifndef OSX
	if (logplay == 1) {
		draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	} else {
		draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
	}
#endif
	if (clientmode != 1 && setup.webport != 0) {
		if (webserv_is_running() == 1) {
			draw_text_button(esContext, "WEBSERV", setup.view_mode, "stop Webserver", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
		} else {
			draw_text_button(esContext, "WEBSERV", setup.view_mode, "start Webserver", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
		}
	}
	draw_text_button(esContext, "EXIT", setup.view_mode, "EXIT", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0);
}
Exemple #7
0
void screen_mwi_menu (ESContext *esContext) {
	int16_t n = 0;
	int16_t n2 = 0;
	int16_t n3 = 0;
	char tmp_str[100];
	char tmp_str2[100];

	draw_title(esContext, "MultiWii");

	if (mwi_view == 1) {

		for (n3 = 0; n3 < 4; n3++) {
			if (n3 < 4) {
				float val = (float)ModelData.radio[4 + n3] / 2.0 + 50.0;
				if (val > 100.0) {
					val = 100.0;
				} else if (val < -100.0) {
					val = -100.0;
				}
				draw_circleMeter_f3(esContext, -0.4 + (float)n3 * 0.16 * 3.0, -0.8, 0.001, 0.06, 20.0, 30.0, 70.0, 160.0, val, "", "", 1);
			}
			sprintf(tmp_str2, "   AUX%i", n3 + 1);
			draw_text_button(esContext, "box", VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.85 + (float)n3 * 0.16 * 3.0, -0.87, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
			if (ModelData.radio[4 + n3] < -40) {
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " L", FONT_GREEN, -0.8 + (float)n3 * 0.16 * 3.0, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " M", FONT_WHITE, -0.8 + (float)n3 * 0.16 * 3.0 + 0.16, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " H", FONT_WHITE, -0.8 + (float)n3 * 0.16 * 3.0 + 0.32, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
			} else if (ModelData.radio[4 + n3] > 40) {
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " L", FONT_WHITE, -0.8 + (float)n3 * 0.16 * 3.0, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " M", FONT_WHITE, -0.8 + (float)n3 * 0.16 * 3.0 + 0.16, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " H", FONT_GREEN, -0.8 + (float)n3 * 0.16 * 3.0 + 0.32, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
			} else {
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " L", FONT_WHITE, -0.8 + (float)n3 * 0.16 * 3.0, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " M", FONT_GREEN, -0.8 + (float)n3 * 0.16 * 3.0 + 0.16, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, " H", FONT_WHITE, -0.8 + (float)n3 * 0.16 * 3.0 + 0.32, -0.8, 0.002, 0.08, 0, 0, mwi_null, (float)n3);
			}
		}
		for (n2 = 0; n2 < 16 && mwi_box_names[n2][0] != 0; n2++) {
			sprintf(tmp_str, "mwi_v%i", n);
			sprintf(tmp_str2, "%s", mwi_box_names[n2]);
			if (n2 < 3 && ! (mwi_sensors & (1<<n2))) {
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, tmp_str2, FONT_TRANS, -1.2, -0.7 + (float)n2 * 0.1, 0.002, 0.08, 0, 0, mwi_null, (float)n2);
//			} else if ((n2 == 6 || n2 == 7) && ! (mwi_sensors & (1<<3))) {
//				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, tmp_str2, FONT_TRANS, -1.2, -0.7 + (float)n2 * 0.1, 0.002, 0.08, 0, 0, mwi_null, (float)n2);
//			} else if ((n2 == 9) && ! (mwi_sensors & (1<<2))) {
//				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, tmp_str2, FONT_TRANS, -1.2, -0.7 + (float)n2 * 0.1, 0.002, 0.08, 0, 0, mwi_null, (float)n2);
			} else if (mwi_status & (1<<n2)) {
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, tmp_str2, FONT_GREEN, -1.2, -0.7 + (float)n2 * 0.1, 0.002, 0.08, 0, 0, mwi_null, (float)n2);
			} else {
				draw_text_button(esContext, "box", VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -1.2, -0.7 + (float)n2 * 0.1, 0.002, 0.08, 0, 0, mwi_null, (float)n2);
			}
		}
		n = 0;
		for (n2 = 0; n2 < 16 && mwi_box_names[n2][0] != 0; n2++) {
			for (n3 = 0; n3 < 12; n3++) {
				sprintf(tmp_str, "mwi_v%i", n);
				if (mwi_set_box[n2] & (1<<n3)) {
					sprintf(tmp_str2, "[x]");
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.8 + (float)n3 * 0.16, -0.7 + (float)n2 * 0.1, 0.002, 0.08, 0, 0, mwi_box_set, (float)n);
				} else {
					sprintf(tmp_str2, "[ ]");
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.8 + (float)n3 * 0.16, -0.7 + (float)n2 * 0.1, 0.002, 0.08, 0, 0, mwi_box_set, (float)n);
				}
				n++;
			}
		}
		draw_text_button(esContext, "mwi_view", VIEW_MODE_FCMENU, "[BOX]", FONT_WHITE, 0.0, 0.9, 0.002, 0.07, 1, 0, mwi_view_change, 0.0);
	} else {
		draw_text_button(esContext, "pid", VIEW_MODE_FCMENU, "P", FONT_WHITE, -0.7 + 1.0 * 0.2, -0.8, 0.002, 0.08, 1, 0, mwi_pid_set, (float)0);
		draw_text_button(esContext, "pid", VIEW_MODE_FCMENU, "I", FONT_WHITE, 0.0 + 1.0 * 0.2, -0.8, 0.002, 0.08, 1, 0, mwi_pid_set, (float)1);
		draw_text_button(esContext, "pid", VIEW_MODE_FCMENU, "D", FONT_WHITE, 0.7 + 1.0 * 0.2, -0.8, 0.002, 0.08, 1, 0, mwi_pid_set, (float)2);
		for (n2 = 0; n2 < 16 && mwi_pid_names[n2][0]; n2++) {
			sprintf(tmp_str2, "%s", mwi_pid_names[n2]);
			draw_text_button(esContext, "pid", VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -1.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 0, 0, mwi_null, (float)n2);
			if (n2 < 3) {
				float val = (float)ModelData.radio[n2] / 2.0 + 50.0;
				if (val > 100.0) {
					val = 100.0;
				} else if (val < -100.0) {
					val = -100.0;
				}
				draw_circleMeter_f3(esContext, -0.85, -0.7 + (float)n2 * 0.13 + 0.07, 0.001, 0.06, 20.0, 50.0, 50.0, 160.0, val, "", "", 1);
			}
		}
		n = 0;
		for (n2 = 0; n2 < 16 && mwi_pid_names[n2][0]; n2++) {
			if (n2 == 114) {
				sprintf(tmp_str2, "%0.2f", (float)mwi_pid[n2][0] / 100.0);
				sprintf(tmp_str, "mwi_p-%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, -0.7 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str, "mwi_p%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.7 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str, "mwi_p+%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, -0.7 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str2, "%0.2f", (float)mwi_pid[n2][1] / 100.0);
				sprintf(tmp_str, "mwi_i-%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, -0.0 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
				sprintf(tmp_str, "mwi_i%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.0 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
				sprintf(tmp_str, "mwi_i+%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, -0.0 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
			} else if (n2 == 115 || n2 == 116) {
				sprintf(tmp_str2, "%0.2f", (float)mwi_pid[n2][0] / 10.0);
				sprintf(tmp_str, "mwi_p-%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, -0.7 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str, "mwi_p%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.7 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str, "mwi_p+%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, -0.7 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str2, "%0.2f", (float)mwi_pid[n2][1] / 100.0);
				sprintf(tmp_str, "mwi_i-%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, -0.0 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
				sprintf(tmp_str, "mwi_i%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.0 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
				sprintf(tmp_str, "mwi_i+%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, -0.0 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
				sprintf(tmp_str2, "%0.3f", (float)mwi_pid[n2][2] / 1000.0);
				sprintf(tmp_str, "mwi_d-%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, 0.7 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 2.0);
				sprintf(tmp_str, "mwi_d%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, 0.7 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 2.0);
				sprintf(tmp_str, "mwi_d+%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, 0.7 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 2.0);
			} else {
				sprintf(tmp_str2, "%0.2f", (float)mwi_pid[n2][0] / 10.0);
				sprintf(tmp_str, "mwi_p-%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, -0.7 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str, "mwi_p%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.7 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				sprintf(tmp_str, "mwi_p+%i", n);
				draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, -0.7 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n);
				if (n2 != 118) {
					sprintf(tmp_str2, "%0.3f", (float)mwi_pid[n2][1] / 1000.0);
					sprintf(tmp_str, "mwi_i-%i", n);
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, -0.0 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
					sprintf(tmp_str, "mwi_i%i", n);
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, -0.0 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
					sprintf(tmp_str, "mwi_i+%i", n);
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, -0.0 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 1.0);
	
					sprintf(tmp_str2, "%0.0f", (float)mwi_pid[n2][2] / 1.0);
					sprintf(tmp_str, "mwi_d-%i", n);
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[-]", FONT_WHITE, 0.7 + 0.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 2.0);
					sprintf(tmp_str, "mwi_d%i", n);
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, tmp_str2, FONT_WHITE, 0.7 + 1.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 2.0);
					sprintf(tmp_str, "mwi_d+%i", n);
					draw_text_button(esContext, tmp_str, VIEW_MODE_FCMENU, "[+]", FONT_WHITE, 0.7 + 2.0 * 0.2, -0.7 + (float)n2 * 0.13, 0.002, 0.08, 1, 0, mwi_pid_set, (float)n + 2.0);
				}
			}
			n += 3;
		}
		draw_text_button(esContext, "mwi_view", VIEW_MODE_FCMENU, "[PID]", FONT_WHITE, 0.0, 0.9, 0.002, 0.07, 1, 0, mwi_view_change, 0.0);
	}
	draw_text_button(esContext, "mwi_cal_acc", VIEW_MODE_FCMENU, "[CAL_ACC]", FONT_WHITE, -0.8, 0.9, 0.002, 0.07, 1, 0, mwi_cal_acc, 0.0);
	draw_text_button(esContext, "mwi_cal_mac", VIEW_MODE_FCMENU, "[CAL_MAG]", FONT_WHITE, -0.4, 0.9, 0.002, 0.07, 1, 0, mwi_cal_mac, 0.0);
	draw_text_button(esContext, "mwi_get_values", VIEW_MODE_FCMENU, "[READ]", FONT_WHITE, 0.4, 0.9, 0.002, 0.07, 1, 0, mwi_get_values, 0.0);
	draw_text_button(esContext, "mwi_write_rom", VIEW_MODE_FCMENU, "[WRITE_ROM]", FONT_WHITE, 0.8, 0.9, 0.002, 0.07, 1, 0, mwi_write_rom, 0.0);
}
Exemple #8
0
void screen_keyboard(ESContext *esContext) {
#ifdef SDLGL
	if (draw_target() != 0) {
		return;
	}
#endif
#ifndef SDLGL
	ESMatrix modelview;
	UserData *userData = esContext->userData;
#endif
	if (show_keyboard != setup.view_mode) {
		return;
	}
	reset_buttons();
	draw_box_f3(esContext, -1.5, -1.0, 0.02, 1.5, 1.0, 0.02, 0, 0, 0, 200);
	draw_title(esContext, "Keyboard");
	char tmp_str[100];
	char tmp_str2[100];
	int n = 0;
#ifndef SDLGL
	esMatrixLoadIdentity(&modelview);
	esMatrixMultiply(&userData->mvpMatrix, &modelview, &userData->perspective);
	esMatrixMultiply(&userData->mvpMatrix2, &modelview, &userData->perspective);
#endif
	for (n = 0; n < strlen(new_name) + 1; n++) {
		if (new_name[n] != 0) {
			sprintf(tmp_str2, "%c", new_name[n]);
		} else {
			sprintf(tmp_str2, "[END]");
		}
		sprintf(tmp_str, "set_char_%i", n);
		draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str2, FONT_WHITE, -0.9 + n * 0.08, -0.6, 0.02, 0.06, ALIGN_LEFT, ALIGN_TOP, keyboard_pos_char, n);
		if (n == new_name_cnt) {
			draw_text_button(esContext, "mark", setup.view_mode, "^", FONT_WHITE, -0.9 + n * 0.08, -0.5, 0.02, 0.06, ALIGN_LEFT, ALIGN_TOP, keyboard_pos_char, n);
		}
	}
	draw_text_button(esContext, "rcname_save", setup.view_mode, "[OK]", FONT_WHITE, 0.4, -0.6, 0.02, 0.06, ALIGN_LEFT, ALIGN_TOP, keyboard_name_save, 0);
	draw_text_button(esContext, "rcname_cancel", setup.view_mode, "[CANCEL]", FONT_WHITE, 0.6, -0.6, 0.02, 0.06, ALIGN_LEFT, ALIGN_TOP, keyboard_name_cancel, 0);
	uint8_t x = 0;
	uint8_t y = 0;
	if (type == 0) {
		for (n = 33; n < 150; n++) {
			sprintf(tmp_str2, "%c", n);
			sprintf(tmp_str, "add_char_%i", n);
			draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str2, FONT_WHITE, -1.1 + x * 0.14, -0.3 + y * 0.14, 0.02, 0.06, ALIGN_CENTER, ALIGN_TOP, keyboard_add_char, n);
			if (x > 14) {
				y++;
				x = 0;
			} else {
				x++;
			}
		}
	} else {
		for (n = '0'; n <= '9'; n++) {
			sprintf(tmp_str2, "%c", n);
			sprintf(tmp_str, "add_char_%i", n);
			draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str2, FONT_WHITE, -1.1 + x * 0.14, -0.3 + y * 0.14, 0.02, 0.1, ALIGN_CENTER, ALIGN_TOP, keyboard_add_char, n);
			if (x > 1) {
				y++;
				x = 0;
			} else {
				x++;
			}
		}
		if (type == 2) {
			sprintf(tmp_str2, "%c", '.');
			sprintf(tmp_str, "add_char_%i", '.');
			draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str2, FONT_WHITE, -1.1 + x * 0.14, -0.3 + y * 0.14, 0.02, 0.1, ALIGN_CENTER, ALIGN_TOP, keyboard_add_char, '.');
			if (x > 1) {
				y++;
				x = 0;
			} else {
				x++;
			}
		}
		sprintf(tmp_str2, "%c", '-');
		sprintf(tmp_str, "add_char_%i", '-');
		draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str2, FONT_WHITE, -1.1 + x * 0.14, -0.3 + y * 0.14, 0.02, 0.1, ALIGN_CENTER, ALIGN_TOP, keyboard_add_char, '-');
		if (x > 1) {
			y++;
			x = 0;
		} else {
			x++;
		}
	}
	sprintf(tmp_str2, "[END]");
	sprintf(tmp_str, "add_char_%i", 0);
	draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str2, FONT_WHITE, -1.1 + x * 0.14, -0.3 + y * 0.14, 0.02, 0.06, ALIGN_CENTER, ALIGN_TOP, keyboard_add_char, 0);
	if (keyboard_key[0] != 0) {
		if (strcmp(keyboard_key, "return") == 0) {
			keyboard_name_save("", 0.0, 0.0, 0, 0.0, 0);
		} else if (strcmp(keyboard_key, "backspace") == 0) {
			new_name_cnt--;
		} else if (strcmp(keyboard_key, "delete") == 0) {
			keyboard_add_char("", 0.0, 0.0, 0, 0.0, 0);
		} else if (strcmp(keyboard_key, "up") == 0) {
		} else if (strcmp(keyboard_key, "down") == 0) {
		} else if (strcmp(keyboard_key, "end") == 0) {
		} else if (strcmp(keyboard_key, "home") == 0) {
			new_name_cnt = 0;
		} else if (strcmp(keyboard_key, "escape") == 0) {
			keyboard_name_cancel("", 0.0, 0.0, 0, 0.0, 0);
		} else if (strcmp(keyboard_key, "left") == 0) {
			new_name_cnt--;
		} else if (strcmp(keyboard_key, "right") == 0) {
			new_name_cnt++;
		} else if (strcmp(keyboard_key, "space") == 0) {
			keyboard_add_char("", 0.0, 0.0, 0, ' ', 0);
		} else if (keyboard_key[1] == 0) {
			keyboard_add_char("", 0.0, 0.0, 0, keyboard_key[0], 0);
		}
		keyboard_key[0] = 0;
	}
}
void UAVT_gui_show(ESContext *esContext) {
	uint16_t ny = 0;
	uint16_t nn = 0;
	if (show_num == 1) {
		UAVT_gui_ActuatorSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "ActuatorSettingsShow", VIEW_MODE_FCMENU, "ActuatorSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)1);
		}
	}
	nn++;
	if (show_num == 2) {
		UAVT_gui_AirspeedSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "AirspeedSettingsShow", VIEW_MODE_FCMENU, "AirspeedSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)2);
		}
	}
	nn++;
	if (show_num == 3) {
		UAVT_gui_AltitudeHoldSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "AltitudeHoldSettingsShow", VIEW_MODE_FCMENU, "AltitudeHoldSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)3);
		}
	}
	nn++;
	if (show_num == 4) {
		UAVT_gui_AttitudeSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "AttitudeSettingsShow", VIEW_MODE_FCMENU, "AttitudeSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)4);
		}
	}
	nn++;
	if (show_num == 5) {
		UAVT_gui_BrushlessGimbalSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "BrushlessGimbalSettingsShow", VIEW_MODE_FCMENU, "BrushlessGimbalSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)5);
		}
	}
	nn++;
	if (show_num == 6) {
		UAVT_gui_CameraStabSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "CameraStabSettingsShow", VIEW_MODE_FCMENU, "CameraStabSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)6);
		}
	}
	nn++;
	if (show_num == 7) {
		UAVT_gui_FaultSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "FaultSettingsShow", VIEW_MODE_FCMENU, "FaultSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)7);
		}
	}
	nn++;
	if (show_num == 8) {
		UAVT_gui_FixedWingAirspeeds_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "FixedWingAirspeedsShow", VIEW_MODE_FCMENU, "FixedWingAirspeeds ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)8);
		}
	}
	nn++;
	if (show_num == 9) {
		UAVT_gui_FixedWingPathFollowerSettingsCC_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "FixedWingPathFollowerSettingsCCShow", VIEW_MODE_FCMENU, "FixedWingPathFollowerSettingsCC ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)9);
		}
	}
	nn++;
	if (show_num == 10) {
		UAVT_gui_FixedWingPathFollowerSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "FixedWingPathFollowerSettingsShow", VIEW_MODE_FCMENU, "FixedWingPathFollowerSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)10);
		}
	}
	nn++;
	if (show_num == 11) {
		UAVT_gui_FlightBatterySettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "FlightBatterySettingsShow", VIEW_MODE_FCMENU, "FlightBatterySettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)11);
		}
	}
	nn++;
	if (show_num == 12) {
		UAVT_gui_FlightPlanSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "FlightPlanSettingsShow", VIEW_MODE_FCMENU, "FlightPlanSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)12);
		}
	}
	nn++;
	if (show_num == 13) {
		UAVT_gui_GeoFenceSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "GeoFenceSettingsShow", VIEW_MODE_FCMENU, "GeoFenceSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)13);
		}
	}
	nn++;
	if (show_num == 14) {
		UAVT_gui_GroundPathFollowerSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "GroundPathFollowerSettingsShow", VIEW_MODE_FCMENU, "GroundPathFollowerSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)14);
		}
	}
	nn++;
	if (show_num == 15) {
		UAVT_gui_HomeLocation_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HomeLocationShow", VIEW_MODE_FCMENU, "HomeLocation ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)15);
		}
	}
	nn++;
	if (show_num == 16) {
		UAVT_gui_HoTTSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HoTTSettingsShow", VIEW_MODE_FCMENU, "HoTTSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)16);
		}
	}
	nn++;
	if (show_num == 17) {
		UAVT_gui_HwColibri_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwColibriShow", VIEW_MODE_FCMENU, "HwColibri (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)17);
		}
	}
	nn++;
	if (show_num == 18) {
		UAVT_gui_HwCopterControl_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwCopterControlShow", VIEW_MODE_FCMENU, "HwCopterControl (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)18);
		}
	}
	nn++;
	if (show_num == 19) {
		UAVT_gui_HwDiscoveryF4_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwDiscoveryF4Show", VIEW_MODE_FCMENU, "HwDiscoveryF4 (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)19);
		}
	}
	nn++;
	if (show_num == 20) {
		UAVT_gui_HwFlyingF3_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwFlyingF3Show", VIEW_MODE_FCMENU, "HwFlyingF3 (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)20);
		}
	}
	nn++;
	if (show_num == 21) {
		UAVT_gui_HwFlyingF4_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwFlyingF4Show", VIEW_MODE_FCMENU, "HwFlyingF4 (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)21);
		}
	}
	nn++;
	if (show_num == 22) {
		UAVT_gui_HwFreedom_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwFreedomShow", VIEW_MODE_FCMENU, "HwFreedom (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)22);
		}
	}
	nn++;
	if (show_num == 23) {
		UAVT_gui_HwQuanton_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwQuantonShow", VIEW_MODE_FCMENU, "HwQuanton (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)23);
		}
	}
	nn++;
	if (show_num == 24) {
		UAVT_gui_HwRevolution_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwRevolutionShow", VIEW_MODE_FCMENU, "HwRevolution (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)24);
		}
	}
	nn++;
	if (show_num == 25) {
		UAVT_gui_HwRevoMini_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwRevoMiniShow", VIEW_MODE_FCMENU, "HwRevoMini (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)25);
		}
	}
	nn++;
	if (show_num == 26) {
		UAVT_gui_HwSparkyBGC_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwSparkyBGCShow", VIEW_MODE_FCMENU, "HwSparkyBGC (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)26);
		}
	}
	nn++;
	if (show_num == 27) {
		UAVT_gui_HwSparky_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "HwSparkyShow", VIEW_MODE_FCMENU, "HwSparky (HardwareSettings)", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)27);
		}
	}
	nn++;
	if (show_num == 28) {
		UAVT_gui_I2CVMUserProgram_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "I2CVMUserProgramShow", VIEW_MODE_FCMENU, "I2CVMUserProgram ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)28);
		}
	}
	nn++;
	if (show_num == 29) {
		UAVT_gui_INSSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "INSSettingsShow", VIEW_MODE_FCMENU, "INSSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)29);
		}
	}
	nn++;
	if (show_num == 30) {
		UAVT_gui_LoggingSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "LoggingSettingsShow", VIEW_MODE_FCMENU, "LoggingSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)30);
		}
	}
	nn++;
	if (show_num == 31) {
		UAVT_gui_ManualControlSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "ManualControlSettingsShow", VIEW_MODE_FCMENU, "ManualControlSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)31);
		}
	}
	nn++;
	if (show_num == 32) {
		UAVT_gui_MixerSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "MixerSettingsShow", VIEW_MODE_FCMENU, "MixerSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)32);
		}
	}
	nn++;
	if (show_num == 33) {
		UAVT_gui_ModuleSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "ModuleSettingsShow", VIEW_MODE_FCMENU, "ModuleSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)33);
		}
	}
	nn++;
	if (show_num == 34) {
		UAVT_gui_MWRateSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "MWRateSettingsShow", VIEW_MODE_FCMENU, "MWRateSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)34);
		}
	}
	nn++;
	if (show_num == 35) {
		UAVT_gui_OPLinkSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "OPLinkSettingsShow", VIEW_MODE_FCMENU, "OPLinkSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)35);
		}
	}
	nn++;
	if (show_num == 36) {
		UAVT_gui_OveroSyncSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "OveroSyncSettingsShow", VIEW_MODE_FCMENU, "OveroSyncSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)36);
		}
	}
	nn++;
	if (show_num == 37) {
		UAVT_gui_PathPlannerSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "PathPlannerSettingsShow", VIEW_MODE_FCMENU, "PathPlannerSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)37);
		}
	}
	nn++;
	if (show_num == 38) {
		UAVT_gui_PicoCSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "PicoCSettingsShow", VIEW_MODE_FCMENU, "PicoCSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)38);
		}
	}
	nn++;
	if (show_num == 39) {
		UAVT_gui_SensorSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "SensorSettingsShow", VIEW_MODE_FCMENU, "SensorSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)39);
		}
	}
	nn++;
	if (show_num == 40) {
		UAVT_gui_StabilizationSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "StabilizationSettingsShow", VIEW_MODE_FCMENU, "StabilizationSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)40);
		}
	}
	nn++;
	if (show_num == 41) {
		UAVT_gui_StateEstimation_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "StateEstimationShow", VIEW_MODE_FCMENU, "StateEstimation ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)41);
		}
	}
	nn++;
	if (show_num == 42) {
		UAVT_gui_SystemIdent_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "SystemIdentShow", VIEW_MODE_FCMENU, "SystemIdent ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)42);
		}
	}
	nn++;
	if (show_num == 43) {
		UAVT_gui_SystemSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "SystemSettingsShow", VIEW_MODE_FCMENU, "SystemSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)43);
		}
	}
	nn++;
	if (show_num == 44) {
		UAVT_gui_TrimAnglesSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "TrimAnglesSettingsShow", VIEW_MODE_FCMENU, "TrimAnglesSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)44);
		}
	}
	nn++;
	if (show_num == 45) {
		UAVT_gui_TxPIDSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "TxPIDSettingsShow", VIEW_MODE_FCMENU, "TxPIDSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)45);
		}
	}
	nn++;
	if (show_num == 46) {
		UAVT_gui_VibrationAnalysisSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "VibrationAnalysisSettingsShow", VIEW_MODE_FCMENU, "VibrationAnalysisSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)46);
		}
	}
	nn++;
	if (show_num == 47) {
		UAVT_gui_VtolPathFollowerSettings_show(esContext);
	} else if (show_num == 0) {
		if (nn >= msy && nn < msy + 14) {
			draw_text_button(esContext, "VtolPathFollowerSettingsShow", VIEW_MODE_FCMENU, "VtolPathFollowerSettings ()", FONT_WHITE, -1.2, -0.9 + ny++ * 0.12, 0.002, 0.08, ALIGN_LEFT, ALIGN_TOP, UAVT_gui_show_num_change, (float)47);
		}
	}
	nn++;
	if (msy > nn - 14) {
		msy = nn - 14;
	}
	if (sy > nn - 14) {
		sy = nn - 14;
	}

	if (show_num != 0) {
		draw_text_button(esContext, "gui_scroll", VIEW_MODE_FCMENU, "[SCROLL]", FONT_WHITE, 0.9, 0.9, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, UAVT_gui_scroll, 0.0);
	}
	if (show_num == 0) {
		draw_text_button(esContext, "gui_main_scroll", VIEW_MODE_FCMENU, "[SCROLL]", FONT_WHITE, 0.9, 0.9, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, UAVT_gui_main_scroll, 0.0);
	} else {
		draw_text_button(esContext, "gui_show_num_change", VIEW_MODE_FCMENU, "[BACK]", FONT_WHITE, 0.0, 0.9, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, UAVT_gui_show_num_change, 0.0);
	}
}
Exemple #10
0
void swarm_draw_setup(ESContext *esContext) {
	int n = 0;
	int ny = 1;
	int gx = 0;
	int gy = 0;
	char tmp_str[128];
	char tmp_str2[128];
	float px1 = -0.8;
	float py1 = -0.9;
	float px2 = 0.9;
	float py2 = 0.1;
	float sy = 0.08;
	reset_buttons();
	EntryList list[3];
	list[0].name = "ROLE";
	list[1].name = "OFFSET";
	list[2].name = NULL;
	draw_window(esContext, px1, py1, px2, py2, 0.002, "SwarmSetup.options", "Swarm-Setup", list, SwarmSetup.options, swarm_set);
	if (SwarmSetup.options == 0) {
		draw_text_button(esContext, "master_title", setup.view_mode, "Master:", FONT_WHITE, px1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		ny++;
		uint8_t n2 = 0;
		EntryList list[MODELS_MAX + 2];
		list[0].name = "GCS";
		for (n2 = 0; n2 < MODELS_MAX; n2++) {
			list[n2 + 1].name = ModelData[n2].name;
		}
		list[n2 + 1].name = NULL;
		draw_pulldown(esContext, px1 + 0.1, py1 + (float)ny * sy, 0.45, 0.01, "SwarmSetup.master", list, pd_openm, SwarmSetup.master + 1, swarm_set);
		ny++;
		draw_text_button(esContext, "sclave_title", setup.view_mode, "Slaves:", FONT_WHITE, px1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		ny++;
		for (n = 0; n < 4; n++) {
			sprintf(tmp_str2, "SwarmSetup.slave%i", n);
			draw_pulldown(esContext, px1 + 0.1, py1 + (float)ny * sy, 0.44, 0.01, tmp_str2, list, pd_open[n], SwarmSetup.slave[n] + 1, swarm_set);
			sprintf(tmp_str, "X=%im", SwarmSetup.offset_x[n]);
			sprintf(tmp_str2, "SwarmSetup.offx%i", n);
			draw_spinbox(esContext, px1 + 0.55, py1 + (float)ny * sy, 0.34, 0.01, tmp_str2, "X=%0.0fm", SwarmSetup.offset_x[n], swarm_set);
			sprintf(tmp_str, "Y=%im", SwarmSetup.offset_y[n]);
			sprintf(tmp_str2, "SwarmSetup.offy%i", n);
			draw_spinbox(esContext, px1 + 0.9, py1 + (float)ny * sy, 0.34, 0.01, tmp_str2, "Y=%0.0fm", SwarmSetup.offset_y[n], swarm_set);
			sprintf(tmp_str, "Z=%im", SwarmSetup.offset_z[n]);
			sprintf(tmp_str2, "SwarmSetup.offz%i", n);
			draw_spinbox(esContext, px1 + 1.25, py1 + (float)ny * sy, 0.34, 0.01, tmp_str2, "Z=%0.0fm", SwarmSetup.offset_z[n], swarm_set);
			ny++;
		}
		ny++;
		draw_text_button(esContext, "swarm_yawmode_", setup.view_mode, "Yaw-Rotate", FONT_GREEN, px1 + 0.1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		draw_checkbox(esContext, px1 + 0.7, py1 + (float)ny * sy, 0.005, "swarm_yawmode", SwarmSetup.yaw_mode, swarm_set);
		ny++;
		draw_text_button(esContext, "swarm_rotate_", setup.view_mode, "Pattern-Rotate", FONT_GREEN, px1 + 0.1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		draw_checkbox(esContext, px1 + 0.7, py1 + (float)ny * sy, 0.005, "swarm_rotate", SwarmSetup.rotate, swarm_set);
		ny++;
	} else {
		float gx1 = px1 + 0.5;
		float gx2 = px2 - 0.1;
		float gy1 = py1 + 0.15;
		float gy2 = py2 - 0.15;
		int gxn = 80;
		int gyn = 40;
		ny++;
		ny++;
		sprintf(tmp_str, "SLAVE=%i", SwarmSetup.selected);
		draw_text_button(esContext, "SwarmSetup.selected", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		ny++;
		sprintf(tmp_str, "%s", ModelData[SwarmSetup.slave[SwarmSetup.selected]].name);
		draw_text_button(esContext, "SwarmSetup.offn", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		sprintf(tmp_str, "X=%im", SwarmSetup.offset_x[SwarmSetup.selected]);
		draw_text_button(esContext, "SwarmSetup.offx", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		sprintf(tmp_str, "Y=%im", SwarmSetup.offset_y[SwarmSetup.selected]);
		draw_text_button(esContext, "SwarmSetup.offy", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		sprintf(tmp_str, "Z=%im", SwarmSetup.offset_z[SwarmSetup.selected]);
		draw_text_button(esContext, "SwarmSetup.offz", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		for (gx = 0; gx <= gxn; gx++) {
			draw_line_f3(esContext, gx1 + (float)gx * ((gx2 - gx1) / (float)gxn), gy1, 0.006, gx1 + (float)gx * ((gx2 - gx1) / (float)gxn), gy2, 0.006, 255, 255, 255, 90);
		}
		for (gy = 0; gy <= gyn; gy++) {
			draw_line_f3(esContext, gx1, gy1 + (float)gy * ((gy2 - gy1) / (float)gyn), 0.006, gx2, gy1 + (float)gy * ((gy2 - gy1) / (float)gyn), 0.006, 255, 255, 255, 90);
		}
		draw_circleFilled_f3(esContext, gx1 + (gx2 - gx1) / 2.0, gy1 + (gy2 - gy1) / 2.0, 0.007, 0.01, 255, 0, 0, 255);
		for (n = 0; n < 4; n++) {
			if (SwarmSetup.slave[n] == -1) {
				continue;
			}
			float offx = SwarmSetup.offset_x[n] / 50.0;
			float offy = SwarmSetup.offset_y[n] / 50.0;
			draw_circleFilled_f3(esContext, gx1 + (gx2 - gx1) / 2.0 + offx, gy1 + (gy2 - gy1) / 2.0 + offy, 0.007, 0.01, 255, 255, 0, 255);
			if (n == SwarmSetup.selected) {
				draw_circle_f3(esContext, gx1 + (gx2 - gx1) / 2.0 + offx, gy1 + (gy2 - gy1) / 2.0 + offy, 0.007, 0.02, 255, 0, 255, 255);
			}
		}
	}
	draw_buttonbox(esContext, "swarm_setup_done", setup.view_mode, "CLOSE", px2 - 0.33, py2 - 0.1, 0.3, 0.005, swarm_set, 0.0);
}