projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altosui: Hide Tilt Angle values when not available
[fw/altos]
/
altosui
/
AltosFlashUI.java
diff --git
a/altosui/AltosFlashUI.java
b/altosui/AltosFlashUI.java
index e305d458a171fa388aa0ee2c1cfcfc286f1c9f63..793a8af3d156dd142c5b8724a486fb71ca99e032 100644
(file)
--- a/
altosui/AltosFlashUI.java
+++ b/
altosui/AltosFlashUI.java
@@
-23,7
+23,7
@@
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.*;
import java.util.concurrent.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_
2
.*;
+import org.altusmetrum.altoslib_
3
.*;
import org.altusmetrum.altosuilib_1.*;
public class AltosFlashUI
import org.altusmetrum.altosuilib_1.*;
public class AltosFlashUI
@@
-365,7
+365,7
@@
public class AltosFlashUI
flash_task flasher;
flash_task flasher;
- private boolean open_device() {
+ private boolean open_device()
throws InterruptedException
{
try {
link = new AltosSerial(device);
if (is_pair_programmed())
try {
link = new AltosSerial(device);
if (is_pair_programmed())
@@
-377,7
+377,15
@@
public class AltosFlashUI
while (!link.is_loader()) {
link.to_loader();
while (!link.is_loader()) {
link.to_loader();
- java.util.List<AltosDevice> devices = AltosUSBDevice.list(AltosLib.product_altusmetrum);
+ java.util.List<AltosDevice> devices = null;
+
+ for (int tries = 0; tries < 10; tries++) {
+ Thread.sleep(100);
+ devices = AltosUSBDevice.list(AltosLib.product_altusmetrum);
+ if (devices.size() != 0)
+ break;
+ }
+
if (devices.size() == 1)
device = devices.get(0);
else {
if (devices.size() == 1)
device = devices.get(0);
else {
@@
-408,8
+416,12
@@
public class AltosFlashUI
return;
if (!select_source_file())
return;
return;
if (!select_source_file())
return;
- if (!open_device())
+ try {
+ if (!open_device())
+ return;
+ } catch (InterruptedException ie) {
return;
return;
+ }
build_dialog();
flash_task f = new flash_task(this);
}
build_dialog();
flash_task f = new flash_task(this);
}
@@
-425,4
+437,4
@@
public class AltosFlashUI
frame = in_frame;
}
frame = in_frame;
}
-}
\ No newline at end of file
+}