diff options
-rw-r--r-- | altoslib/AltosConfigData.java | 19 | ||||
-rw-r--r-- | altoslib/AltosIdleFetch.java | 1 | ||||
-rw-r--r-- | altoslib/AltosMs5607.java | 14 |
3 files changed, 31 insertions, 3 deletions
diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index a9e863c7..65f6346a 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -93,6 +93,16 @@ public class AltosConfigData implements Iterable<String> { /* HAS_GYRO */ public int accel_zero_along, accel_zero_across, accel_zero_through; + /* ms5607 data */ + public int ms5607_reserved; + public int ms5607_sens; + public int ms5607_off; + public int ms5607_tcs; + public int ms5607_tco; + public int ms5607_tref; + public int ms5607_tempsens; + public int ms5607_crc; + public static String get_string(String line, String label) throws ParseException { if (line.startsWith(label)) { String quoted = line.substring(label.length()).trim(); @@ -289,6 +299,15 @@ public class AltosConfigData implements Iterable<String> { /* Version also contains MS5607 info, which we ignore here */ + try { ms5607_reserved = get_int(line, "ms5607 reserved:"); } catch (Exception e) {} + try { ms5607_sens = get_int(line, "ms5607 sens:"); } catch (Exception e) {} + try { ms5607_off = get_int(line, "ms5607 off:"); } catch (Exception e) {} + try { ms5607_tcs = get_int(line, "ms5607 tcs:"); } catch (Exception e) {} + try { ms5607_tco = get_int(line, "ms5607 tco:"); } catch (Exception e) {} + try { ms5607_tref = get_int(line, "ms5607 tref:"); } catch (Exception e) {} + try { ms5607_tempsens = get_int(line, "ms5607 tempsens:"); } catch (Exception e) {} + try { ms5607_crc = get_int(line, "ms5607 crc:"); } catch (Exception e) {} + /* Config show replies */ /* HAS_FLIGHT */ diff --git a/altoslib/AltosIdleFetch.java b/altoslib/AltosIdleFetch.java index 50745d97..981035d4 100644 --- a/altoslib/AltosIdleFetch.java +++ b/altoslib/AltosIdleFetch.java @@ -131,6 +131,7 @@ public class AltosIdleFetch implements AltosStateUpdate { public void update_state(AltosState state) throws InterruptedException { try { + /* Fetch config data from remote */ AltosConfigData config_data = new AltosConfigData(link); state.set_state(AltosLib.ao_flight_startup); state.set_serial(config_data.serial); diff --git a/altoslib/AltosMs5607.java b/altoslib/AltosMs5607.java index 97e17164..056a8490 100644 --- a/altoslib/AltosMs5607.java +++ b/altoslib/AltosMs5607.java @@ -127,7 +127,7 @@ public class AltosMs5607 implements Serializable { static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException { try { - AltosMs5607 ms5607 = new AltosMs5607(link); + AltosMs5607 ms5607 = new AltosMs5607(link, config_data); if (ms5607 != null) { state.set_ms5607(ms5607); @@ -144,9 +144,17 @@ public class AltosMs5607 implements Serializable { cc = AltosLib.MISSING; } - public AltosMs5607 (AltosLink link) throws InterruptedException, TimeoutException { + public AltosMs5607 (AltosLink link, AltosConfigData config_data) throws InterruptedException, TimeoutException { this(); - link.printf("c s\nB\n"); + reserved = config_data.ms5607_reserved; + sens = config_data.ms5607_sens; + off = config_data.ms5607_off; + tcs = config_data.ms5607_tcs; + tco = config_data.ms5607_tco; + tref = config_data.ms5607_tref; + tempsens = config_data.ms5607_tempsens; + crc = config_data.ms5607_crc; + link.printf("B\n"); for (;;) { String line = link.get_reply_no_dialog(5000); if (line == null) { |