altoslib: create eeprom download thread before telling monitor about it
authorKeith Packard <keithp@keithp.com>
Wed, 18 Dec 2013 21:09:48 +0000 (13:09 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 18 Dec 2013 21:09:48 +0000 (13:09 -0800)
Telling the monitor too early resulted in passing a null thread
handle, which meant that 'cancel' wouldn't ever work.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosEepromDownload.java

index 542defeefb1e202c81a61019b9cec2bdfdd0fd97..1b04316715809b1e42be683748112761b6e720aa 100644 (file)
@@ -239,6 +239,7 @@ public class AltosEepromDownload implements Runnable {
 
        public void start() {
                eeprom_thread = new Thread(this);
 
        public void start() {
                eeprom_thread = new Thread(this);
+               monitor.set_thread(eeprom_thread);
                eeprom_thread.start();
        }
 
                eeprom_thread.start();
        }
 
@@ -255,7 +256,6 @@ public class AltosEepromDownload implements Runnable {
 
                monitor.set_states(AltosLib.ao_flight_boost, AltosLib.ao_flight_landed);
 
 
                monitor.set_states(AltosLib.ao_flight_boost, AltosLib.ao_flight_landed);
 
-               monitor.set_thread(eeprom_thread);
                monitor.start();
        }
 }
                monitor.start();
        }
 }