X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosDisplayThread.java;h=4b4cc3b9ac2aee901b5e633228eb2142b15ad4e9;hp=70144fb2a5b3ab3a1675aacf9b1f7571263642c0;hb=1a47532f411488f003726aa9365ede5dc90c5b78;hpb=de8d9c5630ae46378c50faf97f7d2e97fe139e30 diff --git a/altosui/AltosDisplayThread.java b/altosui/AltosDisplayThread.java index 70144fb2..4b4cc3b9 100644 --- a/altosui/AltosDisplayThread.java +++ b/altosui/AltosDisplayThread.java @@ -21,7 +21,7 @@ import java.awt.*; import javax.swing.*; import java.io.*; import java.text.*; -import org.altusmetrum.altoslib_1.*; +import org.altusmetrum.altoslib_2.*; public class AltosDisplayThread extends Thread { @@ -89,17 +89,18 @@ public class AltosDisplayThread extends Thread { /* If the rocket isn't on the pad, then report height */ if (Altos.ao_flight_drogue <= state.state && state.state < Altos.ao_flight_landed && + state.from_pad != null && state.range >= 0) { voice.speak("Height %s, bearing %s %d, elevation %d, range %s.\n", - AltosConvert.height.say(state.height), + AltosConvert.height.say(state.height()), state.from_pad.bearing_words( AltosGreatCircle.BEARING_VOICE), (int) (state.from_pad.bearing + 0.5), (int) (state.elevation + 0.5), AltosConvert.distance.say(state.range)); } else if (state.state > Altos.ao_flight_pad) { - voice.speak(AltosConvert.height.say_units(state.height)); + voice.speak(AltosConvert.height.say_units(state.height())); } else { reported_landing = 0; } @@ -110,10 +111,10 @@ public class AltosDisplayThread extends Thread { */ if (state.state >= Altos.ao_flight_drogue && (last || - System.currentTimeMillis() - state.report_time >= 15000 || + System.currentTimeMillis() - state.received_time >= 15000 || state.state == Altos.ao_flight_landed)) { - if (Math.abs(state.speed) < 20 && state.height < 100) + if (Math.abs(state.speed()) < 20 && state.height() < 100) voice.speak("rocket landed safely"); else voice.speak("rocket may have crashed"); @@ -185,12 +186,12 @@ public class AltosDisplayThread extends Thread { if ((old_state == null || old_state.state <= Altos.ao_flight_boost) && state.state > Altos.ao_flight_boost) { voice.speak("max speed: %s.", - AltosConvert.speed.say_units(state.max_speed + 0.5)); + AltosConvert.speed.say_units(state.max_speed() + 0.5)); ret = true; } else if ((old_state == null || old_state.state < Altos.ao_flight_drogue) && state.state >= Altos.ao_flight_drogue) { voice.speak("max height: %s.", - AltosConvert.height.say_units(state.max_height + 0.5)); + AltosConvert.height.say_units(state.max_height() + 0.5)); ret = true; } }