- public LaunchStatus (GridBagLayout layout, int y, String text) {
- GridBagConstraints c = new GridBagConstraints();
- c.weighty = 1;
-
- lights = new AltosLights();
- c.gridx = 0; c.gridy = y;
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.VERTICAL;
- c.weightx = 0;
- layout.setConstraints(lights, c);
- add(lights);
-
- label = new JLabel(text);
- label.setFont(Altos.label_font);
- label.setHorizontalAlignment(SwingConstants.LEFT);
- c.gridx = 1; c.gridy = y;
- c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.VERTICAL;
- c.weightx = 0;
- layout.setConstraints(label, c);
- add(label);
-
- value = new JTextField(Altos.text_width);
- value.setFont(Altos.value_font);
- value.setHorizontalAlignment(SwingConstants.RIGHT);
- c.gridx = 2; c.gridy = y;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1;
- layout.setConstraints(value, c);
- add(value);
+ class GPSLocked extends AltosUIIndicator {
+ public void show (AltosState state, AltosListenerState listener_state) {
+ if (state == null || state.gps == null)
+ hide();
+ else {
+ int sol = state.gps.nsat;
+ int sat = state.gps.cc_gps_sat == null ? 0 : state.gps.cc_gps_sat.length;
+ show("%d in solution", sol, "%d in view", sat);
+ set_lights(state.gps.locked && sol >= 4);
+ }
+ }
+ public GPSLocked (AltosUIFlightTab container, int y) {
+ super (container, y, "GPS Locked", 2, true, 1);
+ }
+ }