public void doFirmwareFlash() {
		firmwareDialog.enableButtons(false);
		new Thread(new Runnable() {
			public void run() {
				try {
					if (connectionState == ConnectionState.CONNECTED) {
						altimeter.disconnect();
						setConnectionState(ConnectionState.BUSY);
					}
					log("Flashing altimeter firmware ...", "message");
					doFirmwareUpload();
					log("Done.", "message");
					log("Rebooting altimeter ...", "message");
					String comPort = window.getSelectedCOMPort();
					log("Connecting to serial port " + comPort + " (please wait) ...", "message");
					log(altimeter.connect(comPort, 57600), "altimeter");
					log("Reboot finished.", "message");
					log("Erasing altimeter (please wait) ...", "message");
					log(altimeter.erase(), "altimeter");
					log("Wiping settings memory ...", "message");
					altimeter.wipeSettings();
					log("Firmware upgrade done - reconnecting ...", "message");
					altimeter.disconnect();
					log("Connecting to serial port " + comPort + " (please wait) ...", "message");
					log(altimeter.connect(comPort, 57600), "altimeter");
					log("Connected.", "message");
					setConnectionState(ConnectionState.CONNECTED);
				} catch (FirmwareFlashException e) {
					e.printStackTrace();
					log("Error flashing firmware.", "error");
					setConnectionState(ConnectionState.DISCONNECTED);
					return;
				} catch (IOException e) {
					e.printStackTrace();
					log("Error communicating with altimeter.", "error");
					altimeter.disconnect();
					setConnectionState(ConnectionState.DISCONNECTED);
					return;
				} catch (NotAnOpenaltimeterException e) {
					e.printStackTrace();
					log("Incorrect reply from device. Check that you've selected the correct serial port, and that " +
							"the openaltimeter is connected and powered.", "error");
					altimeter.disconnect();
					setConnectionState(ConnectionState.DISCONNECTED);
					return;
				} catch (Exception e) {
					e.printStackTrace();
					log("Exception communicating with altimeter. Check your serial port settings.", "error");
					altimeter.disconnect();
					setConnectionState(ConnectionState.DISCONNECTED);
					return;
				} finally {
					firmwareDialog.enableButtons(true);
					firmwareDialog.dispose();
				}

				runSettingsInterface();
			}}).start();
	}