altos/lisp: Fix uninitialized values in ao_lisp_make_const
[fw/altos] / altoslib / AltosEepromIterable.java
index 8e6a23139d4d5a5a000e0c6978f0b55054880276..77632ac139b2bf424bb19d8c98955bb4c1e8fc08 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,7 +16,7 @@
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_1;
+package org.altusmetrum.altoslib_11;
 
 import java.io.*;
 import java.util.*;
@@ -38,6 +39,13 @@ class AltosEepromOrdered implements Comparable<AltosEepromOrdered> {
                if (cmd_diff != 0)
                        return cmd_diff;
 
+               if (eeprom.has_seconds() && o.eeprom.has_seconds()) {
+                       int     seconds_diff = eeprom.seconds() - o.eeprom.seconds();
+
+                       if (seconds_diff != 0)
+                               return seconds_diff;
+               }
+
                int     tick_diff = tick - o.tick;
 
                if (tick_diff != 0)
@@ -73,7 +81,9 @@ class AltosEepromOrderedIterator implements Iterator<AltosEeprom> {
                                tick = t;
                        }
                        olist.add(new AltosEepromOrdered(e, index++, tick));
+                       first = false;
                }
+
                oiterator = olist.iterator();
        }
 
@@ -114,4 +124,4 @@ public class AltosEepromIterable implements Iterable<AltosEeprom> {
                        eeproms = new LinkedList<AltosEeprom>();
                return new AltosEepromOrderedIterator(eeproms);
        }
-}
\ No newline at end of file
+}