X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosConfigData.java;h=a9e863c7759edac882571fa00ab7904d190b7602;hb=51ef3fad6435c0b21945d48fbbaa5a4c092c4960;hp=fd38635cc0cd25c1e7e1560c5741e53ac8bafe09;hpb=935f769fee351545622e223a283fca64608ca410;p=fw%2Faltos diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index fd38635c..a9e863c7 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -90,6 +90,9 @@ public class AltosConfigData implements Iterable { public int tracker_motion; public int tracker_interval; + /* HAS_GYRO */ + public int accel_zero_along, accel_zero_across, accel_zero_through; + public static String get_string(String line, String label) throws ParseException { if (line.startsWith(label)) { String quoted = line.substring(label.length()).trim(); @@ -266,6 +269,10 @@ public class AltosConfigData implements Iterable { storage_size = -1; storage_erase_unit = -1; stored_flight = 0; + + accel_zero_along = -1; + accel_zero_across = -1; + accel_zero_through = -1; } public void parse_line(String line) { @@ -361,6 +368,18 @@ public class AltosConfigData implements Iterable { /* Log listing replies */ try { get_int(line, "flight"); stored_flight++; } catch (Exception e) {} + + /* HAS_GYRO */ + try { + if (line.startsWith("IMU call along")) { + String[] bits = line.split("\\s+"); + if (bits.length >= 8) { + accel_zero_along = Integer.parseInt(bits[3]); + accel_zero_across = Integer.parseInt(bits[5]); + accel_zero_through = Integer.parseInt(bits[7]); + } + } + } catch (Exception e) {} } public AltosConfigData() { @@ -386,6 +405,10 @@ public class AltosConfigData implements Iterable { return radio_frequency >= 0 || radio_setting >= 0 || radio_channel >= 0; } + public boolean has_telemetry_rate() { + return telemetry_rate >= 0; + } + public void set_frequency(double freq) { int frequency = radio_frequency; int setting = radio_setting; @@ -425,6 +448,8 @@ public class AltosConfigData implements Iterable { return false; if (product.startsWith("TeleMetrum-v2")) return false; + if (product.startsWith("EasyMega")) + return false; return true; } @@ -558,20 +583,39 @@ public class AltosConfigData implements Iterable { radio_calibration); /* When remote, reset the dongle frequency at the same time */ if (remote) { + link.flush_output(); link.stop_remote(); link.set_radio_frequency(frequency); + link.flush_output(); link.start_remote(); } } - if (callsign != null) + if (telemetry_rate >= 0) { + link.printf("c T %d\n", telemetry_rate); + if (remote) { + link.flush_output(); + link.stop_remote(); + link.set_telemetry_rate(telemetry_rate); + link.flush_output(); + link.start_remote(); + } + } + + if (callsign != null) { link.printf("c c %s\n", callsign); + if (remote) { + link.flush_output(); + link.stop_remote(); + link.set_callsign(callsign); + link.flush_output(); + link.start_remote(); + } + } + if (radio_enable >= 0) link.printf("c e %d\n", radio_enable); - if (telemetry_rate >= 0) - link.printf("c T %d\n", telemetry_rate); - /* HAS_ACCEL */ /* UI doesn't support accel cal */ if (pad_orientation >= 0) @@ -612,6 +656,9 @@ public class AltosConfigData implements Iterable { if (tracker_motion >= 0 && tracker_interval >= 0) link.printf("c t %d %d\n", tracker_motion, tracker_interval); + /* HAS_GYRO */ + /* UI doesn't support accel cal */ + link.printf("c w\n"); link.flush_output(); }