Exemplo n.º 1
0
void gui_set_calib_action(uint8_t index)
{
	switch(index)
	{
	case(0):
		gui_dialog_set_P(PSTR("Place device on"), PSTR("each edge and\nwait for confirm.\nRefer to manual."), GUI_STYLE_OK | GUI_STYLE_NO_TITLE, gui_set_calib_action_acc);
		gui_switch_task(GUI_DIALOG);
	break;

	case(1):
		gui_dialog_set_P(PSTR("Rotate device"), PSTR("around each axis.\nRefer to manual."), GUI_STYLE_OK | GUI_STYLE_NO_TITLE, gui_set_calib_action_mag);
		gui_switch_task(GUI_DIALOG);
	break;
	}
}
Exemplo n.º 2
0
void gui_set_advanced_action(uint8_t index)
{
	switch(index)
	{
	case(0):
		config.connectivity.usb_mode = !config.connectivity.usb_mode;
		eeprom_busy_wait();
		eeprom_update_byte(&config_ee.connectivity.usb_mode, config.connectivity.usb_mode);
	break;

	case(1):
		config.connectivity.uart_function = (config.connectivity.uart_function + 1) % NUMBER_OF_UART_FORWARD;
		eeprom_busy_wait();
		eeprom_update_byte(&config_ee.connectivity.uart_function, config.connectivity.uart_function);
		uart_stop();
		uart_init();
	break;

	case(2):
		if (!storage_card_in())
		{
			gui_showmessage_P(PSTR("No SD card!"));

			return;
		}
		gui_dialog_set_P(PSTR("Warning"), PSTR("This will erase\nall data from SD\ncard! Continue?"), GUI_STYLE_YESNO, gui_set_advanced_format_cb);
		gui_switch_task(GUI_DIALOG);
	break;

	case(3):
		gui_switch_task(GUI_SET_CALIB);
	break;
	}
}
Exemplo n.º 3
0
void gui_storage_format_cb(uint8_t ret)
{
	if (ret == GUI_DIALOG_YES)
	{
		gui_dialog_set_P(PSTR("Warning"), PSTR("This will erase\nall data from SD\ncard! Continue?"), GUI_STYLE_OKCANCEL, gui_storage_format_cb2);
		gui_switch_task(GUI_DIALOG);
	}
	else
	{
		gui_switch_task(GUI_PAGES);
	}
}
Exemplo n.º 4
0
void fc_landing()
{
	gui_dialog_set_P(PSTR("Landing"), PSTR(""), GUI_STYLE_STATS, fc_landing_cb);
	fc_landing_old_gui_task = gui_task;
	gui_switch_task(GUI_DIALOG);

	fc.flight_state = FLIGHT_LAND;

	fc.flight_timer = task_get_ms_tick() - fc.flight_timer;

	audio_off();

	logger_stop();
}
Exemplo n.º 5
0
void gui_set_system_action(uint8_t index)
{
	switch(index)
	{
	case(0):
		gui_switch_task(GUI_SET_TIME);
	break;

	case(1):
		gui_switch_task(GUI_SET_DISPLAY);
	break;

	case(2):
		gui_switch_task(GUI_SET_AUDIO);
	break;

	case(3):
		config.connectivity.usb_mode = !config.connectivity.usb_mode;
		eeprom_busy_wait();
		eeprom_update_byte(&config_ee.connectivity.usb_mode, config.connectivity.usb_mode);
	break;

	case(4):
		gui_value_conf_P(PSTR("Auto power-off"), GUI_VAL_NUMBER_DISABLE, PSTR("%0.0f min"), config.system.auto_power_off, 0, 120, 1, gui_set_system_auto_power_off_cb);
		gui_switch_task(GUI_SET_VAL);
	break;

	case(5):
		config.connectivity.uart_function = (config.connectivity.uart_function + 1) % NUMBER_OF_UART_FORWARD;
		eeprom_busy_wait();
		eeprom_update_byte(&config_ee.connectivity.uart_function, config.connectivity.uart_function);
		uart_stop();
		uart_init();
	break;

	case(6):
		if (!storage_card_in())
		{
			gui_showmessage_P(PSTR("No SD card!"));

			return;
		}
		gui_dialog_set_P(PSTR("Warning"), PSTR("This will erase\nall data from SD\ncard! Continue?"), GUI_STYLE_OKCANCEL, gui_set_system_format_cb);
		gui_switch_task(GUI_DIALOG);
	break;
	}
}
Exemplo n.º 6
0
void gui_set_debug_action(uint8_t index)
{
	switch(index)
	{
//		case(3):
//			gui_dialog_set_P(PSTR("Confirmation"), PSTR("Do you want to\nreset Factory\ntest?"), GUI_STYLE_YESNO, gui_set_debug_reset_fc);
//			gui_switch_task(GUI_DIALOG);
//		break;

		case(2):
			battery_update();
		break;

		case(4):
			if (config.system.debug_log == DEBUG_MAGIC_ON)
				config.system.debug_log = 0;
			else
				config.system.debug_log = DEBUG_MAGIC_ON;
			eeprom_busy_wait();
			eeprom_update_byte(&config_ee.system.debug_log, config.system.debug_log);
		break;

		case(5):
			gui_dialog_set_P(PSTR("Confirmation"), PSTR("Clear\ndebug.log?"), GUI_STYLE_YESNO, gui_set_debug_delete_fc);
			gui_switch_task(GUI_DIALOG);
		break;

		case(6):
			config.system.debug_gps = !config.system.debug_gps;
			eeprom_busy_wait();
			eeprom_update_byte(&config_ee.system.debug_gps, config.system.debug_gps);
		break;

		case(8):
			config.system.record_screen = !config.system.record_screen;
			eeprom_busy_wait();
			eeprom_update_byte(&config_ee.system.record_screen, config.system.record_screen);
		break;
	}
}
Exemplo n.º 7
0
void gui_storage_mount_error()
{
	gui_dialog_set_P(PSTR("Error"), PSTR("Unable to mount\ndata storage.\nFormat SD card?"), GUI_STYLE_YESNO, gui_storage_format_cb);
	gui_switch_task(GUI_DIALOG);
}