From 66e7a8081c07d0d96a31ae34963d430f06dccdfb Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 6 Feb 2015 04:45:17 -0800 Subject: altoslib: Store MS5607 data in AltosConfigData for use by AltosMs5607 When doing 'Monitor Idle', we fetch new config data each iteration and pass that to each of the readers, including ms5607. Instead of re-fetching the config data there, just store the ms5607 parameters when we fetch it the first time and copy it over. Signed-off-by: Keith Packard --- altoslib/AltosMs5607.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'altoslib/AltosMs5607.java') 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) { -- cgit v1.2.3